[libvirt] [PATCH v2 3/5] cgroup macros refactoring
Eric Blake
eblake at redhat.com
Mon Aug 12 18:02:11 UTC 2013
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 621 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20130812/343852e6/attachment-0001.sig>
More information about the libvir-list
mailing list