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

[libvirt] [PATCH v2 10/12] storage: Internally represent @autostart to bool



Since it's been used that way anyway, let's just convert it to a bool
and only make the external representation be an int.

Signed-off-by: John Ferlan <jferlan redhat com>
---
 src/conf/virstorageobj.c     | 4 ++--
 src/conf/virstorageobj.h     | 4 ++--
 src/storage/storage_driver.c | 2 +-
 src/test/test_driver.c       | 4 ++--
 4 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/conf/virstorageobj.c b/src/conf/virstorageobj.c
index 8ee40e2..1364bdd 100644
--- a/src/conf/virstorageobj.c
+++ b/src/conf/virstorageobj.c
@@ -133,13 +133,13 @@ virStoragePoolObjIsAutostart(virStoragePoolObjPtr obj)
     if (!obj->configFile)
         return 0;
 
-    return obj->autostart == 1;
+    return obj->autostart;
 }
 
 
 void
 virStoragePoolObjSetAutostart(virStoragePoolObjPtr obj,
-                              int autostart)
+                              bool autostart)
 {
     obj->autostart = autostart;
 }
diff --git a/src/conf/virstorageobj.h b/src/conf/virstorageobj.h
index c2f3f23..b65b160 100644
--- a/src/conf/virstorageobj.h
+++ b/src/conf/virstorageobj.h
@@ -33,7 +33,7 @@ struct _virStoragePoolObj {
     char *configFile;
     char *autostartLink;
     bool active;
-    int autostart;
+    bool autostart;
     unsigned int asyncjobs;
 
     virStoragePoolDefPtr def;
@@ -108,7 +108,7 @@ virStoragePoolObjIsAutostart(virStoragePoolObjPtr obj);
 
 void
 virStoragePoolObjSetAutostart(virStoragePoolObjPtr obj,
-                              int autostart);
+                              bool autostart);
 
 unsigned int
 virStoragePoolObjGetAsyncjobs(virStoragePoolObjPtr obj);
diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c
index c9156e6..6fae6f4 100644
--- a/src/storage/storage_driver.c
+++ b/src/storage/storage_driver.c
@@ -1310,7 +1310,7 @@ storagePoolSetAutostart(virStoragePoolPtr pool,
                 goto cleanup;
             }
         }
-        virStoragePoolObjSetAutostart(obj, autostart);
+        virStoragePoolObjSetAutostart(obj, new_autostart);
     }
 
     ret = 0;
diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index b793187..69d61b5 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -4761,6 +4761,7 @@ testStoragePoolSetAutostart(virStoragePoolPtr pool,
 {
     testDriverPtr privconn = pool->conn->privateData;
     virStoragePoolObjPtr obj;
+    bool new_autostart = (autostart != 0);
     int ret = -1;
 
     if (!(obj = testStoragePoolObjFindByName(privconn, pool->name)))
@@ -4772,8 +4773,7 @@ testStoragePoolSetAutostart(virStoragePoolPtr pool,
         goto cleanup;
     }
 
-    autostart = (autostart != 0);
-    virStoragePoolObjSetAutostart(obj, autostart);
+    virStoragePoolObjSetAutostart(obj, new_autostart);
     ret = 0;
 
  cleanup:
-- 
2.9.5


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