The usecase is e.g. to have the possibility to list all controller 
variables:
there is possibility to show the variable value for given control group:

./cgget -r devices.deny /
/:
devices.deny=

but the user have to know the variable name (device.deny). So it would 
be fine to have some command (something like /cgget -a devices /) which 
will shouw the values of all variables in cgroup / for controller devices.
$ cgget -a devices /
/:
devices.allow=
devices.deny=
devices.list=a *:* rwm

there could be add some option to lssubsys too.

Ivana Hutarova Varekova wrote:
> api for generating the list of variables of given controller:
>
>     * int cgroup_get_value_name_count(struct cgroup_controller *controller)
>     functions return the number of variables in "controller"
>
>     * char *cgroup_get_value_name(struct cgroup_controller *controller, int
> index)
>     function return the "index" variable of "controller"
>
>
> Signed-off-by: Ivana Hutarova Varekova <[email protected]>
> ---
>
>  include/libcgroup.h |   16 ++++++++++++++++
>  src/libcgroup.map   |    2 ++
>  src/wrapper.c       |   24 ++++++++++++++++++++++++
>  3 files changed, 42 insertions(+), 0 deletions(-)
>
> diff --git a/include/libcgroup.h b/include/libcgroup.h
> index b58b2bb..d7cf2b5 100644
> --- a/include/libcgroup.h
> +++ b/include/libcgroup.h
> @@ -466,6 +466,22 @@ int cgroup_set_value_bool(struct cgroup_controller 
> *controller,
>                                               const char *name, bool value);
>  struct cgroup_controller *cgroup_get_controller(struct cgroup *cgroup,
>                                                       const char *name);
> +
> +/**
> + * Return the number of variables for the specified controller, if the
> + * structure does not exist -1 is returned
> + * @param controller Name of the controller for which stats are requested.
> + */
> +int cgroup_get_value_name_count(struct cgroup_controller *controller);
> +
> +/**
> + * Return the "index" variable for the specified controller,
> + * the return value is the pointer to the internal structure so
> + * don't dealocate it, or change the content of the memory space.
> + * @param controller Name of the controller for which stats are requested.
> + * @param index number of the variable.
> + */
> +char *cgroup_get_value_name(struct cgroup_controller *controller, int index);
>  /*
>   * Config related stuff
>   */
> diff --git a/src/libcgroup.map b/src/libcgroup.map
> index 87d8a51..8a8b038 100644
> --- a/src/libcgroup.map
> +++ b/src/libcgroup.map
> @@ -82,4 +82,6 @@ global:
>       cgroup_get_all_controller_begin;
>       cgroup_get_all_controller_next;
>       cgroup_get_all_controller_end;
> +     cgroup_get_value_name_count;
> +     cgroup_get_value_name; 
>  } CGROUP_0.34;
> diff --git a/src/wrapper.c b/src/wrapper.c
> index c82ffbf..53d70a9 100644
> --- a/src/wrapper.c
> +++ b/src/wrapper.c
> @@ -612,3 +612,27 @@ scgroup_err:
>       cgroup_free(&src_cgroup);
>       return NULL;
>  }
> +
> +int cgroup_get_value_name_count(struct cgroup_controller *controller)
> +{
> +     int ret;
> +
> +     if (!controller)
> +             return -1;
> +
> +     return controller->index;
> +}
> +
> +
> +char *cgroup_get_value_name(struct cgroup_controller *controller, int index)
> +{
> +
> +     if (!controller)
> +             return NULL;
> +
> +     if (index < controller->index)
> +             return (controller->values[index])->name;
> +     else
> +             return NULL;
> +}
> +
>
>
> ------------------------------------------------------------------------------
> This SF.Net email is sponsored by the Verizon Developer Community
> Take advantage of Verizon's best-in-class app development support
> A streamlined, 14 day to market process makes app distribution fast and easy
> Join now and get one step closer to millions of Verizon customers
> http://p.sf.net/sfu/verizon-dev2dev 
> _______________________________________________
> Libcg-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/libcg-devel
>   


------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
Libcg-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libcg-devel

Reply via email to