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

[libvirt] [PATCH 1/3] Rename virSecurityManagerSetFDLabel method



The virSecurityManagerSetFDLabel method is used to label
file descriptors associated with disk images. There will
shortly be a need to label other file descriptors in a
different way. So the current name is ambiguous. Rename
the method to virSecurityManagerSetImageFDLabel to clarify
its purpose

* src/libvirt_private.syms,
  src/qemu/qemu_migration.c, src/qemu/qemu_process.c,
  src/security/security_apparmor.c, src/security/security_dac.c,
  src/security/security_driver.h, src/security/security_manager.c,
  src/security/security_manager.h, src/security/security_selinux.c,
  src/security/security_stack.c: s/FDLabel/ImageFDLabel/
---
 src/libvirt_private.syms         |    2 +-
 src/qemu/qemu_migration.c        |    4 ++--
 src/qemu/qemu_process.c          |    2 +-
 src/security/security_apparmor.c |    8 ++++----
 src/security/security_dac.c      |    8 ++++----
 src/security/security_driver.h   |    8 ++++----
 src/security/security_manager.c  |   10 +++++-----
 src/security/security_manager.h  |    6 +++---
 src/security/security_selinux.c  |    8 ++++----
 src/security/security_stack.c    |   12 ++++++------
 10 files changed, 34 insertions(+), 34 deletions(-)

diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index d9d3913..90725cd 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -849,7 +849,7 @@ virSecurityManagerRestoreAllLabel;
 virSecurityManagerRestoreHostdevLabel;
 virSecurityManagerRestoreSavedStateLabel;
 virSecurityManagerSetAllLabel;
-virSecurityManagerSetFDLabel;
+virSecurityManagerSetImageFDLabel;
 virSecurityManagerSetImageLabel;
 virSecurityManagerSetHostdevLabel;
 virSecurityManagerSetProcessLabel;
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index ca4a884..800b714 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -2688,8 +2688,8 @@ qemuMigrationToFile(struct qemud_driver *driver, virDomainObjPtr vm,
          * doesn't have to open() the file, so while we still have to
          * grant SELinux access, we can do it on fd and avoid cleanup
          * later, as well as skip futzing with cgroup.  */
-        if (virSecurityManagerSetFDLabel(driver->securityManager, vm,
-                                         compressor ? pipeFD[1] : fd) < 0)
+        if (virSecurityManagerSetImageFDLabel(driver->securityManager, vm,
+                                              compressor ? pipeFD[1] : fd) < 0)
             goto cleanup;
         bypassSecurityDriver = true;
     } else {
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 7e2806b..e00d5a8 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -2727,7 +2727,7 @@ int qemuProcessStart(virConnectPtr conn,
             goto cleanup;
         }
         if (S_ISFIFO(stdin_sb.st_mode) &&
-            virSecurityManagerSetFDLabel(driver->securityManager, vm, stdin_fd) < 0)
+            virSecurityManagerSetImageFDLabel(driver->securityManager, vm, stdin_fd) < 0)
             goto cleanup;
     }
 
diff --git a/src/security/security_apparmor.c b/src/security/security_apparmor.c
index 4d77643..50a7383 100644
--- a/src/security/security_apparmor.c
+++ b/src/security/security_apparmor.c
@@ -757,9 +757,9 @@ AppArmorRestoreSavedStateLabel(virSecurityManagerPtr mgr,
 }
 
 static int
-AppArmorSetFDLabel(virSecurityManagerPtr mgr,
-                   virDomainObjPtr vm,
-                   int fd)
+AppArmorSetImageFDLabel(virSecurityManagerPtr mgr,
+                        virDomainObjPtr vm,
+                        int fd)
 {
     int rc = -1;
     char *proc = NULL;
@@ -818,5 +818,5 @@ virSecurityDriver virAppArmorSecurityDriver = {
     AppArmorSetSavedStateLabel,
     AppArmorRestoreSavedStateLabel,
 
-    AppArmorSetFDLabel,
+    AppArmorSetImageFDLabel,
 };
diff --git a/src/security/security_dac.c b/src/security/security_dac.c
index 24b50e6..49bba5c 100644
--- a/src/security/security_dac.c
+++ b/src/security/security_dac.c
@@ -682,9 +682,9 @@ virSecurityDACClearSocketLabel(virSecurityManagerPtr mgr ATTRIBUTE_UNUSED,
 }
 
 static int
-virSecurityDACSetFDLabel(virSecurityManagerPtr mgr ATTRIBUTE_UNUSED,
-                         virDomainObjPtr vm ATTRIBUTE_UNUSED,
-                         int fd ATTRIBUTE_UNUSED)
+virSecurityDACSetImageFDLabel(virSecurityManagerPtr mgr ATTRIBUTE_UNUSED,
+                              virDomainObjPtr vm ATTRIBUTE_UNUSED,
+                              int fd ATTRIBUTE_UNUSED)
 {
     return 0;
 }
@@ -725,5 +725,5 @@ virSecurityDriver virSecurityDriverDAC = {
     virSecurityDACSetSavedStateLabel,
     virSecurityDACRestoreSavedStateLabel,
 
-    virSecurityDACSetFDLabel,
+    virSecurityDACSetImageFDLabel,
 };
diff --git a/src/security/security_driver.h b/src/security/security_driver.h
index 42dfcb8..6c6db3e 100644
--- a/src/security/security_driver.h
+++ b/src/security/security_driver.h
@@ -79,9 +79,9 @@ typedef int (*virSecurityDomainSetProcessLabel) (virSecurityManagerPtr mgr,
                                                  virDomainObjPtr vm);
 typedef int (*virSecurityDomainSecurityVerify) (virSecurityManagerPtr mgr,
                                                 virDomainDefPtr def);
-typedef int (*virSecurityDomainSetFDLabel) (virSecurityManagerPtr mgr,
-                                            virDomainObjPtr vm,
-                                            int fd);
+typedef int (*virSecurityDomainSetImageFDLabel) (virSecurityManagerPtr mgr,
+                                                 virDomainObjPtr vm,
+                                                 int fd);
 
 struct _virSecurityDriver {
     size_t privateDataLen;
@@ -117,7 +117,7 @@ struct _virSecurityDriver {
     virSecurityDomainSetSavedStateLabel domainSetSavedStateLabel;
     virSecurityDomainRestoreSavedStateLabel domainRestoreSavedStateLabel;
 
-    virSecurityDomainSetFDLabel domainSetSecurityFDLabel;
+    virSecurityDomainSetImageFDLabel domainSetSecurityImageFDLabel;
 };
 
 virSecurityDriverPtr virSecurityDriverLookup(const char *name);
diff --git a/src/security/security_manager.c b/src/security/security_manager.c
index 6f0becd..04159f4 100644
--- a/src/security/security_manager.c
+++ b/src/security/security_manager.c
@@ -326,12 +326,12 @@ int virSecurityManagerVerify(virSecurityManagerPtr mgr,
     return -1;
 }
 
-int virSecurityManagerSetFDLabel(virSecurityManagerPtr mgr,
-                                 virDomainObjPtr vm,
-                                 int fd)
+int virSecurityManagerSetImageFDLabel(virSecurityManagerPtr mgr,
+                                      virDomainObjPtr vm,
+                                      int fd)
 {
-    if (mgr->drv->domainSetSecurityFDLabel)
-        return mgr->drv->domainSetSecurityFDLabel(mgr, vm, fd);
+    if (mgr->drv->domainSetSecurityImageFDLabel)
+        return mgr->drv->domainSetSecurityImageFDLabel(mgr, vm, fd);
 
     virSecurityReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
     return -1;
diff --git a/src/security/security_manager.h b/src/security/security_manager.h
index 8d7c220..581957c 100644
--- a/src/security/security_manager.h
+++ b/src/security/security_manager.h
@@ -91,8 +91,8 @@ int virSecurityManagerSetProcessLabel(virSecurityManagerPtr mgr,
                                       virDomainObjPtr vm);
 int virSecurityManagerVerify(virSecurityManagerPtr mgr,
                              virDomainDefPtr def);
-int virSecurityManagerSetFDLabel(virSecurityManagerPtr mgr,
-                                 virDomainObjPtr vm,
-                                 int fd);
+int virSecurityManagerSetImageFDLabel(virSecurityManagerPtr mgr,
+                                      virDomainObjPtr vm,
+                                      int fd);
 
 #endif /* VIR_SECURITY_MANAGER_H__ */
diff --git a/src/security/security_selinux.c b/src/security/security_selinux.c
index 0ce999f..dc92ce6 100644
--- a/src/security/security_selinux.c
+++ b/src/security/security_selinux.c
@@ -1209,9 +1209,9 @@ SELinuxSetSecurityAllLabel(virSecurityManagerPtr mgr,
 }
 
 static int
-SELinuxSetFDLabel(virSecurityManagerPtr mgr ATTRIBUTE_UNUSED,
-                  virDomainObjPtr vm,
-                  int fd)
+SELinuxSetImageFDLabel(virSecurityManagerPtr mgr ATTRIBUTE_UNUSED,
+                       virDomainObjPtr vm,
+                       int fd)
 {
     const virSecurityLabelDefPtr secdef = &vm->def->seclabel;
 
@@ -1255,5 +1255,5 @@ virSecurityDriver virSecurityDriverSELinux = {
     SELinuxSetSavedStateLabel,
     SELinuxRestoreSavedStateLabel,
 
-    SELinuxSetFDLabel,
+    SELinuxSetImageFDLabel,
 };
diff --git a/src/security/security_stack.c b/src/security/security_stack.c
index 64f745a..bec1626 100644
--- a/src/security/security_stack.c
+++ b/src/security/security_stack.c
@@ -370,16 +370,16 @@ virSecurityStackClearSocketLabel(virSecurityManagerPtr mgr,
 }
 
 static int
-virSecurityStackSetFDLabel(virSecurityManagerPtr mgr,
-                           virDomainObjPtr vm,
-                           int fd)
+virSecurityStackSetImageFDLabel(virSecurityManagerPtr mgr,
+                                virDomainObjPtr vm,
+                                int fd)
 {
     virSecurityStackDataPtr priv = virSecurityManagerGetPrivateData(mgr);
     int rc = 0;
 
-    if (virSecurityManagerSetFDLabel(priv->secondary, vm, fd) < 0)
+    if (virSecurityManagerSetImageFDLabel(priv->secondary, vm, fd) < 0)
         rc = -1;
-    if (virSecurityManagerSetFDLabel(priv->primary, vm, fd) < 0)
+    if (virSecurityManagerSetImageFDLabel(priv->primary, vm, fd) < 0)
         rc = -1;
 
     return rc;
@@ -420,5 +420,5 @@ virSecurityDriver virSecurityDriverStack = {
     virSecurityStackSetSavedStateLabel,
     virSecurityStackRestoreSavedStateLabel,
 
-    virSecurityStackSetFDLabel,
+    virSecurityStackSetImageFDLabel,
 };
-- 
1.7.4.4


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