confile: s/lxc.cgroup.keep/lxc.cgroup.relative/g

parent 2339fce5
...@@ -1749,7 +1749,7 @@ static bool cgfsng_escape(const struct cgroup_ops *ops, struct lxc_conf *conf) ...@@ -1749,7 +1749,7 @@ static bool cgfsng_escape(const struct cgroup_ops *ops, struct lxc_conf *conf)
{ {
int i; int i;
if (conf->cgroup_meta.keep || geteuid()) if (conf->cgroup_meta.relative || geteuid())
return true; return true;
for (i = 0; ops->hierarchies[i]; i++) { for (i = 0; ops->hierarchies[i]; i++) {
...@@ -2281,7 +2281,7 @@ static bool cgroup_use_wants_controllers(const struct cgroup_ops *ops, ...@@ -2281,7 +2281,7 @@ static bool cgroup_use_wants_controllers(const struct cgroup_ops *ops,
/* At startup, parse_hierarchies finds all the info we need about cgroup /* At startup, parse_hierarchies finds all the info we need about cgroup
* mountpoints and current cgroups, and stores it in @d. * mountpoints and current cgroups, and stores it in @d.
*/ */
static bool cg_hybrid_init(struct cgroup_ops *ops, bool keep) static bool cg_hybrid_init(struct cgroup_ops *ops, bool relative)
{ {
int ret; int ret;
char *basecginfo; char *basecginfo;
...@@ -2293,7 +2293,7 @@ static bool cg_hybrid_init(struct cgroup_ops *ops, bool keep) ...@@ -2293,7 +2293,7 @@ static bool cg_hybrid_init(struct cgroup_ops *ops, bool keep)
/* Root spawned containers escape the current cgroup, so use init's /* Root spawned containers escape the current cgroup, so use init's
* cgroups as our base in that case. * cgroups as our base in that case.
*/ */
if (!keep && (geteuid() == 0)) if (!relative && (geteuid() == 0))
basecginfo = read_file("/proc/1/cgroup"); basecginfo = read_file("/proc/1/cgroup");
else else
basecginfo = read_file("/proc/self/cgroup"); basecginfo = read_file("/proc/self/cgroup");
...@@ -2444,12 +2444,12 @@ static int cg_is_pure_unified(void) ...@@ -2444,12 +2444,12 @@ static int cg_is_pure_unified(void)
} }
/* Get current cgroup from /proc/self/cgroup for the cgroupfs v2 hierarchy. */ /* Get current cgroup from /proc/self/cgroup for the cgroupfs v2 hierarchy. */
static char *cg_unified_get_current_cgroup(bool keep) static char *cg_unified_get_current_cgroup(bool relative)
{ {
char *basecginfo, *base_cgroup; char *basecginfo, *base_cgroup;
char *copy = NULL; char *copy = NULL;
if (!keep && (geteuid() == 0)) if (!relative && (geteuid() == 0))
basecginfo = read_file("/proc/1/cgroup"); basecginfo = read_file("/proc/1/cgroup");
else else
basecginfo = read_file("/proc/self/cgroup"); basecginfo = read_file("/proc/self/cgroup");
...@@ -2473,7 +2473,7 @@ cleanup_on_err: ...@@ -2473,7 +2473,7 @@ cleanup_on_err:
return copy; return copy;
} }
static int cg_unified_init(struct cgroup_ops *ops, bool keep) static int cg_unified_init(struct cgroup_ops *ops, bool relative)
{ {
int ret; int ret;
char *mountpoint, *subtree_path; char *mountpoint, *subtree_path;
...@@ -2487,7 +2487,7 @@ static int cg_unified_init(struct cgroup_ops *ops, bool keep) ...@@ -2487,7 +2487,7 @@ static int cg_unified_init(struct cgroup_ops *ops, bool keep)
if (ret != CGROUP2_SUPER_MAGIC) if (ret != CGROUP2_SUPER_MAGIC)
return 0; return 0;
base_cgroup = cg_unified_get_current_cgroup(keep); base_cgroup = cg_unified_get_current_cgroup(relative);
if (!base_cgroup) if (!base_cgroup)
return -EINVAL; return -EINVAL;
prune_init_scope(base_cgroup); prune_init_scope(base_cgroup);
...@@ -2523,7 +2523,7 @@ static bool cg_init(struct cgroup_ops *ops, struct lxc_conf *conf) ...@@ -2523,7 +2523,7 @@ static bool cg_init(struct cgroup_ops *ops, struct lxc_conf *conf)
{ {
int ret; int ret;
const char *tmp; const char *tmp;
bool keep = conf->cgroup_meta.keep; bool relative = conf->cgroup_meta.relative;
tmp = lxc_global_config_value("lxc.cgroup.use"); tmp = lxc_global_config_value("lxc.cgroup.use");
if (tmp) { if (tmp) {
...@@ -2539,14 +2539,14 @@ static bool cg_init(struct cgroup_ops *ops, struct lxc_conf *conf) ...@@ -2539,14 +2539,14 @@ static bool cg_init(struct cgroup_ops *ops, struct lxc_conf *conf)
free(pin); free(pin);
} }
ret = cg_unified_init(ops, keep); ret = cg_unified_init(ops, relative);
if (ret < 0) if (ret < 0)
return false; return false;
if (ret == CGROUP2_SUPER_MAGIC) if (ret == CGROUP2_SUPER_MAGIC)
return true; return true;
return cg_hybrid_init(ops, keep); return cg_hybrid_init(ops, relative);
} }
static bool cgfsng_data_init(struct cgroup_ops *ops) static bool cgfsng_data_init(struct cgroup_ops *ops)
......
...@@ -77,7 +77,7 @@ struct lxc_cgroup { ...@@ -77,7 +77,7 @@ struct lxc_cgroup {
struct /* meta */ { struct /* meta */ {
char *controllers; char *controllers;
char *dir; char *dir;
bool keep; bool relative;
}; };
}; };
}; };
......
...@@ -92,7 +92,7 @@ lxc_config_define(cap_keep); ...@@ -92,7 +92,7 @@ lxc_config_define(cap_keep);
lxc_config_define(cgroup_controller); lxc_config_define(cgroup_controller);
lxc_config_define(cgroup2_controller); lxc_config_define(cgroup2_controller);
lxc_config_define(cgroup_dir); lxc_config_define(cgroup_dir);
lxc_config_define(cgroup_keep); lxc_config_define(cgroup_relative);
lxc_config_define(console_buffer_size); lxc_config_define(console_buffer_size);
lxc_config_define(console_logfile); lxc_config_define(console_logfile);
lxc_config_define(console_path); lxc_config_define(console_path);
...@@ -169,7 +169,7 @@ static struct lxc_config_t config[] = { ...@@ -169,7 +169,7 @@ static struct lxc_config_t config[] = {
{ "lxc.cap.keep", set_config_cap_keep, get_config_cap_keep, clr_config_cap_keep, }, { "lxc.cap.keep", set_config_cap_keep, get_config_cap_keep, clr_config_cap_keep, },
{ "lxc.cgroup2", set_config_cgroup2_controller, get_config_cgroup2_controller, clr_config_cgroup2_controller, }, { "lxc.cgroup2", set_config_cgroup2_controller, get_config_cgroup2_controller, clr_config_cgroup2_controller, },
{ "lxc.cgroup.dir", set_config_cgroup_dir, get_config_cgroup_dir, clr_config_cgroup_dir, }, { "lxc.cgroup.dir", set_config_cgroup_dir, get_config_cgroup_dir, clr_config_cgroup_dir, },
{ "lxc.cgroup.keep", set_config_cgroup_keep, get_config_cgroup_keep, clr_config_cgroup_keep, }, { "lxc.cgroup.relative", set_config_cgroup_relative, get_config_cgroup_relative, clr_config_cgroup_relative, },
{ "lxc.cgroup", set_config_cgroup_controller, get_config_cgroup_controller, clr_config_cgroup_controller, }, { "lxc.cgroup", set_config_cgroup_controller, get_config_cgroup_controller, clr_config_cgroup_controller, },
{ "lxc.console.buffer.size", set_config_console_buffer_size, get_config_console_buffer_size, clr_config_console_buffer_size, }, { "lxc.console.buffer.size", set_config_console_buffer_size, get_config_console_buffer_size, clr_config_console_buffer_size, },
{ "lxc.console.logfile", set_config_console_logfile, get_config_console_logfile, clr_config_console_logfile, }, { "lxc.console.logfile", set_config_console_logfile, get_config_console_logfile, clr_config_console_logfile, },
...@@ -1399,26 +1399,26 @@ static int set_config_cgroup_dir(const char *key, const char *value, ...@@ -1399,26 +1399,26 @@ static int set_config_cgroup_dir(const char *key, const char *value,
return set_config_string_item(&lxc_conf->cgroup_meta.dir, value); return set_config_string_item(&lxc_conf->cgroup_meta.dir, value);
} }
static int set_config_cgroup_keep(const char *key, const char *value, static int set_config_cgroup_relative(const char *key, const char *value,
struct lxc_conf *lxc_conf, void *data) struct lxc_conf *lxc_conf, void *data)
{ {
unsigned int converted; unsigned int converted;
int ret; int ret;
if (lxc_config_value_empty(value)) if (lxc_config_value_empty(value))
return clr_config_cgroup_keep(key, lxc_conf, NULL); return clr_config_cgroup_relative(key, lxc_conf, NULL);
ret = lxc_safe_uint(value, &converted); ret = lxc_safe_uint(value, &converted);
if (ret < 0) if (ret < 0)
return -ret; return -ret;
if (converted == 1) { if (converted == 1) {
lxc_conf->cgroup_meta.keep = true; lxc_conf->cgroup_meta.relative = true;
return 0; return 0;
} }
if (converted == 0) { if (converted == 0) {
lxc_conf->cgroup_meta.keep = false; lxc_conf->cgroup_meta.relative = false;
return 0; return 0;
} }
...@@ -3240,11 +3240,12 @@ static int get_config_cgroup_dir(const char *key, char *retv, int inlen, ...@@ -3240,11 +3240,12 @@ static int get_config_cgroup_dir(const char *key, char *retv, int inlen,
return fulllen; return fulllen;
} }
static inline int get_config_cgroup_keep(const char *key, char *retv, int inlen, static inline int get_config_cgroup_relative(const char *key, char *retv,
struct lxc_conf *lxc_conf, void *data) int inlen, struct lxc_conf *lxc_conf,
void *data)
{ {
return lxc_get_conf_int(lxc_conf, retv, inlen, return lxc_get_conf_int(lxc_conf, retv, inlen,
lxc_conf->cgroup_meta.keep); lxc_conf->cgroup_meta.relative);
} }
static int get_config_idmaps(const char *key, char *retv, int inlen, static int get_config_idmaps(const char *key, char *retv, int inlen,
...@@ -3991,10 +3992,11 @@ static int clr_config_cgroup_dir(const char *key, struct lxc_conf *lxc_conf, ...@@ -3991,10 +3992,11 @@ static int clr_config_cgroup_dir(const char *key, struct lxc_conf *lxc_conf,
return 0; return 0;
} }
static inline int clr_config_cgroup_keep(const char *key, static inline int clr_config_cgroup_relative(const char *key,
struct lxc_conf *lxc_conf, void *data) struct lxc_conf *lxc_conf,
void *data)
{ {
lxc_conf->cgroup_meta.keep = false; lxc_conf->cgroup_meta.relative = false;
return 0; return 0;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment