cgroups: s/fullcgpath/container_full_path/g

parent 3ec9a308
...@@ -819,7 +819,7 @@ static struct hierarchy *add_hierarchy(struct hierarchy ***h, char **clist, char ...@@ -819,7 +819,7 @@ static struct hierarchy *add_hierarchy(struct hierarchy ***h, char **clist, char
new->controllers = clist; new->controllers = clist;
new->mountpoint = mountpoint; new->mountpoint = mountpoint;
new->base_cgroup = base_cgroup; new->base_cgroup = base_cgroup;
new->fullcgpath = NULL; new->container_full_path = NULL;
new->version = type; new->version = type;
newentry = append_null_to_list((void ***)h); newentry = append_null_to_list((void ***)h);
...@@ -1051,15 +1051,15 @@ static int cgroup_rmdir(struct hierarchy **hierarchies, ...@@ -1051,15 +1051,15 @@ static int cgroup_rmdir(struct hierarchy **hierarchies,
int ret; int ret;
struct hierarchy *h = hierarchies[i]; struct hierarchy *h = hierarchies[i];
if (!h->fullcgpath) if (!h->container_full_path)
continue; continue;
ret = recursive_destroy(h->fullcgpath); ret = recursive_destroy(h->container_full_path);
if (ret < 0) if (ret < 0)
WARN("Failed to destroy \"%s\"", h->fullcgpath); WARN("Failed to destroy \"%s\"", h->container_full_path);
free(h->fullcgpath); free(h->container_full_path);
h->fullcgpath = NULL; h->container_full_path = NULL;
} }
return 0; return 0;
...@@ -1196,9 +1196,9 @@ static bool create_path_for_hierarchy(struct hierarchy *h, char *cgname) ...@@ -1196,9 +1196,9 @@ static bool create_path_for_hierarchy(struct hierarchy *h, char *cgname)
{ {
int ret; int ret;
h->fullcgpath = must_make_path(h->mountpoint, h->base_cgroup, cgname, NULL); h->container_full_path = must_make_path(h->mountpoint, h->base_cgroup, cgname, NULL);
if (dir_exists(h->fullcgpath)) { if (dir_exists(h->container_full_path)) {
ERROR("The cgroup \"%s\" already existed", h->fullcgpath); ERROR("The cgroup \"%s\" already existed", h->container_full_path);
return false; return false;
} }
...@@ -1207,9 +1207,9 @@ static bool create_path_for_hierarchy(struct hierarchy *h, char *cgname) ...@@ -1207,9 +1207,9 @@ static bool create_path_for_hierarchy(struct hierarchy *h, char *cgname)
return false; return false;
} }
ret = mkdir_p(h->fullcgpath, 0755); ret = mkdir_p(h->container_full_path, 0755);
if (ret < 0) { if (ret < 0) {
ERROR("Failed to create cgroup \"%s\"", h->fullcgpath); ERROR("Failed to create cgroup \"%s\"", h->container_full_path);
return false; return false;
} }
...@@ -1220,12 +1220,12 @@ static void remove_path_for_hierarchy(struct hierarchy *h, char *cgname) ...@@ -1220,12 +1220,12 @@ static void remove_path_for_hierarchy(struct hierarchy *h, char *cgname)
{ {
int ret; int ret;
ret = rmdir(h->fullcgpath); ret = rmdir(h->container_full_path);
if (ret < 0) if (ret < 0)
SYSERROR("Failed to rmdir(\"%s\") from failed creation attempt", h->fullcgpath); SYSERROR("Failed to rmdir(\"%s\") from failed creation attempt", h->container_full_path);
free(h->fullcgpath); free(h->container_full_path);
h->fullcgpath = NULL; h->container_full_path = NULL;
} }
/* Try to create the same cgroup in all hierarchies. Start with cgroup_pattern; /* Try to create the same cgroup in all hierarchies. Start with cgroup_pattern;
...@@ -1287,9 +1287,9 @@ again: ...@@ -1287,9 +1287,9 @@ again:
for (i = 0; ops->hierarchies[i]; i++) { for (i = 0; ops->hierarchies[i]; i++) {
if (!create_path_for_hierarchy(ops->hierarchies[i], container_cgroup)) { if (!create_path_for_hierarchy(ops->hierarchies[i], container_cgroup)) {
int j; int j;
ERROR("Failed to create cgroup \"%s\"", ops->hierarchies[i]->fullcgpath); ERROR("Failed to create cgroup \"%s\"", ops->hierarchies[i]->container_full_path);
free(ops->hierarchies[i]->fullcgpath); free(ops->hierarchies[i]->container_full_path);
ops->hierarchies[i]->fullcgpath = NULL; ops->hierarchies[i]->container_full_path = NULL;
for (j = 0; j < i; j++) for (j = 0; j < i; j++)
remove_path_for_hierarchy(ops->hierarchies[j], container_cgroup); remove_path_for_hierarchy(ops->hierarchies[j], container_cgroup);
idx++; idx++;
...@@ -1320,7 +1320,7 @@ __cgfsng_ops__ static bool cgfsng_enter(struct cgroup_ops *ops, pid_t pid) ...@@ -1320,7 +1320,7 @@ __cgfsng_ops__ static bool cgfsng_enter(struct cgroup_ops *ops, pid_t pid)
int ret; int ret;
char *fullpath; char *fullpath;
fullpath = must_make_path(ops->hierarchies[i]->fullcgpath, fullpath = must_make_path(ops->hierarchies[i]->container_full_path,
"cgroup.procs", NULL); "cgroup.procs", NULL);
ret = lxc_write_to_file(fullpath, pidstr, len, false, 0666); ret = lxc_write_to_file(fullpath, pidstr, len, false, 0666);
if (ret != 0) { if (ret != 0) {
...@@ -1395,7 +1395,7 @@ static int chown_cgroup_wrapper(void *data) ...@@ -1395,7 +1395,7 @@ static int chown_cgroup_wrapper(void *data)
for (i = 0; arg->hierarchies[i]; i++) { for (i = 0; arg->hierarchies[i]; i++) {
char *fullpath; char *fullpath;
char *path = arg->hierarchies[i]->fullcgpath; char *path = arg->hierarchies[i]->container_full_path;
ret = chowmod(path, destuid, nsgid, 0775); ret = chowmod(path, destuid, nsgid, 0775);
if (ret < 0) if (ret < 0)
...@@ -1742,7 +1742,7 @@ __cgfsng_ops__ static int cgfsng_nrtasks(struct cgroup_ops *ops) ...@@ -1742,7 +1742,7 @@ __cgfsng_ops__ static int cgfsng_nrtasks(struct cgroup_ops *ops)
if (!ops->container_cgroup || !ops->hierarchies) if (!ops->container_cgroup || !ops->hierarchies)
return -1; return -1;
path = must_make_path(ops->hierarchies[0]->fullcgpath, NULL); path = must_make_path(ops->hierarchies[0]->container_full_path, NULL);
count = recursive_count_nrtasks(path); count = recursive_count_nrtasks(path);
free(path); free(path);
return count; return count;
...@@ -1815,7 +1815,7 @@ __cgfsng_ops__ static bool cgfsng_unfreeze(struct cgroup_ops *ops) ...@@ -1815,7 +1815,7 @@ __cgfsng_ops__ static bool cgfsng_unfreeze(struct cgroup_ops *ops)
if (!h) if (!h)
return false; return false;
fullpath = must_make_path(h->fullcgpath, "freezer.state", NULL); fullpath = must_make_path(h->container_full_path, "freezer.state", NULL);
ret = lxc_write_to_file(fullpath, THAWED, THAWED_LEN, false, 0666); ret = lxc_write_to_file(fullpath, THAWED, THAWED_LEN, false, 0666);
free(fullpath); free(fullpath);
if (ret < 0) if (ret < 0)
...@@ -1836,7 +1836,7 @@ __cgfsng_ops__ static const char *cgfsng_get_cgroup(struct cgroup_ops *ops, ...@@ -1836,7 +1836,7 @@ __cgfsng_ops__ static const char *cgfsng_get_cgroup(struct cgroup_ops *ops,
return NULL; return NULL;
} }
return h->fullcgpath ? h->fullcgpath + strlen(h->mountpoint) : NULL; return h->container_full_path ? h->container_full_path + strlen(h->mountpoint) : NULL;
} }
/* Given a cgroup path returned from lxc_cmd_get_cgroup_path, build a full path, /* Given a cgroup path returned from lxc_cmd_get_cgroup_path, build a full path,
...@@ -2161,7 +2161,7 @@ static int cg_legacy_set_data(struct cgroup_ops *ops, const char *filename, ...@@ -2161,7 +2161,7 @@ static int cg_legacy_set_data(struct cgroup_ops *ops, const char *filename,
return -ENOENT; return -ENOENT;
} }
fullpath = must_make_path(h->fullcgpath, filename, NULL); fullpath = must_make_path(h->container_full_path, filename, NULL);
ret = lxc_write_to_file(fullpath, value, strlen(value), false, 0666); ret = lxc_write_to_file(fullpath, value, strlen(value), false, 0666);
free(fullpath); free(fullpath);
return ret; return ret;
...@@ -2229,7 +2229,7 @@ static bool __cg_unified_setup_limits(struct cgroup_ops *ops, ...@@ -2229,7 +2229,7 @@ static bool __cg_unified_setup_limits(struct cgroup_ops *ops,
char *fullpath; char *fullpath;
struct lxc_cgroup *cg = iterator->elem; struct lxc_cgroup *cg = iterator->elem;
fullpath = must_make_path(h->fullcgpath, cg->subsystem, NULL); fullpath = must_make_path(h->container_full_path, cg->subsystem, NULL);
ret = lxc_write_to_file(fullpath, cg->value, strlen(cg->value), false, 0666); ret = lxc_write_to_file(fullpath, cg->value, strlen(cg->value), false, 0666);
free(fullpath); free(fullpath);
if (ret < 0) { if (ret < 0) {
......
...@@ -85,7 +85,7 @@ void cgroup_exit(struct cgroup_ops *ops) ...@@ -85,7 +85,7 @@ void cgroup_exit(struct cgroup_ops *ops)
free((*it)->mountpoint); free((*it)->mountpoint);
free((*it)->base_cgroup); free((*it)->base_cgroup);
free((*it)->fullcgpath); free((*it)->container_full_path);
free(*it); free(*it);
} }
free(ops->hierarchies); free(ops->hierarchies);
......
...@@ -62,7 +62,7 @@ typedef enum { ...@@ -62,7 +62,7 @@ typedef enum {
* is created. This will be either the caller's cgroup (if not root), or * is created. This will be either the caller's cgroup (if not root), or
* init's cgroup (if root). * init's cgroup (if root).
* *
* @fullcgpath * @container_full_path
* - The full path to the containers cgroup. * - The full path to the containers cgroup.
* *
* @version * @version
...@@ -77,7 +77,7 @@ struct hierarchy { ...@@ -77,7 +77,7 @@ struct hierarchy {
char **controllers; char **controllers;
char *mountpoint; char *mountpoint;
char *base_cgroup; char *base_cgroup;
char *fullcgpath; char *container_full_path;
int version; int version;
}; };
......
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