[libvirt] [PATCH 1/5] Introduce a more convenient virCgroupNewDetectMachine
Eric Blake
eblake at redhat.com
Thu Jul 25 17:37:12 UTC 2013
On 07/25/2013 06:20 AM, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange" <berrange at redhat.com>
>
> Instead of requiring drivers to use a combination of calls
> to virCgroupNewDetect and virCgroupIsValidMachine, combine
> the two into virCgroupNewDetectMachine
>
> Signed-off-by: Daniel P. Berrange <berrange at redhat.com>
> ---
> src/libvirt_private.syms | 1 +
> src/lxc/lxc_process.c | 20 ++++++++------------
> src/qemu/qemu_cgroup.c | 16 ++++------------
> src/util/vircgroup.c | 22 ++++++++++++++++++++++
> src/util/vircgroup.h | 5 +++++
> 5 files changed, 40 insertions(+), 24 deletions(-)
> @@ -1575,6 +1575,28 @@ int virCgroupNewDetect(pid_t pid ATTRIBUTE_UNUSED,
> }
> #endif
>
> +/*
> + * Returns 0 on success, -1 on fatal error, -2 on no valid cgroup
> + */
> +int virCgroupNewDetectMachine(const char *name,
> + const char *drivername,
> + pid_t pid,
> + virCgroupPtr *group)
> +{
> + if (virCgroupNewDetect(pid, group) < 0) {
> + if (virCgroupNewIgnoreError())
> + return 0;
> + return -1;
> + }
> +
> + if (!virCgroupIsValidMachineGroup(*group, name, drivername)) {
> + virCgroupFree(group);
> + return 0;
Huh? This says you are returning success. Also, none of the lxc or qemu
callers checked for a -2 return; do you really need the differentiated
return type?
--
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/20130725/e172ed17/attachment-0001.sig>
More information about the libvir-list
mailing list