[PATCH v2 1/3] virsh-nodedev: makes struct and functions for NodeDevice list available

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

 



Next patch will use those function to collect NodeDevice list and find a
specific device.  Make functions virshNodeDeviceListCollect() and
virshNodeDeviceListFree() together with struct virshNodeDeviceList
available to reuse existing code.

Signed-off-by: Pavel Hrdina <phrdina@xxxxxxxxxx>
---
 tools/virsh-nodedev.c | 16 +++++-----------
 tools/virsh-nodedev.h | 11 +++++++++++
 2 files changed, 16 insertions(+), 11 deletions(-)

diff --git a/tools/virsh-nodedev.c b/tools/virsh-nodedev.c
index cc359e2..26f2c7b 100644
--- a/tools/virsh-nodedev.c
+++ b/tools/virsh-nodedev.c
@@ -194,13 +194,7 @@ virshNodeDeviceSorter(const void *a, const void *b)
                          virNodeDeviceGetName(*nb));
 }
 
-struct virshNodeDeviceList {
-    virNodeDevicePtr *devices;
-    size_t ndevices;
-};
-typedef struct virshNodeDeviceList *virshNodeDeviceListPtr;
-
-static void
+void
 virshNodeDeviceListFree(virshNodeDeviceListPtr list)
 {
     size_t i;
@@ -215,11 +209,11 @@ virshNodeDeviceListFree(virshNodeDeviceListPtr list)
     VIR_FREE(list);
 }
 
-static virshNodeDeviceListPtr
+virshNodeDeviceListPtr
 virshNodeDeviceListCollect(vshControl *ctl,
-                         char **capnames,
-                         int ncapnames,
-                         unsigned int flags)
+                           char **capnames,
+                           int ncapnames,
+                           unsigned int flags)
 {
     virshNodeDeviceListPtr list = vshMalloc(ctl, sizeof(*list));
     size_t i;
diff --git a/tools/virsh-nodedev.h b/tools/virsh-nodedev.h
index c64f7df..1d2337b 100644
--- a/tools/virsh-nodedev.h
+++ b/tools/virsh-nodedev.h
@@ -30,4 +30,15 @@
 
 extern const vshCmdDef nodedevCmds[];
 
+struct virshNodeDeviceList {
+    virNodeDevicePtr *devices;
+    size_t ndevices;
+};
+typedef struct virshNodeDeviceList *virshNodeDeviceListPtr;
+
+virshNodeDeviceListPtr virshNodeDeviceListCollect(vshControl *ctl,
+                                                  char **capnames,
+                                                  int ncapnames,
+                                                  unsigned int flags);
+void virshNodeDeviceListFree(virshNodeDeviceListPtr list);
 #endif /* VIRSH_NODEDEV_H */
-- 
2.6.2

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