From: Tycho Andersen Date: Wed, 14 Sep 2016 14:58:38 +0000 (+0000) Subject: cgroup: drop cgroup_canonical_path X-Git-Tag: lxc-2.1.0~322^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a0c91fccd9a1ae9c68a10880d4660d63a3b411e8;p=thirdparty%2Flxc.git cgroup: drop cgroup_canonical_path This is almost never the right thing to use, and we don't use it any more anyway. Signed-off-by: Tycho Andersen --- diff --git a/src/lxc/cgroups/cgfs.c b/src/lxc/cgroups/cgfs.c index 80a336db9..c5ba765fc 100644 --- a/src/lxc/cgroups/cgfs.c +++ b/src/lxc/cgroups/cgfs.c @@ -2363,28 +2363,6 @@ static const char *cgfs_get_cgroup(void *hdata, const char *subsystem) return lxc_cgroup_get_hierarchy_path_data(subsystem, d); } -static const char *cgfs_canonical_path(void *hdata) -{ - struct cgfs_data *d = hdata; - struct cgroup_process_info *info_ptr; - char *path = NULL; - - if (!d) - return NULL; - - for (info_ptr = d->info; info_ptr; info_ptr = info_ptr->next) { - if (!path) - path = info_ptr->cgroup_path; - else if (strcmp(path, info_ptr->cgroup_path) != 0) { - ERROR("not all paths match %s, %s has path %s", path, - info_ptr->hierarchy->subsystems[0], info_ptr->cgroup_path); - return NULL; - } - } - - return path; -} - static bool cgfs_escape(void *hdata) { struct cgroup_meta_data *md; @@ -2637,7 +2615,6 @@ static struct cgroup_ops cgfs_ops = { .enter = cgfs_enter, .create_legacy = cgfs_create_legacy, .get_cgroup = cgfs_get_cgroup, - .canonical_path = cgfs_canonical_path, .escape = cgfs_escape, .num_hierarchies = cgfs_num_hierarchies, .get_hierarchies = cgfs_get_hierarchies, diff --git a/src/lxc/cgroups/cgfsng.c b/src/lxc/cgroups/cgfsng.c index 0777bf39a..ec940995f 100644 --- a/src/lxc/cgroups/cgfsng.c +++ b/src/lxc/cgroups/cgfsng.c @@ -1087,13 +1087,6 @@ out_free: return false; } -static const char *cgfsng_canonical_path(void *hdata) -{ - struct cgfsng_handler_data *d = hdata; - - return d->container_cgroup; -} - static bool cgfsng_enter(void *hdata, pid_t pid) { char pidstr[25]; @@ -1686,7 +1679,6 @@ static struct cgroup_ops cgfsng_ops = { .destroy = cgfsng_destroy, .create = cgfsng_create, .enter = cgfsng_enter, - .canonical_path = cgfsng_canonical_path, .escape = cgfsng_escape, .num_hierarchies = cgfsng_num_hierarchies, .get_hierarchies = cgfsng_get_hierarchies, diff --git a/src/lxc/cgroups/cgmanager.c b/src/lxc/cgroups/cgmanager.c index f14eb1764..f2756b07f 100644 --- a/src/lxc/cgroups/cgmanager.c +++ b/src/lxc/cgroups/cgmanager.c @@ -746,15 +746,6 @@ static const char *cgm_get_cgroup(void *hdata, const char *subsystem) return d->cgroup_path; } -static const char *cgm_canonical_path(void *hdata) -{ - struct cgm_data *d = hdata; - - if (!d || !d->cgroup_path) - return NULL; - return d->cgroup_path; -} - #if HAVE_CGMANAGER_GET_PID_CGROUP_ABS_SYNC static inline bool abs_cgroup_supported(void) { return api_version >= CGM_SUPPORTS_GET_ABS; @@ -1667,7 +1658,6 @@ static struct cgroup_ops cgmanager_ops = { .enter = cgm_enter, .create_legacy = NULL, .get_cgroup = cgm_get_cgroup, - .canonical_path = cgm_canonical_path, .escape = cgm_escape, .num_hierarchies = cgm_num_hierarchies, .get_hierarchies = cgm_get_hierarchies, diff --git a/src/lxc/cgroups/cgroup.c b/src/lxc/cgroups/cgroup.c index 48cd403ba..78472d4fc 100644 --- a/src/lxc/cgroups/cgroup.c +++ b/src/lxc/cgroups/cgroup.c @@ -119,19 +119,6 @@ bool cgroup_escape(struct lxc_handler *handler) return false; } -const char *cgroup_canonical_path(struct lxc_handler *handler) -{ - if (geteuid()) { - WARN("cgroup_canonical_path only makes sense for privileged containers.\n"); - return NULL; - } - - if (ops) - return ops->canonical_path(handler->cgroup_data); - - return NULL; -} - int cgroup_num_hierarchies(void) { if (!ops) diff --git a/src/lxc/cgroups/cgroup.h b/src/lxc/cgroups/cgroup.h index f65cbfe49..11b251e69 100644 --- a/src/lxc/cgroups/cgroup.h +++ b/src/lxc/cgroups/cgroup.h @@ -47,7 +47,6 @@ struct cgroup_ops { bool (*enter)(void *hdata, pid_t pid); bool (*create_legacy)(void *hdata, pid_t pid); const char *(*get_cgroup)(void *hdata, const char *subsystem); - const char *(*canonical_path)(void *hdata); bool (*escape)(); int (*num_hierarchies)(); bool (*get_hierarchies)(int n, char ***out); @@ -78,11 +77,6 @@ extern const char *cgroup_get_cgroup(struct lxc_handler *handler, const char *su extern bool cgroup_escape(); extern int cgroup_num_hierarchies(); extern bool cgroup_get_hierarchies(int i, char ***out); - -/* - * Currently, this call only makes sense for privileged containers. - */ -extern const char *cgroup_canonical_path(struct lxc_handler *handler); extern bool cgroup_unfreeze(struct lxc_handler *handler); extern void cgroup_disconnect(void); extern cgroup_driver_t cgroup_driver(void);