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

[libvirt] [PATCH 15/25] utils: Rename scsi->path to scsi->sg_path



"sg_path" is more clear to indicate what it tries to store. And
later patch will use "path" to store the path like "/dev/sda".

And also rename "virSCSIDeviceGetDevStr" to "virSCSIDeviceGetSgName",
to reflect what the function does more clear.
---
 src/libvirt_private.syms |  2 +-
 src/qemu/qemu_command.c  |  2 +-
 src/util/virscsi.c       | 16 ++++++++--------
 src/util/virscsi.h       |  2 +-
 4 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 64e2816..fa59c14 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -1692,9 +1692,9 @@ virSCSIDeviceFileIterate;
 virSCSIDeviceFree;
 virSCSIDeviceGetAdapter;
 virSCSIDeviceGetBus;
-virSCSIDeviceGetDevStr;
 virSCSIDeviceGetName;
 virSCSIDeviceGetReadonly;
+virSCSIDeviceGetSgName;
 virSCSIDeviceGetTarget;
 virSCSIDeviceGetUnit;
 virSCSIDeviceGetUsedBy;
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 29dfd37..ab9f661 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -4690,7 +4690,7 @@ qemuBuildSCSIHostdevDrvStr(virDomainHostdevDefPtr dev,
     virBuffer buf = VIR_BUFFER_INITIALIZER;
     char *sg = NULL;
 
-    if (!(sg = virSCSIDeviceGetDevStr(dev->source.subsys.u.scsi.adapter,
+    if (!(sg = virSCSIDeviceGetSgName(dev->source.subsys.u.scsi.adapter,
                                       dev->source.subsys.u.scsi.bus,
                                       dev->source.subsys.u.scsi.target,
                                       dev->source.subsys.u.scsi.unit))) {
diff --git a/src/util/virscsi.c b/src/util/virscsi.c
index 2d6bd8c..7d3d40e 100644
--- a/src/util/virscsi.c
+++ b/src/util/virscsi.c
@@ -53,7 +53,7 @@ struct _virSCSIDevice {
 
     char *name; /* adapter:bus:target:unit */
     char *id;   /* model:vendor */
-    char *path;
+    char *sg_path; /* e.g. /dev/sg2 */
     const char *used_by; /* name of the domain using this dev */
 
     bool readonly;
@@ -100,7 +100,7 @@ virSCSIDeviceGetAdapterId(const char *adapter,
 }
 
 char *
-virSCSIDeviceGetDevStr(const char *adapter,
+virSCSIDeviceGetSgName(const char *adapter,
                        unsigned int bus,
                        unsigned int target,
                        unsigned int unit)
@@ -167,7 +167,7 @@ virSCSIDeviceNew(const char *adapter,
     dev->unit = unit;
     dev->readonly = readonly;
 
-    if (!(sg = virSCSIDeviceGetDevStr(adapter, bus, target, unit)))
+    if (!(sg = virSCSIDeviceGetSgName(adapter, bus, target, unit)))
         goto cleanup;
 
     if (virSCSIDeviceGetAdapterId(adapter, &dev->adapter) < 0)
@@ -175,15 +175,15 @@ virSCSIDeviceNew(const char *adapter,
 
     if (virAsprintf(&dev->name, "%d:%d:%d:%d", dev->adapter,
                     dev->bus, dev->bus, dev->unit) < 0 ||
-        virAsprintf(&dev->path, "/dev/%s", sg) < 0) {
+        virAsprintf(&dev->sg_path, "/dev/%s", sg) < 0) {
         virReportOOMError();
         goto cleanup;
     }
 
-    if (access(dev->path, F_OK) != 0) {
+    if (access(dev->sg_path, F_OK) != 0) {
         virReportSystemError(errno,
                              _("Device %s not found: could not access %s"),
-                             dev->name, dev->path);
+                             dev->name, dev->sg_path);
         goto cleanup;
     }
 
@@ -228,7 +228,7 @@ virSCSIDeviceFree(virSCSIDevicePtr dev)
 
     VIR_FREE(dev->id);
     VIR_FREE(dev->name);
-    VIR_FREE(dev->path);
+    VIR_FREE(dev->sg_path);
     VIR_FREE(dev);
 }
 
@@ -286,7 +286,7 @@ virSCSIDeviceFileIterate(virSCSIDevicePtr dev,
                          virSCSIDeviceFileActor actor,
                          void *opaque)
 {
-    return (actor)(dev, dev->path, opaque);
+    return (actor)(dev, dev->sg_path, opaque);
 }
 
 virSCSIDeviceListPtr
diff --git a/src/util/virscsi.h b/src/util/virscsi.h
index 9d63acc..8268cdf 100644
--- a/src/util/virscsi.h
+++ b/src/util/virscsi.h
@@ -33,7 +33,7 @@ typedef virSCSIDevice *virSCSIDevicePtr;
 typedef struct _virSCSIDeviceList virSCSIDeviceList;
 typedef virSCSIDeviceList *virSCSIDeviceListPtr;
 
-char *virSCSIDeviceGetDevStr(const char *adapter,
+char *virSCSIDeviceGetSgName(const char *adapter,
                              unsigned int bus,
                              unsigned int target,
                              unsigned int unit);
-- 
1.8.1.4


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