[libvirt] [PATCH] Clarify documentation on possible return values in case of errors

Signed-off-by: Claudio Bley <cbley@av-test.de> --- src/libvirt.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/libvirt.c b/src/libvirt.c index ffd4f8e..73972f2 100644 --- a/src/libvirt.c +++ b/src/libvirt.c @@ -14502,8 +14502,8 @@ virNodeDeviceGetName(virNodeDevicePtr dev) * * Accessor for the parent of the device * - * Returns the name of the device's parent, or NULL if the - * device has no parent. + * Returns the name of the device's parent, or NULL if an + * error occurred or when the device has no parent. */ const char * virNodeDeviceGetParent(virNodeDevicePtr dev) @@ -14537,7 +14537,8 @@ virNodeDeviceGetParent(virNodeDevicePtr dev) * * Accessor for the number of capabilities supported by the device. * - * Returns the number of capabilities supported by the device. + * Returns the number of capabilities supported by the device or -1 + * in case of error. */ int virNodeDeviceNumOfCaps(virNodeDevicePtr dev) @@ -14576,7 +14577,8 @@ error: * * Lists the names of the capabilities supported by the device. * - * Returns the number of capability names listed in @names. + * Returns the number of capability names listed in @names or -1 + * in case of error. */ int virNodeDeviceListCaps(virNodeDevicePtr dev, -- 1.7.9.5

At Thu, 9 Jan 2014 08:07:25 +0100, Claudio Bley wrote:
Signed-off-by: Claudio Bley <cbley@av-test.de> --- src/libvirt.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/src/libvirt.c b/src/libvirt.c index ffd4f8e..73972f2 100644
[I didn't push this under the trivial rule, but waiting for an ACK because of the freeze currently in effect.] FTR, note that this patch is the result of my thoughts from http://www.redhat.com/archives/libvir-list/2014-January/msg00366.html Claudio -- AV-Test GmbH, Henricistraße 20, 04155 Leipzig, Germany Phone: +49 341 265 310 19 Web:<http://www.av-test.org> Eingetragen am / Registered at: Amtsgericht Stendal (HRB 114076) Geschaeftsfuehrer (CEO): Andreas Marx, Guido Habicht, Maik Morgenstern

On Thu, Jan 09, 2014 at 08:07:25AM +0100, Claudio Bley wrote:
Signed-off-by: Claudio Bley <cbley@av-test.de> --- src/libvirt.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/src/libvirt.c b/src/libvirt.c index ffd4f8e..73972f2 100644 --- a/src/libvirt.c +++ b/src/libvirt.c @@ -14502,8 +14502,8 @@ virNodeDeviceGetName(virNodeDevicePtr dev) * * Accessor for the parent of the device * - * Returns the name of the device's parent, or NULL if the - * device has no parent. + * Returns the name of the device's parent, or NULL if an + * error occurred or when the device has no parent. */ const char * virNodeDeviceGetParent(virNodeDevicePtr dev) @@ -14537,7 +14537,8 @@ virNodeDeviceGetParent(virNodeDevicePtr dev) * * Accessor for the number of capabilities supported by the device. * - * Returns the number of capabilities supported by the device. + * Returns the number of capabilities supported by the device or -1 + * in case of error. */ int virNodeDeviceNumOfCaps(virNodeDevicePtr dev) @@ -14576,7 +14577,8 @@ error: * * Lists the names of the capabilities supported by the device. * - * Returns the number of capability names listed in @names. + * Returns the number of capability names listed in @names or -1 + * in case of error. */ int virNodeDeviceListCaps(virNodeDevicePtr dev,
ACK. -- Guido

At Fri, 10 Jan 2014 07:42:52 +0100, Guido Günther wrote:
On Thu, Jan 09, 2014 at 08:07:25AM +0100, Claudio Bley wrote:
Signed-off-by: Claudio Bley <cbley@av-test.de> --- src/libvirt.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
ACK.
Thanks, pushed. Claudio -- AV-Test GmbH, Henricistraße 20, 04155 Leipzig, Germany Phone: +49 341 265 310 19 Web:<http://www.av-test.org> Eingetragen am / Registered at: Amtsgericht Stendal (HRB 114076) Geschaeftsfuehrer (CEO): Andreas Marx, Guido Habicht, Maik Morgenstern

On 01/09/2014 12:07 AM, Claudio Bley wrote:
Signed-off-by: Claudio Bley <cbley@av-test.de> --- src/libvirt.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/src/libvirt.c b/src/libvirt.c index ffd4f8e..73972f2 100644 --- a/src/libvirt.c +++ b/src/libvirt.c @@ -14502,8 +14502,8 @@ virNodeDeviceGetName(virNodeDevicePtr dev) * * Accessor for the parent of the device * - * Returns the name of the device's parent, or NULL if the - * device has no parent. + * Returns the name of the device's parent, or NULL if an + * error occurred or when the device has no parent.
Hmm. When there is no parent, we actually DO raise an error, but it is currently VIR_ERR_INTERNAL_ERROR, and that's wrong. What we SHOULD do is raise a particular error that distinguishes this from other failures, the same as virDomainSnapshotGetParent raises VIR_ERR_NO_DOMAIN_SNAPSHOT for a missing parent, compared to other errors for failure to look up a snapshot or out of memory. Your doc patch is right, but we should do a followup to clean up the code. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
participants (3)
-
Claudio Bley
-
Eric Blake
-
Guido Günther