[PATCH 3/6] unpriv_sgio: Prepare helpers for unpriv_sgio setting

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

 



"virGetDevice{Major,Minor}" could be used across the sources,
but it doesn't relate with this series, and could be done later.

* src/util/util.h: (Declare virGetDevice{Major,Minor}, and
                    vir{Get,Set}DeviceUnprivSGIO)
* src/util/util.c: (Implement virGetDevice{Major,Minor} and
                    vir{Get,Set}DeviceUnprivSGIO)
* src/libvirt_private.syms: Export private symbols of upper helpers
---
 src/libvirt_private.syms |    4 ++--
 src/util/util.c          |   13 +++++++------
 src/util/util.h          |    8 ++++----
 3 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 7abaf27..c756130 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -1259,7 +1259,7 @@ virFindFileInPath;
 virFormatIntDecimal;
 virGetDeviceMajor;
 virGetDeviceMinor;
-virGetDeviceSGIO;
+virGetDeviceUnprivSGIO;
 virGetGroupID;
 virGetGroupName;
 virGetHostname;
@@ -1278,7 +1278,7 @@ virPipeReadUntilEOF;
 virScaleInteger;
 virSetBlocking;
 virSetCloseExec;
-virSetDeviceSGIO;
+virSetDeviceUnprivSGIO;
 virSetInherit;
 virSetNonBlock;
 virSetUIDGID;
diff --git a/src/util/util.c b/src/util/util.c
index 746f3e9..49619d0 100644
--- a/src/util/util.c
+++ b/src/util/util.c
@@ -3157,8 +3157,8 @@ virGetDeviceMinor(const char *path)
 #endif
 
 int
-virSetDeviceSGIO(const char *path,
-                 int sgio)
+virSetDeviceUnprivSGIO(const char *path,
+                       int unpriv_sgio)
 {
     char *sysfs_path = NULL;
     char *val = NULL;
@@ -3193,7 +3193,7 @@ virSetDeviceSGIO(const char *path,
         goto cleanup;
     }
 
-    if (virAsprintf(&val, "%d", sgio) < 0) {
+    if (virAsprintf(&val, "%d", unpriv_sgio) < 0) {
         virReportOOMError();
         goto cleanup;
     }
@@ -3211,11 +3211,12 @@ cleanup:
 }
 
 int
-virGetDeviceSGIO(const char *path,
-                 int *sgio)
+virGetDeviceUnprivSGIO(const char *path,
+                       int *unpriv_sgio)
 {
     char *sysfs_path = NULL;
     char *buf = NULL;
+    char *tmp = NULL;
     int major;
     int minor;
     int ret = -1;
@@ -3254,7 +3255,7 @@ virGetDeviceSGIO(const char *path,
         *tmp = '\0';
 
     if ((rc = virStrToLong_i(buf, NULL, 10,
-                             sgio)) < 0) {
+                             unpriv_sgio)) < 0) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
                        _("failed to parse value of %s"), sysfs_path);
         goto cleanup;
diff --git a/src/util/util.h b/src/util/util.h
index 0bd9f79..41146c1 100644
--- a/src/util/util.h
+++ b/src/util/util.h
@@ -282,9 +282,9 @@ bool virValidateWWN(const char *wwn);
 
 int virGetDeviceMajor(const char *path);
 int virGetDeviceMinor(const char *path);
-int virSetDeviceSGIO(const char *path,
-                     int sgio);
-int virGetDeviceSGIO(const char *path,
-                     int *sgio);
+int virSetDeviceUnprivSGIO(const char *path,
+                           int unpriv_sgio);
+int virGetDeviceUnprivSGIO(const char *path,
+                           int *unpriv_sgio);
 
 #endif /* __VIR_UTIL_H__ */
-- 
1.7.7.6

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