Commit d7e0fb80 by Tycho Andersen Committed by Stéphane Graber

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: 's avatarTycho Andersen <tycho.andersen@canonical.com>
parent a6f6d468
......@@ -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,
......
......@@ -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,
......
......@@ -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,
......
......@@ -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)
......
......@@ -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);
......
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