[PATCH v2 2/4] virSecurityDeviceLabelDef: substitute 'norelabel' with 'relabel'

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

 



Similarly to the previous commit, boolean variables should not start
with 'no-' prefix.

Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
 src/conf/domain_conf.c          | 12 ++++++------
 src/security/security_dac.c     |  8 ++++----
 src/security/security_selinux.c | 10 +++++-----
 src/util/virseclabel.c          |  2 +-
 src/util/virseclabel.h          |  2 +-
 5 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 8384b5d..eccecd4 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -4803,9 +4803,9 @@ virSecurityDeviceLabelDefParseXML(virSecurityDeviceLabelDefPtr **seclabels_rtn,
         relabel = virXMLPropString(list[i], "relabel");
         if (relabel != NULL) {
             if (STREQ(relabel, "yes")) {
-                seclabels[i]->norelabel = false;
+                seclabels[i]->relabel = true;
             } else if (STREQ(relabel, "no")) {
-                seclabels[i]->norelabel = true;
+                seclabels[i]->relabel = false;
             } else {
                 virReportError(VIR_ERR_XML_ERROR,
                                _("invalid security relabel value %s"),
@@ -4815,7 +4815,7 @@ virSecurityDeviceLabelDefParseXML(virSecurityDeviceLabelDefPtr **seclabels_rtn,
             }
             VIR_FREE(relabel);
         } else {
-            seclabels[i]->norelabel = false;
+            seclabels[i]->relabel = true;
         }
 
         /* labelskip is only parsed on live images */
@@ -4830,7 +4830,7 @@ virSecurityDeviceLabelDefParseXML(virSecurityDeviceLabelDefPtr **seclabels_rtn,
                                     VIR_SECURITY_LABEL_BUFLEN-1, ctxt);
         seclabels[i]->label = label;
 
-        if (label && seclabels[i]->norelabel) {
+        if (label && !seclabels[i]->relabel) {
             virReportError(VIR_ERR_XML_ERROR,
                            _("Cannot specify a label if relabelling is "
                              "turned off. model=%s"),
@@ -14736,7 +14736,7 @@ virSecurityDeviceLabelDefFormat(virBufferPtr buf,
 {
     /* For offline output, skip elements that allow labels but have no
      * label specified (possible if labelskip was ignored on input).  */
-    if ((flags & VIR_DOMAIN_XML_INACTIVE) && !def->label && !def->norelabel)
+    if ((flags & VIR_DOMAIN_XML_INACTIVE) && !def->label && def->relabel)
         return;
 
     virBufferAddLit(buf, "<seclabel");
@@ -14747,7 +14747,7 @@ virSecurityDeviceLabelDefFormat(virBufferPtr buf,
     if (def->labelskip)
         virBufferAddLit(buf, " labelskip='yes'");
     else
-        virBufferAsprintf(buf, " relabel='%s'", def->norelabel ? "no" : "yes");
+        virBufferAsprintf(buf, " relabel='%s'", def->relabel ? "yes" : "no");
 
     if (def->label) {
         virBufferAddLit(buf, ">\n");
diff --git a/src/security/security_dac.c b/src/security/security_dac.c
index 665cbc9..4d2a9d6 100644
--- a/src/security/security_dac.c
+++ b/src/security/security_dac.c
@@ -312,7 +312,7 @@ virSecurityDACSetSecurityImageLabel(virSecurityManagerPtr mgr,
 
     disk_seclabel = virStorageSourceGetSecurityLabelDef(src,
                                                         SECURITY_DAC_NAME);
-    if (disk_seclabel && disk_seclabel->norelabel)
+    if (disk_seclabel && !disk_seclabel->relabel)
         return 0;
 
     if (disk_seclabel && disk_seclabel->label) {
@@ -374,7 +374,7 @@ virSecurityDACRestoreSecurityImageLabelInt(virSecurityManagerPtr mgr,
 
     disk_seclabel = virStorageSourceGetSecurityLabelDef(src,
                                                         SECURITY_DAC_NAME);
-    if (disk_seclabel && disk_seclabel->norelabel)
+    if (disk_seclabel && !disk_seclabel->relabel)
         return 0;
 
     /* If we have a shared FS and are doing migration, we must not change
@@ -703,7 +703,7 @@ virSecurityDACSetChardevLabel(virSecurityManagerPtr mgr,
         chr_seclabel = virDomainChrDefGetSecurityLabelDef(dev,
                                                           SECURITY_DAC_NAME);
 
-    if (chr_seclabel && chr_seclabel->norelabel)
+    if (chr_seclabel && !chr_seclabel->relabel)
         return 0;
 
     if (chr_seclabel && chr_seclabel->label) {
@@ -772,7 +772,7 @@ virSecurityDACRestoreChardevLabel(virSecurityManagerPtr mgr ATTRIBUTE_UNUSED,
         chr_seclabel = virDomainChrDefGetSecurityLabelDef(dev,
                                                           SECURITY_DAC_NAME);
 
-    if (chr_seclabel && chr_seclabel->norelabel)
+    if (chr_seclabel && !chr_seclabel->relabel)
         return 0;
 
     switch ((virDomainChrType) dev_source->type) {
diff --git a/src/security/security_selinux.c b/src/security/security_selinux.c
index 8d4a9aa..a0e89b7 100644
--- a/src/security/security_selinux.c
+++ b/src/security/security_selinux.c
@@ -1130,7 +1130,7 @@ virSecuritySELinuxRestoreSecurityImageLabelInt(virSecurityManagerPtr mgr,
 
     disk_seclabel = virStorageSourceGetSecurityLabelDef(src,
                                                         SECURITY_SELINUX_NAME);
-    if (!seclabel->relabel || (disk_seclabel && disk_seclabel->norelabel))
+    if (!seclabel->relabel || (disk_seclabel && !disk_seclabel->relabel))
         return 0;
 
     /* If labelskip is true and there are no backing files, then we
@@ -1208,10 +1208,10 @@ virSecuritySELinuxSetSecurityImageLabelInternal(virSecurityManagerPtr mgr,
     disk_seclabel = virStorageSourceGetSecurityLabelDef(src,
                                                         SECURITY_SELINUX_NAME);
 
-    if (disk_seclabel && disk_seclabel->norelabel)
+    if (disk_seclabel && !disk_seclabel->relabel)
         return 0;
 
-    if (disk_seclabel && !disk_seclabel->norelabel && disk_seclabel->label) {
+    if (disk_seclabel && disk_seclabel->relabel && disk_seclabel->label) {
         ret = virSecuritySELinuxSetFilecon(src->path, disk_seclabel->label);
     } else if (first) {
         if (src->shared) {
@@ -1677,7 +1677,7 @@ virSecuritySELinuxSetSecurityChardevLabel(virDomainDefPtr def,
         chr_seclabel = virDomainChrDefGetSecurityLabelDef(dev,
                                                           SECURITY_SELINUX_NAME);
 
-    if (chr_seclabel && chr_seclabel->norelabel)
+    if (chr_seclabel && !chr_seclabel->relabel)
         return 0;
 
     if (chr_seclabel)
@@ -1747,7 +1747,7 @@ virSecuritySELinuxRestoreSecurityChardevLabel(virSecurityManagerPtr mgr,
     if (dev)
         chr_seclabel = virDomainChrDefGetSecurityLabelDef(dev,
                                                           SECURITY_SELINUX_NAME);
-    if (chr_seclabel && chr_seclabel->norelabel)
+    if (chr_seclabel && !chr_seclabel->relabel)
         return 0;
 
     switch (dev_source->type) {
diff --git a/src/util/virseclabel.c b/src/util/virseclabel.c
index 8f07de3..88c1fc3 100644
--- a/src/util/virseclabel.c
+++ b/src/util/virseclabel.c
@@ -90,7 +90,7 @@ virSecurityDeviceLabelDefCopy(const virSecurityDeviceLabelDef *src)
     if (VIR_ALLOC(ret) < 0)
         return NULL;
 
-    ret->norelabel = src->norelabel;
+    ret->relabel = src->relabel;
     ret->labelskip = src->labelskip;
 
     if (VIR_STRDUP(ret->model, src->model) < 0 ||
diff --git a/src/util/virseclabel.h b/src/util/virseclabel.h
index 8d671fd..7eebd60 100644
--- a/src/util/virseclabel.h
+++ b/src/util/virseclabel.h
@@ -51,7 +51,7 @@ typedef virSecurityDeviceLabelDef *virSecurityDeviceLabelDefPtr;
 struct _virSecurityDeviceLabelDef {
     char *model;
     char *label;        /* image label string */
-    bool norelabel;     /* true to skip label attempts */
+    bool relabel;       /* should try labeling attempts? */
     bool labelskip;     /* live-only; true if skipping failed label attempt */
 };
 
-- 
1.8.5.5

--
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]