]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
conf: Use virTristateXXX in virStoragePoolSourceDevice
authorTim Wiederhake <twiederh@redhat.com>
Wed, 7 Apr 2021 11:48:40 +0000 (13:48 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Fri, 16 Apr 2021 07:48:42 +0000 (09:48 +0200)
Note that the comment for virStoragePoolSourceDevice::part_separator was wrong.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
src/conf/storage_conf.c
src/conf/storage_conf.h

index eee5b36f837c89321a272fc98fff986d34219601..66419616da81928398b4b412768774d4da4617ca 100644 (file)
@@ -614,14 +614,15 @@ virStoragePoolDefParseSource(xmlXPathContextPtr ctxt,
 
         partsep = virXMLPropString(nodeset[i], "part_separator");
         if (partsep) {
-            dev.part_separator = virTristateBoolTypeFromString(partsep);
-            if (dev.part_separator <= 0) {
+            int value = virTristateBoolTypeFromString(partsep);
+            if (value <= 0) {
                 virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                                _("invalid part_separator setting '%s'"),
                                partsep);
                 virStoragePoolSourceDeviceClear(&dev);
                 goto cleanup;
             }
+            dev.part_separator = value;
         }
 
         if (VIR_APPEND_ELEMENT(source->devices, source->ndevice, dev) < 0) {
@@ -1094,7 +1095,7 @@ virStoragePoolSourceFormat(virBuffer *buf,
             virBufferEscapeString(buf, "<device path='%s'",
                                   src->devices[i].path);
             if (src->devices[i].part_separator !=
-                VIR_TRISTATE_SWITCH_ABSENT) {
+                VIR_TRISTATE_BOOL_ABSENT) {
                 virBufferAsprintf(buf, " part_separator='%s'",
                                   virTristateBoolTypeToString(src->devices[i].part_separator));
             }
index f083b41693a1e3d03ba8e4e430535f34e57e0cc1..345026aa378405ba252ad8b91e4f3412a1b55102 100644 (file)
@@ -161,7 +161,7 @@ struct _virStoragePoolSourceDevice {
     virStoragePoolSourceDeviceExtent *freeExtents;
     char *path;
     int format; /* Pool specific source format */
-    int part_separator;  /* enum virTristateSwitch */
+    virTristateBool part_separator;
 
     /* When the source device is a physical disk,
      * the geometry data is needed