[libvirt] [PATCH 1/6] conf: move virDomainDeviceInfo definition from domain_conf.h to device_conf.h

Laine Stump laine at laine.org
Wed May 18 19:23:49 UTC 2016


Also moves all the subordinate structs. This is necessary due to a new
inline function that will be defined in device_conf.h, and also makes
sense, because it is the *device* info that's in the struct. (Actually
a lot more stuff from domain_conf.h could move to this newer file, but
I didn't want to disturb any more than necessary).
---
 src/conf/device_conf.h | 111 +++++++++++++++++++++++++++++++++++++++++-
 src/conf/domain_conf.h | 129 -------------------------------------------------
 2 files changed, 110 insertions(+), 130 deletions(-)

diff --git a/src/conf/device_conf.h b/src/conf/device_conf.h
index fc0f4ab..46c720d 100644
--- a/src/conf/device_conf.h
+++ b/src/conf/device_conf.h
@@ -1,7 +1,7 @@
 /*
  * device_conf.h: device XML handling entry points
  *
- * Copyright (C) 2006-2012, 2014-2015 Red Hat, Inc.
+ * Copyright (C) 2006-2012, 2014-2016 Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -72,6 +72,115 @@ typedef enum {
 
 VIR_ENUM_DECL(virNetDevFeature)
 
+typedef enum {
+    VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE,
+    VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI,
+    VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DRIVE,
+    VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_SERIAL,
+    VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCID,
+    VIR_DOMAIN_DEVICE_ADDRESS_TYPE_USB,
+    VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO,
+    VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390,
+    VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW,
+    VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_MMIO,
+    VIR_DOMAIN_DEVICE_ADDRESS_TYPE_ISA,
+    VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DIMM,
+
+    VIR_DOMAIN_DEVICE_ADDRESS_TYPE_LAST
+} virDomainDeviceAddressType;
+
+typedef struct _virDomainDeviceDriveAddress {
+    unsigned int controller;
+    unsigned int bus;
+    unsigned int target;
+    unsigned int unit;
+} virDomainDeviceDriveAddress, *virDomainDeviceDriveAddressPtr;
+
+typedef struct _virDomainDeviceVirtioSerialAddress {
+    unsigned int controller;
+    unsigned int bus;
+    unsigned int port;
+} virDomainDeviceVirtioSerialAddress, *virDomainDeviceVirtioSerialAddressPtr;
+
+# define VIR_DOMAIN_DEVICE_CCW_MAX_CSSID    254
+# define VIR_DOMAIN_DEVICE_CCW_MAX_SSID       3
+# define VIR_DOMAIN_DEVICE_CCW_MAX_DEVNO  65535
+
+typedef struct _virDomainDeviceCCWAddress {
+    unsigned int cssid;
+    unsigned int ssid;
+    unsigned int devno;
+    bool         assigned;
+} virDomainDeviceCCWAddress, *virDomainDeviceCCWAddressPtr;
+
+typedef struct _virDomainDeviceCcidAddress {
+    unsigned int controller;
+    unsigned int slot;
+} virDomainDeviceCcidAddress, *virDomainDeviceCcidAddressPtr;
+
+typedef struct _virDomainDeviceUSBAddress {
+    unsigned int bus;
+    char *port;
+} virDomainDeviceUSBAddress, *virDomainDeviceUSBAddressPtr;
+
+typedef struct _virDomainDeviceSpaprVioAddress {
+    unsigned long long reg;
+    bool has_reg;
+} virDomainDeviceSpaprVioAddress, *virDomainDeviceSpaprVioAddressPtr;
+
+typedef enum {
+    VIR_DOMAIN_CONTROLLER_MASTER_NONE,
+    VIR_DOMAIN_CONTROLLER_MASTER_USB,
+
+    VIR_DOMAIN_CONTROLLER_MASTER_LAST
+} virDomainControllerMaster;
+
+typedef struct _virDomainDeviceUSBMaster {
+    unsigned int startport;
+} virDomainDeviceUSBMaster, *virDomainDeviceUSBMasterPtr;
+
+typedef struct _virDomainDeviceISAAddress {
+    unsigned int iobase;
+    unsigned int irq;
+} virDomainDeviceISAAddress, *virDomainDeviceISAAddressPtr;
+
+typedef struct _virDomainDeviceDimmAddress {
+    unsigned int slot;
+    unsigned long long base;
+} virDomainDeviceDimmAddress, *virDomainDeviceDimmAddressPtr;
+
+typedef struct _virDomainDeviceInfo {
+    /* If adding to this struct, ensure that
+     * virDomainDeviceInfoIsSet() is updated
+     * to consider the new fields
+     */
+    char *alias;
+    int type; /* virDomainDeviceAddressType */
+    union {
+        virPCIDeviceAddress pci;
+        virDomainDeviceDriveAddress drive;
+        virDomainDeviceVirtioSerialAddress vioserial;
+        virDomainDeviceCcidAddress ccid;
+        virDomainDeviceUSBAddress usb;
+        virDomainDeviceSpaprVioAddress spaprvio;
+        virDomainDeviceCCWAddress ccw;
+        virDomainDeviceISAAddress isa;
+        virDomainDeviceDimmAddress dimm;
+    } addr;
+    int mastertype;
+    union {
+        virDomainDeviceUSBMaster usb;
+    } master;
+    /* rombar and romfile are only used for pci hostdev and network
+     * devices. */
+    int rombar;         /* enum virTristateSwitch */
+    char *romfile;
+    /* bootIndex is only used for disk, network interface, hostdev
+     * and redirdev devices */
+    unsigned int bootIndex;
+} virDomainDeviceInfo, *virDomainDeviceInfoPtr;
+
+
 int virPCIDeviceAddressIsValid(virPCIDeviceAddressPtr addr,
                                bool report);
 
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 4e21826..82e581b 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -243,135 +243,6 @@ typedef enum {
 VIR_ENUM_DECL(virDomainOS)
 
 
-typedef enum {
-    VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE,
-    VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI,
-    VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DRIVE,
-    VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_SERIAL,
-    VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCID,
-    VIR_DOMAIN_DEVICE_ADDRESS_TYPE_USB,
-    VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO,
-    VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390,
-    VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW,
-    VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_MMIO,
-    VIR_DOMAIN_DEVICE_ADDRESS_TYPE_ISA,
-    VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DIMM,
-
-    VIR_DOMAIN_DEVICE_ADDRESS_TYPE_LAST
-} virDomainDeviceAddressType;
-
-typedef struct _virDomainDeviceDriveAddress virDomainDeviceDriveAddress;
-typedef virDomainDeviceDriveAddress *virDomainDeviceDriveAddressPtr;
-struct _virDomainDeviceDriveAddress {
-    unsigned int controller;
-    unsigned int bus;
-    unsigned int target;
-    unsigned int unit;
-};
-
-typedef struct _virDomainDeviceVirtioSerialAddress virDomainDeviceVirtioSerialAddress;
-typedef virDomainDeviceVirtioSerialAddress *virDomainDeviceVirtioSerialAddressPtr;
-struct _virDomainDeviceVirtioSerialAddress {
-    unsigned int controller;
-    unsigned int bus;
-    unsigned int port;
-};
-
-# define VIR_DOMAIN_DEVICE_CCW_MAX_CSSID    254
-# define VIR_DOMAIN_DEVICE_CCW_MAX_SSID       3
-# define VIR_DOMAIN_DEVICE_CCW_MAX_DEVNO  65535
-
-typedef struct _virDomainDeviceCCWAddress virDomainDeviceCCWAddress;
-typedef virDomainDeviceCCWAddress *virDomainDeviceCCWAddressPtr;
-struct _virDomainDeviceCCWAddress {
-    unsigned int cssid;
-    unsigned int ssid;
-    unsigned int devno;
-    bool         assigned;
-};
-
-typedef struct _virDomainDeviceCcidAddress virDomainDeviceCcidAddress;
-typedef virDomainDeviceCcidAddress *virDomainDeviceCcidAddressPtr;
-struct _virDomainDeviceCcidAddress {
-    unsigned int controller;
-    unsigned int slot;
-};
-
-typedef struct _virDomainDeviceUSBAddress virDomainDeviceUSBAddress;
-typedef virDomainDeviceUSBAddress *virDomainDeviceUSBAddressPtr;
-struct _virDomainDeviceUSBAddress {
-    unsigned int bus;
-    char *port;
-};
-
-typedef struct _virDomainDeviceSpaprVioAddress virDomainDeviceSpaprVioAddress;
-typedef virDomainDeviceSpaprVioAddress *virDomainDeviceSpaprVioAddressPtr;
-struct _virDomainDeviceSpaprVioAddress {
-    unsigned long long reg;
-    bool has_reg;
-};
-
-typedef enum {
-    VIR_DOMAIN_CONTROLLER_MASTER_NONE,
-    VIR_DOMAIN_CONTROLLER_MASTER_USB,
-
-    VIR_DOMAIN_CONTROLLER_MASTER_LAST
-} virDomainControllerMaster;
-
-typedef struct _virDomainDeviceUSBMaster virDomainDeviceUSBMaster;
-typedef virDomainDeviceUSBMaster *virDomainDeviceUSBMasterPtr;
-struct _virDomainDeviceUSBMaster {
-    unsigned int startport;
-};
-
-typedef struct _virDomainDeviceISAAddress virDomainDeviceISAAddress;
-typedef virDomainDeviceISAAddress *virDomainDeviceISAAddressPtr;
-struct _virDomainDeviceISAAddress {
-    unsigned int iobase;
-    unsigned int irq;
-};
-
-typedef struct _virDomainDeviceDimmAddress virDomainDeviceDimmAddress;
-typedef virDomainDeviceDimmAddress *virDomainDeviceDimmAddressPtr;
-struct _virDomainDeviceDimmAddress {
-    unsigned int slot;
-    unsigned long long base;
-};
-
-typedef struct _virDomainDeviceInfo virDomainDeviceInfo;
-typedef virDomainDeviceInfo *virDomainDeviceInfoPtr;
-struct _virDomainDeviceInfo {
-    /* If adding to this struct, ensure that
-     * virDomainDeviceInfoIsSet() is updated
-     * to consider the new fields
-     */
-    char *alias;
-    int type; /* virDomainDeviceAddressType */
-    union {
-        virPCIDeviceAddress pci;
-        virDomainDeviceDriveAddress drive;
-        virDomainDeviceVirtioSerialAddress vioserial;
-        virDomainDeviceCcidAddress ccid;
-        virDomainDeviceUSBAddress usb;
-        virDomainDeviceSpaprVioAddress spaprvio;
-        virDomainDeviceCCWAddress ccw;
-        virDomainDeviceISAAddress isa;
-        virDomainDeviceDimmAddress dimm;
-    } addr;
-    int mastertype;
-    union {
-        virDomainDeviceUSBMaster usb;
-    } master;
-    /* rombar and romfile are only used for pci hostdev and network
-     * devices. */
-    int rombar;         /* enum virTristateSwitch */
-    char *romfile;
-    /* bootIndex is only used for disk, network interface, hostdev
-     * and redirdev devices */
-    unsigned int bootIndex;
-};
-
-
 typedef struct _virDomainHostdevOrigStates virDomainHostdevOrigStates;
 typedef virDomainHostdevOrigStates *virDomainHostdevOrigStatesPtr;
 struct _virDomainHostdevOrigStates {
-- 
2.5.5




More information about the libvir-list mailing list