conf: add missing device types to virDomainDevice(Type|Def)

Not all device types were represented in virDomainDeviceType, so some
types of devices couldn't be represented in a virDomainDeviceDef
(which requires a different type of pointer in the union for each
different kind of device).

Since serial, parallel, channel, and console devices are all
virDomainChrDef, and the virDomainDeviceType is never used to produce
a string from the type (and only used in the other direction
internally to code, never to produce XML), I only added one "CHR"
type, which is associated with "virDomainChrDefPtr chr" in the union.
This commit is contained in:
Laine Stump 2012-02-22 15:54:35 -05:00
parent 118cfc2535
commit 9890b318c8
2 changed files with 14 additions and 3 deletions

View File

@ -123,6 +123,7 @@ VIR_ENUM_IMPL(virDomainLifecycleCrash, VIR_DOMAIN_LIFECYCLE_CRASH_LAST,
"coredump-restart")
VIR_ENUM_IMPL(virDomainDevice, VIR_DOMAIN_DEVICE_LAST,
"none",
"disk",
"lease",
"filesystem",
@ -135,7 +136,10 @@ VIR_ENUM_IMPL(virDomainDevice, VIR_DOMAIN_DEVICE_LAST,
"controller",
"graphics",
"hub",
"redirdev")
"redirdev",
"smartcard",
"chr",
"memballoon")
VIR_ENUM_IMPL(virDomainDeviceAddress, VIR_DOMAIN_DEVICE_ADDRESS_TYPE_LAST,
"none",

View File

@ -1179,7 +1179,8 @@ enum virDomainSmbiosMode {
};
/* Flags for the 'type' field in next struct */
enum virDomainDeviceType {
typedef enum {
VIR_DOMAIN_DEVICE_NONE = 0,
VIR_DOMAIN_DEVICE_DISK,
VIR_DOMAIN_DEVICE_LEASE,
VIR_DOMAIN_DEVICE_FS,
@ -1193,9 +1194,12 @@ enum virDomainDeviceType {
VIR_DOMAIN_DEVICE_GRAPHICS,
VIR_DOMAIN_DEVICE_HUB,
VIR_DOMAIN_DEVICE_REDIRDEV,
VIR_DOMAIN_DEVICE_SMARTCARD,
VIR_DOMAIN_DEVICE_CHR,
VIR_DOMAIN_DEVICE_MEMBALLOON,
VIR_DOMAIN_DEVICE_LAST,
};
} virDomainDeviceType;
typedef struct _virDomainDeviceDef virDomainDeviceDef;
typedef virDomainDeviceDef *virDomainDeviceDefPtr;
@ -1215,6 +1219,9 @@ struct _virDomainDeviceDef {
virDomainGraphicsDefPtr graphics;
virDomainHubDefPtr hub;
virDomainRedirdevDefPtr redirdev;
virDomainSmartcardDefPtr smartcard;
virDomainChrDefPtr chr;
virDomainMemballoonDefPtr memballoon;
} data;
};