[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH v2 3/5] cgroup macros refactoring



On 08/11/2013 06:04 AM, Roman Bogorodskiy wrote:
> Continue converting to VIR_CGROUP_SUPPORTED
> ---
>  src/util/vircgroup.c | 378 +++++++++++++++++++++++++++------------------------
>  1 file changed, 202 insertions(+), 176 deletions(-)
> 

> -        if (STRNEQ(tmp, name) &&
> -            STRNEQ(tmp, partname) &&
> -            STRNEQ(tmp, scopename)) {
> -            VIR_DEBUG("Name '%s' for controller '%s' does not match '%s', '%s' or '%s'",
> -                      tmp, virCgroupControllerTypeToString(i), name, partname, scopename);

I'm using this opportunity to fold some long lines.

> - */
> -bool virCgroupHasController(virCgroupPtr cgroup, int controller)
> -{
> -    if (!cgroup)
> -        return false;
> -    if (controller < 0 || controller >= VIR_CGROUP_CONTROLLER_LAST)
> -        return false;
> -    return cgroup->controllers[controller].mountPoint != NULL;
> -}

This function was silent on failure beforehand...

> +
> +
> +static int virCgroupPartitionEscape(char **path);
> +
> +static bool
> +virCgroupValidateMachineGroup(virCgroupPtr group,

Rather than needing a forward declaration for virCgroupPartitionEscape,
we can use this opportunity to topologically sort the static helper
functions in the first place :)

>  #else /* VIR_CGROUP_SUPPORTED */

> +
> +bool virCgroupHasController(virCgroupPtr cgroup ATTRIBUTE_UNUSED,
> +                            int controller ATTRIBUTE_UNUSED)
> +{
> +    virReportSystemError(ENXIO, "%s",
> +                         _("Control groups not supported on this platform"));
> +    return false;

...therefore this shouldn't raise an error.

ACK with those things fixed (and I'm making the fixes locally before
pushing).

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]