1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-03-20 06:50:22 +03:00

conf: use typedefs for enums in node_device_conf, nwfilter_params

In "src/conf/" there are many enumeration (enum) declarations. Similar
to the recent cleanup to "src/util" directory, it's better to use a
typedef for variable types, function types and other usages. Other
enumeration and folders will be changed to typedef's in the future.
Most of the files changed in this commit are reltaed to Node and
Network (node_device_conf.h and nwfilter_params.*) enums.

Signed-off-by: Julio Faracco <jcfaracco@gmail.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
This commit is contained in:
Julio Faracco 2014-05-11 12:08:48 -03:00 committed by Eric Blake
parent 4fddfeefaf
commit e087911786
5 changed files with 23 additions and 23 deletions

View File

@ -35,7 +35,7 @@
# define CREATE_DEVICE 1
# define EXISTING_DEVICE 0
enum virNodeDevCapType {
typedef enum {
/* Keep in sync with VIR_ENUM_IMPL in node_device_conf.c */
VIR_NODE_DEV_CAP_SYSTEM, /* System capability */
VIR_NODE_DEV_CAP_PCI_DEV, /* PCI device */
@ -51,38 +51,38 @@ enum virNodeDevCapType {
VIR_NODE_DEV_CAP_SCSI_GENERIC, /* SCSI generic device */
VIR_NODE_DEV_CAP_LAST
};
} virNodeDevCapType;
enum virNodeDevNetCapType {
typedef enum {
/* Keep in sync with VIR_ENUM_IMPL in node_device_conf.c */
VIR_NODE_DEV_CAP_NET_80203, /* 802.03 network device */
VIR_NODE_DEV_CAP_NET_80211, /* 802.11 network device */
VIR_NODE_DEV_CAP_NET_LAST
};
} virNodeDevNetCapType;
VIR_ENUM_DECL(virNodeDevCap)
VIR_ENUM_DECL(virNodeDevNetCap)
enum virNodeDevStorageCapFlags {
typedef enum {
VIR_NODE_DEV_CAP_STORAGE_REMOVABLE = (1 << 0),
VIR_NODE_DEV_CAP_STORAGE_REMOVABLE_MEDIA_AVAILABLE = (1 << 1),
VIR_NODE_DEV_CAP_STORAGE_HOTPLUGGABLE = (1 << 2),
};
} virNodeDevStorageCapFlags;
enum virNodeDevSCSIHostCapFlags {
typedef enum {
VIR_NODE_DEV_CAP_FLAG_HBA_FC_HOST = (1 << 0),
VIR_NODE_DEV_CAP_FLAG_HBA_VPORT_OPS = (1 << 1),
};
} virNodeDevSCSIHostCapFlags;
enum virNodeDevPCICapFlags {
typedef enum {
VIR_NODE_DEV_CAP_FLAG_PCI_PHYSICAL_FUNCTION = (1 << 0),
VIR_NODE_DEV_CAP_FLAG_PCI_VIRTUAL_FUNCTION = (1 << 1),
};
} virNodeDevPCICapFlags;
typedef struct _virNodeDevCapsDef virNodeDevCapsDef;
typedef virNodeDevCapsDef *virNodeDevCapsDefPtr;
struct _virNodeDevCapsDef {
enum virNodeDevCapType type;
virNodeDevCapType type;
union _virNodeDevCapData {
struct {
char *product_name;
@ -135,7 +135,7 @@ struct _virNodeDevCapsDef {
char *address;
unsigned int address_len;
char *ifname;
enum virNodeDevNetCapType subtype; /* LAST -> no subtype */
virNodeDevNetCapType subtype; /* LAST -> no subtype */
} net;
struct {
unsigned int host;

View File

@ -1061,7 +1061,7 @@ virNWFilterVarAccessGetVarName(const virNWFilterVarAccess *vap)
return vap->varName;
}
enum virNWFilterVarAccessType
virNWFilterVarAccessType
virNWFilterVarAccessGetType(const virNWFilterVarAccess *vap)
{
return vap->accessType;

View File

@ -27,17 +27,17 @@
# include "virbuffer.h"
# include "virmacaddr.h"
enum virNWFilterVarValueType {
typedef enum {
NWFILTER_VALUE_TYPE_SIMPLE,
NWFILTER_VALUE_TYPE_ARRAY,
NWFILTER_VALUE_TYPE_LAST
};
} virNWFilterVarValueType;
typedef struct _virNWFilterVarValue virNWFilterVarValue;
typedef virNWFilterVarValue *virNWFilterVarValuePtr;
struct _virNWFilterVarValue {
enum virNWFilterVarValueType valType;
virNWFilterVarValueType valType;
union {
struct {
char *value;
@ -98,17 +98,17 @@ bool virNWFilterHashTableEqual(virNWFilterHashTablePtr a,
# define NWFILTER_VARNAME_CTRL_IP_LEARNING "CTRL_IP_LEARNING"
# define NWFILTER_VARNAME_DHCPSERVER "DHCPSERVER"
enum virNWFilterVarAccessType {
typedef enum {
VIR_NWFILTER_VAR_ACCESS_ELEMENT = 0,
VIR_NWFILTER_VAR_ACCESS_ITERATOR = 1,
VIR_NWFILTER_VAR_ACCESS_LAST,
};
} virNWFilterVarAccessType;
typedef struct _virNWFilterVarAccess virNWFilterVarAccess;
typedef virNWFilterVarAccess *virNWFilterVarAccessPtr;
struct _virNWFilterVarAccess {
enum virNWFilterVarAccessType accessType;
virNWFilterVarAccessType accessType;
union {
struct {
unsigned int index;
@ -128,7 +128,7 @@ virNWFilterVarAccessPtr virNWFilterVarAccessParse(const char *varAccess);
void virNWFilterVarAccessPrint(virNWFilterVarAccessPtr vap,
virBufferPtr buf);
const char *virNWFilterVarAccessGetVarName(const virNWFilterVarAccess *vap);
enum virNWFilterVarAccessType virNWFilterVarAccessGetType(
virNWFilterVarAccessType virNWFilterVarAccessGetType(
const virNWFilterVarAccess *vap);
unsigned int virNWFilterVarAccessGetIterId(const virNWFilterVarAccess *vap);
unsigned int virNWFilterVarAccessGetIndex(const virNWFilterVarAccess *vap);

View File

@ -1,7 +1,7 @@
/*
* node_device_hal.c: node device enumeration - HAL-based implementation
*
* Copyright (C) 2011, 2013 Red Hat, Inc.
* Copyright (C) 2011-2014 Red Hat, Inc.
* Copyright (C) 2008 Virtual Iron Software, Inc.
* Copyright (C) 2008 David F. Lively
*
@ -343,7 +343,7 @@ gather_system_cap(LibHalContext *ctx, const char *udi,
struct _caps_tbl_entry {
const char *cap_name;
enum virNodeDevCapType type;
virNodeDevCapType type;
int (*gather_fn)(LibHalContext *ctx,
const char *udi,
union _virNodeDevCapData *data);

View File

@ -1176,7 +1176,7 @@ udevHasDeviceProperty(struct udev_device *dev,
static int
udevGetDeviceType(struct udev_device *device,
enum virNodeDevCapType *type)
virNodeDevCapType *type)
{
const char *devtype = NULL;
char *subsystem = NULL;