return ret;
}
+static int cgfs_num_hierarchies(void)
+{
+ /* not implemented */
+ return -1;
+}
+
+static bool cgfs_get_hierarchies(int i, char ***out)
+{
+ /* not implemented */
+ return false;
+}
+
static bool cgfs_unfreeze(void *hdata)
{
struct cgfs_data *d = hdata;
.get_cgroup = cgfs_get_cgroup,
.canonical_path = cgfs_canonical_path,
.escape = cgfs_escape,
+ .num_hierarchies = cgfs_num_hierarchies,
+ .get_hierarchies = cgfs_get_hierarchies,
.get = lxc_cgroupfs_get,
.set = lxc_cgroupfs_set,
.unfreeze = cgfs_unfreeze,
return ret;
}
+static int cgfsng_num_hierarchies(void)
+{
+ int i;
+
+ for (i = 0; hierarchies[i]; i++)
+ ;
+
+ return i;
+}
+
+static bool cgfsng_get_hierarchies(int n, char ***out)
+{
+ int i;
+
+ /* sanity check n */
+ for (i = 0; i < n; i++) {
+ if (!hierarchies[i])
+ return false;
+ }
+
+ *out = hierarchies[i]->controllers;
+
+ return true;
+}
+
#define THAWED "THAWED"
#define THAWED_LEN (strlen(THAWED))
.enter = cgfsng_enter,
.canonical_path = cgfsng_canonical_path,
.escape = cgfsng_escape,
+ .num_hierarchies = cgfsng_num_hierarchies,
+ .get_hierarchies = cgfsng_get_hierarchies,
.get_cgroup = cgfsng_get_cgroup,
.get = cgfsng_get,
.set = cgfsng_set,
return ret;
}
+static int cgm_num_hierarchies(void)
+{
+ /* not implemented */
+ return -1;
+}
+
+static bool cgm_get_hierarchies(int i, char ***out)
+{
+ /* not implemented */
+ return false;
+}
+
struct chown_data {
const char *cgroup_path;
uid_t origuid;
.get_cgroup = cgm_get_cgroup,
.canonical_path = cgm_canonical_path,
.escape = cgm_escape,
+ .num_hierarchies = cgm_num_hierarchies,
+ .get_hierarchies = cgm_get_hierarchies,
.get = cgm_get,
.set = cgm_set,
.unfreeze = cgm_unfreeze,
return NULL;
}
+int cgroup_num_hierarchies(void)
+{
+ if (!ops)
+ return -1;
+
+ return ops->num_hierarchies();
+}
+
+bool cgroup_get_hierarchies(int n, char ***out)
+{
+ if (!ops)
+ return false;
+
+ return ops->get_hierarchies(n, out);
+}
+
bool cgroup_unfreeze(struct lxc_handler *handler)
{
if (ops)
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);
int (*set)(const char *filename, const char *value, const char *name, const char *lxcpath);
int (*get)(const char *filename, char *value, size_t len, const char *name, const char *lxcpath);
bool (*unfreeze)(void *hdata);
extern int cgroup_nrtasks(struct lxc_handler *handler);
extern const char *cgroup_get_cgroup(struct lxc_handler *handler, const char *subsystem);
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.