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

[libvirt] [PATCH 7/8] cleanup: Change datatype of disk->readonly to boolean



---
 src/conf/domain_conf.c  |  4 ++--
 src/conf/domain_conf.h  |  2 +-
 src/qemu/qemu_command.c |  6 +++---
 src/vbox/vbox_tmpl.c    | 12 ++++++------
 src/xenxs/xen_sxpr.c    |  4 ++--
 src/xenxs/xen_xm.c      |  4 ++--
 6 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 753d248..afd4467 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -4730,7 +4730,7 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
                     goto error;
                 }
             } else if (xmlStrEqual(cur->name, BAD_CAST "readonly")) {
-                def->readonly = 1;
+                def->readonly = true;
             } else if (xmlStrEqual(cur->name, BAD_CAST "shareable")) {
                 def->shared = true;
             } else if (xmlStrEqual(cur->name, BAD_CAST "transient")) {
@@ -4858,7 +4858,7 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
 
     /* Force CDROM to be listed as read only */
     if (def->device == VIR_DOMAIN_DISK_DEVICE_CDROM)
-        def->readonly = 1;
+        def->readonly = true;
 
     if ((def->device == VIR_DOMAIN_DISK_DEVICE_DISK ||
          def->device == VIR_DOMAIN_DISK_DEVICE_LUN) &&
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index a951996..51e605a 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -682,7 +682,7 @@ struct _virDomainDiskDef {
     int copy_on_read;
     int snapshot; /* enum virDomainSnapshotLocation, snapshot_conf.h */
     int startupPolicy; /* enum virDomainStartupPolicy */
-    unsigned int readonly : 1;
+    bool readonly;
     bool shared;
     bool transient;
     virDomainDeviceInfo info;
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 3ba989d..d899239 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -8137,7 +8137,7 @@ qemuParseCommandLineDisk(virDomainXMLOptionPtr xmlopt,
         } else if (STREQ(keywords[i], "media")) {
             if (STREQ(values[i], "cdrom")) {
                 def->device = VIR_DOMAIN_DISK_DEVICE_CDROM;
-                def->readonly = 1;
+                def->readonly = true;
             } else if (STREQ(values[i], "floppy"))
                 def->device = VIR_DOMAIN_DISK_DEVICE_FLOPPY;
         } else if (STREQ(keywords[i], "format")) {
@@ -8196,7 +8196,7 @@ qemuParseCommandLineDisk(virDomainXMLOptionPtr xmlopt,
             }
         } else if (STREQ(keywords[i], "readonly")) {
             if ((values[i] == NULL) || STREQ(values[i], "on"))
-                def->readonly = 1;
+                def->readonly = true;
         } else if (STREQ(keywords[i], "aio")) {
             if ((def->iomode = virDomainDiskIoTypeFromString(values[i])) < 0) {
                 virReportError(VIR_ERR_INTERNAL_ERROR,
@@ -9303,7 +9303,7 @@ virDomainDefPtr qemuParseCommandLine(virCapsPtr qemuCaps,
                 disk->dst = strdup("hdc");
                 if (!disk->dst)
                     goto no_memory;
-                disk->readonly = 1;
+                disk->readonly = true;
             } else {
                 if (STRPREFIX(arg, "-fd")) {
                     disk->device = VIR_DOMAIN_DISK_DEVICE_FLOPPY;
diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c
index 0248ee0..ff8f9d1 100644
--- a/src/vbox/vbox_tmpl.c
+++ b/src/vbox/vbox_tmpl.c
@@ -2647,7 +2647,7 @@ static char *vboxDomainGetXMLDesc(virDomainPtr dom, unsigned int flags) {
                 hardDiskPM->vtbl->GetType(hardDiskPM, &hddType);
 
                 if (hddType == HardDiskType_Immutable)
-                    def->disks[hddNum]->readonly = 1;
+                    def->disks[hddNum]->readonly = true;
                 def->disks[hddNum]->src = strdup(hddlocation);
                 def->disks[hddNum]->dst = strdup("hda");
                 hddNum++;
@@ -2668,7 +2668,7 @@ static char *vboxDomainGetXMLDesc(virDomainPtr dom, unsigned int flags) {
                 hardDiskPS->vtbl->GetType(hardDiskPS, &hddType);
 
                 if (hddType == HardDiskType_Immutable)
-                    def->disks[hddNum]->readonly = 1;
+                    def->disks[hddNum]->readonly = true;
                 def->disks[hddNum]->src = strdup(hddlocation);
                 def->disks[hddNum]->dst = strdup("hdb");
                 hddNum++;
@@ -2689,7 +2689,7 @@ static char *vboxDomainGetXMLDesc(virDomainPtr dom, unsigned int flags) {
                 hardDiskSS->vtbl->GetType(hardDiskSS, &hddType);
 
                 if (hddType == HardDiskType_Immutable)
-                    def->disks[hddNum]->readonly = 1;
+                    def->disks[hddNum]->readonly = true;
                 def->disks[hddNum]->src = strdup(hddlocation);
                 def->disks[hddNum]->dst = strdup("hdd");
                 hddNum++;
@@ -2830,7 +2830,7 @@ static char *vboxDomainGetXMLDesc(virDomainPtr dom, unsigned int flags) {
 
                 medium->vtbl->GetReadOnly(medium, &readOnly);
                 if (readOnly == PR_TRUE)
-                    def->disks[diskCount]->readonly = 1;
+                    def->disks[diskCount]->readonly = true;
 
                 def->disks[diskCount]->type = VIR_DOMAIN_DISK_TYPE_FILE;
 
@@ -3118,7 +3118,7 @@ sharedFoldersCleanup:
                                 def->disks[def->ndisks - 1]->device = VIR_DOMAIN_DISK_DEVICE_CDROM;
                                 def->disks[def->ndisks - 1]->bus = VIR_DOMAIN_DISK_BUS_IDE;
                                 def->disks[def->ndisks - 1]->type = VIR_DOMAIN_DISK_TYPE_FILE;
-                                def->disks[def->ndisks - 1]->readonly = 1;
+                                def->disks[def->ndisks - 1]->readonly = true;
                                 def->disks[def->ndisks - 1]->src = strdup(location);
                                 def->disks[def->ndisks - 1]->dst = strdup("hdc");
                             } else {
@@ -3165,7 +3165,7 @@ sharedFoldersCleanup:
                                     def->disks[def->ndisks - 1]->device = VIR_DOMAIN_DISK_DEVICE_FLOPPY;
                                     def->disks[def->ndisks - 1]->bus = VIR_DOMAIN_DISK_BUS_FDC;
                                     def->disks[def->ndisks - 1]->type = VIR_DOMAIN_DISK_TYPE_FILE;
-                                    def->disks[def->ndisks - 1]->readonly = 0;
+                                    def->disks[def->ndisks - 1]->readonly = false;
                                     def->disks[def->ndisks - 1]->src = strdup(location);
                                     def->disks[def->ndisks - 1]->dst = strdup("fda");
                                 } else {
diff --git a/src/xenxs/xen_sxpr.c b/src/xenxs/xen_sxpr.c
index 4bd1f47..a179612 100644
--- a/src/xenxs/xen_sxpr.c
+++ b/src/xenxs/xen_sxpr.c
@@ -506,7 +506,7 @@ xenParseSxprDisks(virDomainDefPtr def,
 
             if (mode &&
                 strchr(mode, 'r'))
-                disk->readonly = 1;
+                disk->readonly = true;
             if (mode &&
                 strchr(mode, '!'))
                 disk->shared = true;
@@ -1371,7 +1371,7 @@ xenParseSxpr(const struct sexpr *root,
                 goto no_memory;
             }
             disk->bus = VIR_DOMAIN_DISK_BUS_IDE;
-            disk->readonly = 1;
+            disk->readonly = true;
 
             if (VIR_REALLOC_N(def->disks, def->ndisks+1) < 0) {
                 virDomainDiskDefFree(disk);
diff --git a/src/xenxs/xen_xm.c b/src/xenxs/xen_xm.c
index c68bee0..b2e7645 100644
--- a/src/xenxs/xen_xm.c
+++ b/src/xenxs/xen_xm.c
@@ -610,7 +610,7 @@ xenParseXM(virConfPtr conf, int xendConfigVersion,
 
             if (STREQ(head, "r") ||
                 STREQ(head, "ro"))
-                disk->readonly = 1;
+                disk->readonly = true;
             else if ((STREQ(head, "w!")) ||
                      (STREQ(head, "!")))
                 disk->shared = true;
@@ -643,7 +643,7 @@ xenParseXM(virConfPtr conf, int xendConfigVersion,
             if (!(disk->dst = strdup("hdc")))
                 goto no_memory;
             disk->bus = VIR_DOMAIN_DISK_BUS_IDE;
-            disk->readonly = 1;
+            disk->readonly = true;
 
             if (VIR_REALLOC_N(def->disks, def->ndisks+1) < 0)
                 goto no_memory;
-- 
1.8.1.4


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