[libvirt] [PATCH] libvirt.c: fix virStateActive return value; document ...

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

 



The s/1/-1/ fix induces no semantic change, since the sole use
of virStateActive tests solely for nonzero.

>From 4bc9713207a2ed6b101e2067f7bba82d1df45987 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@xxxxxxxxxx>
Date: Mon, 24 Nov 2008 15:52:55 +0100
Subject: [PATCH] libvirt.c: fix virStateActive return value; document some new functions

* src/libvirt.c (virStateActive): Return -1 upon error, not 1,
to be consistent with the other virState* functions.
(virStateActive, virStateCleanup, virStateReload, virStateActive):
Add per-function comments.
---
 src/libvirt.c |   30 +++++++++++++++++++++++++++++-
 1 files changed, 29 insertions(+), 1 deletions(-)

diff --git a/src/libvirt.c b/src/libvirt.c
index f445333..10835b9 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -636,6 +636,13 @@ virRegisterStateDriver(virStateDriverPtr driver)
     return virStateDriverTabCount++;
 }

+/**
+ * virStateInitialize:
+ *
+ * Initialize all virtualization drivers.
+ *
+ * Return 0 if successful, -1 upon error.
+ */
 int virStateInitialize(void) {
     int i, ret = 0;

@@ -650,6 +657,13 @@ int virStateInitialize(void) {
     return ret;
 }

+/**
+ * virStateCleanup:
+ *
+ * Run each virtualization driver's cleanup method.
+ *
+ * Return 0 if successful, -1 upon error.
+ */
 int virStateCleanup(void) {
     int i, ret = 0;

@@ -661,6 +675,13 @@ int virStateCleanup(void) {
     return ret;
 }

+/**
+ * virStateReload
+ *
+ * Run each virtualization driver's reload method.
+ *
+ * Return 0 if successful, -1 upon error.
+ */
 int virStateReload(void) {
     int i, ret = 0;

@@ -672,13 +693,20 @@ int virStateReload(void) {
     return ret;
 }

+/**
+ * virStateActive
+ *
+ * Run each virtualization driver's "active" method.
+ *
+ * Return 0 if successful, -1 upon error.
+ */
 int virStateActive(void) {
     int i, ret = 0;

     for (i = 0 ; i < virStateDriverTabCount ; i++) {
         if (virStateDriverTab[i]->active &&
             virStateDriverTab[i]->active())
-            ret = 1;
+            ret = -1;
     }
     return ret;
 }
--
1.6.0.4.1021.g4320

--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]