[PATCH 2/6] conf: put hostdev subsys data into a struct for easier re-use

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

 



When <interface> is expanded to allow passthrough with extra
dev-dependent network interface info, the host-side address of the
device will need to be added to virDomainNetDef. It will be much
simpler if this is done with a common typedefed struct rather than
inlining the same struct stuff.
---
 src/conf/domain_conf.h |   34 +++++++++++++++++++++-------------
 1 files changed, 21 insertions(+), 13 deletions(-)

diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 3b522a9..dd2abf8 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -92,6 +92,26 @@ struct _virDomainDevicePCIAddress {
     int          multi;  /* enum virDomainDeviceAddressPciMulti */
 };
 
+typedef struct _virDomainDeviceSubsysUSBAddress virDomainDeviceSubsysUSBAddress;
+typedef virDomainDeviceSubsysUSBAddress *virDomainDeviceSubsysUSBAddressPtr;
+struct _virDomainDeviceSubsysUSBAddress {
+    unsigned bus;
+    unsigned device;
+
+    unsigned vendor;
+    unsigned product;
+};
+
+typedef struct _virDomainDeviceSubsysAddress virDomainDeviceSubsysAddress;
+typedef virDomainDeviceSubsysAddress *virDomainDeviceSubsysAddressPtr;
+struct _virDomainDeviceSubsysAddress {
+    int type; /* enum virDomainHostdevBusType */
+    union {
+        virDomainDeviceSubsysUSBAddress usb;
+        virDomainDevicePCIAddress pci; /* host address */
+    } u;
+};
+
 typedef struct _virDomainDeviceDriveAddress virDomainDeviceDriveAddress;
 typedef virDomainDeviceDriveAddress *virDomainDeviceDriveAddressPtr;
 struct _virDomainDeviceDriveAddress {
@@ -1088,19 +1108,7 @@ struct _virDomainHostdevDef {
     int mode; /* enum virDomainHostdevMode */
     unsigned int managed : 1;
     union {
-        struct {
-            int type; /* enum virDomainHostdevBusType */
-            union {
-                struct {
-                    unsigned bus;
-                    unsigned device;
-
-                    unsigned vendor;
-                    unsigned product;
-                } usb;
-                virDomainDevicePCIAddress pci; /* host address */
-            } u;
-        } subsys;
+        virDomainDeviceSubsysAddress subsys; /* USB or PCI */
         struct {
             /* TBD: struct capabilities see:
              * https://www.redhat.com/archives/libvir-list/2008-July/msg00429.html
-- 
1.7.7.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]