mirror of https://gitee.com/openkylin/libvirt.git
make all struct typedefs comply with proposed coding conventions
Proposed formal coding conventions encourage defining typedefs for vir[Blah] and vir[Blah]Ptr separately from the associated struct named _vir[Blah]: typedef struct _virBlah virBlah; typedef virBlah *virBlahPtr; struct _virBlah { ... }; At some point in the past, I had submitted several patches using a more compact style that I prefer, and they were accepted: typedef struct _virBlah { ... } virBlah, *virBlahPtr; Since these are by far a minority among all struct definitions, this patch changes all those definitions to reflect the style prefered by the proposal so that there is 100% consistency.
This commit is contained in:
parent
ae6da06144
commit
3898526931
|
@ -51,46 +51,58 @@ typedef enum {
|
|||
VIR_DOMAIN_DEVICE_ADDRESS_TYPE_LAST
|
||||
} virDomainDeviceAddressType;
|
||||
|
||||
typedef struct _virDomainDeviceDriveAddress {
|
||||
typedef struct _virDomainDeviceDriveAddress virDomainDeviceDriveAddress;
|
||||
typedef virDomainDeviceDriveAddress *virDomainDeviceDriveAddressPtr;
|
||||
struct _virDomainDeviceDriveAddress {
|
||||
unsigned int controller;
|
||||
unsigned int bus;
|
||||
unsigned int target;
|
||||
unsigned int unit;
|
||||
} virDomainDeviceDriveAddress, *virDomainDeviceDriveAddressPtr;
|
||||
};
|
||||
|
||||
typedef struct _virDomainDeviceVirtioSerialAddress {
|
||||
typedef struct _virDomainDeviceVirtioSerialAddress virDomainDeviceVirtioSerialAddress;
|
||||
typedef virDomainDeviceVirtioSerialAddress *virDomainDeviceVirtioSerialAddressPtr;
|
||||
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 {
|
||||
typedef struct _virDomainDeviceCCWAddress virDomainDeviceCCWAddress;
|
||||
typedef virDomainDeviceCCWAddress *virDomainDeviceCCWAddressPtr;
|
||||
struct _virDomainDeviceCCWAddress {
|
||||
unsigned int cssid;
|
||||
unsigned int ssid;
|
||||
unsigned int devno;
|
||||
bool assigned;
|
||||
} virDomainDeviceCCWAddress, *virDomainDeviceCCWAddressPtr;
|
||||
};
|
||||
|
||||
typedef struct _virDomainDeviceCcidAddress {
|
||||
typedef struct _virDomainDeviceCcidAddress virDomainDeviceCcidAddress;
|
||||
typedef virDomainDeviceCcidAddress *virDomainDeviceCcidAddressPtr;
|
||||
struct _virDomainDeviceCcidAddress {
|
||||
unsigned int controller;
|
||||
unsigned int slot;
|
||||
} virDomainDeviceCcidAddress, *virDomainDeviceCcidAddressPtr;
|
||||
};
|
||||
|
||||
# define VIR_DOMAIN_DEVICE_USB_MAX_PORT_DEPTH 4
|
||||
|
||||
typedef struct _virDomainDeviceUSBAddress {
|
||||
typedef struct _virDomainDeviceUSBAddress virDomainDeviceUSBAddress;
|
||||
typedef virDomainDeviceUSBAddress *virDomainDeviceUSBAddressPtr;
|
||||
struct _virDomainDeviceUSBAddress {
|
||||
unsigned int bus;
|
||||
unsigned int port[VIR_DOMAIN_DEVICE_USB_MAX_PORT_DEPTH];
|
||||
} virDomainDeviceUSBAddress, *virDomainDeviceUSBAddressPtr;
|
||||
};
|
||||
|
||||
typedef struct _virDomainDeviceSpaprVioAddress {
|
||||
typedef struct _virDomainDeviceSpaprVioAddress virDomainDeviceSpaprVioAddress;
|
||||
typedef virDomainDeviceSpaprVioAddress *virDomainDeviceSpaprVioAddressPtr;
|
||||
struct _virDomainDeviceSpaprVioAddress {
|
||||
unsigned long long reg;
|
||||
bool has_reg;
|
||||
} virDomainDeviceSpaprVioAddress, *virDomainDeviceSpaprVioAddressPtr;
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
VIR_DOMAIN_CONTROLLER_MASTER_NONE,
|
||||
|
@ -99,21 +111,29 @@ typedef enum {
|
|||
VIR_DOMAIN_CONTROLLER_MASTER_LAST
|
||||
} virDomainControllerMaster;
|
||||
|
||||
typedef struct _virDomainDeviceUSBMaster {
|
||||
typedef struct _virDomainDeviceUSBMaster virDomainDeviceUSBMaster;
|
||||
typedef virDomainDeviceUSBMaster *virDomainDeviceUSBMasterPtr;
|
||||
struct _virDomainDeviceUSBMaster {
|
||||
unsigned int startport;
|
||||
} virDomainDeviceUSBMaster, *virDomainDeviceUSBMasterPtr;
|
||||
};
|
||||
|
||||
typedef struct _virDomainDeviceISAAddress {
|
||||
typedef struct _virDomainDeviceISAAddress virDomainDeviceISAAddress;
|
||||
typedef virDomainDeviceISAAddress *virDomainDeviceISAAddressPtr;
|
||||
struct _virDomainDeviceISAAddress {
|
||||
unsigned int iobase;
|
||||
unsigned int irq;
|
||||
} virDomainDeviceISAAddress, *virDomainDeviceISAAddressPtr;
|
||||
};
|
||||
|
||||
typedef struct _virDomainDeviceDimmAddress {
|
||||
typedef struct _virDomainDeviceDimmAddress virDomainDeviceDimmAddress;
|
||||
typedef virDomainDeviceDimmAddress *virDomainDeviceDimmAddressPtr;
|
||||
struct _virDomainDeviceDimmAddress {
|
||||
unsigned int slot;
|
||||
unsigned long long base;
|
||||
} virDomainDeviceDimmAddress, *virDomainDeviceDimmAddressPtr;
|
||||
};
|
||||
|
||||
typedef struct _virDomainDeviceInfo {
|
||||
typedef struct _virDomainDeviceInfo virDomainDeviceInfo;
|
||||
typedef virDomainDeviceInfo *virDomainDeviceInfoPtr;
|
||||
struct _virDomainDeviceInfo {
|
||||
/* If adding to this struct, ensure that
|
||||
* virDomainDeviceInfoIsSet() is updated
|
||||
* to consider the new fields
|
||||
|
@ -147,7 +167,7 @@ typedef struct _virDomainDeviceInfo {
|
|||
* assignment, never saved and never reported.
|
||||
*/
|
||||
int pciConnectFlags; /* enum virDomainPCIConnectFlags */
|
||||
} virDomainDeviceInfo, *virDomainDeviceInfoPtr;
|
||||
};
|
||||
|
||||
|
||||
int virPCIDeviceAddressIsValid(virPCIDeviceAddressPtr addr,
|
||||
|
|
|
@ -127,10 +127,12 @@ struct _virNetworkDNSHostDef {
|
|||
};
|
||||
|
||||
|
||||
typedef struct _virNetworkDNSForwarder {
|
||||
typedef struct _virNetworkDNSForwarder virNetworkDNSForwarder;
|
||||
typedef virNetworkDNSForwarder *virNetworkDNSForwarderPtr;
|
||||
struct _virNetworkDNSForwarder {
|
||||
virSocketAddr addr;
|
||||
char *domain;
|
||||
} virNetworkDNSForwarder, *virNetworkDNSForwarderPtr;
|
||||
};
|
||||
|
||||
typedef struct _virNetworkDNSDef virNetworkDNSDef;
|
||||
typedef virNetworkDNSDef *virNetworkDNSDefPtr;
|
||||
|
|
|
@ -243,7 +243,9 @@ struct _virNodeDevCapDRM {
|
|||
virNodeDevDRMType type;
|
||||
};
|
||||
|
||||
typedef struct _virNodeDevCapData {
|
||||
typedef struct _virNodeDevCapData virNodeDevCapData;
|
||||
typedef virNodeDevCapData *virNodeDevCapDataPtr;
|
||||
struct _virNodeDevCapData {
|
||||
virNodeDevCapType type;
|
||||
union {
|
||||
virNodeDevCapSystem system;
|
||||
|
@ -258,7 +260,7 @@ typedef struct _virNodeDevCapData {
|
|||
virNodeDevCapSCSIGeneric sg;
|
||||
virNodeDevCapDRM drm;
|
||||
};
|
||||
} virNodeDevCapData, *virNodeDevCapDataPtr;
|
||||
};
|
||||
|
||||
typedef struct _virNodeDevCapsDef virNodeDevCapsDef;
|
||||
typedef virNodeDevCapsDef *virNodeDevCapsDefPtr;
|
||||
|
|
|
@ -86,10 +86,12 @@ typedef enum {
|
|||
|
||||
VIR_ENUM_DECL(virNetDevIfState)
|
||||
|
||||
typedef struct {
|
||||
typedef struct _virNetDevIfLink virNetDevIfLink;
|
||||
typedef virNetDevIfLink *virNetDevIfLinkPtr;
|
||||
struct _virNetDevIfLink {
|
||||
virNetDevIfState state; /* link state */
|
||||
unsigned int speed; /* link speed in Mbits per second */
|
||||
} virNetDevIfLink, *virNetDevIfLinkPtr;
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
VIR_NET_DEV_FEAT_GRXCSUM,
|
||||
|
|
|
@ -25,13 +25,17 @@
|
|||
|
||||
# include "virsocketaddr.h"
|
||||
|
||||
typedef struct {
|
||||
typedef struct _virNetDevIPAddr virNetDevIPAddr;
|
||||
typedef virNetDevIPAddr *virNetDevIPAddrPtr;
|
||||
struct _virNetDevIPAddr {
|
||||
virSocketAddr address; /* ipv4 or ipv6 address */
|
||||
virSocketAddr peer; /* ipv4 or ipv6 address of peer */
|
||||
unsigned int prefix; /* number of 1 bits in the netmask */
|
||||
} virNetDevIPAddr, *virNetDevIPAddrPtr;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
typedef struct _virNetDevIPRoute virNetDevIPRoute;
|
||||
typedef virNetDevIPRoute *virNetDevIPRoutePtr;
|
||||
struct _virNetDevIPRoute {
|
||||
char *family; /* ipv4 or ipv6 - default is ipv4 */
|
||||
virSocketAddr address; /* Routed Network IP address */
|
||||
|
||||
|
@ -46,15 +50,17 @@ typedef struct {
|
|||
unsigned int metric; /* value for metric (defaults to 1) */
|
||||
bool has_metric; /* metric= was specified */
|
||||
virSocketAddr gateway; /* gateway IP address for ip-route */
|
||||
} virNetDevIPRoute, *virNetDevIPRoutePtr;
|
||||
};
|
||||
|
||||
/* A full set of all IP config info for a network device */
|
||||
typedef struct {
|
||||
typedef struct _virNetDevIPInfo virNetDevIPInfo;
|
||||
typedef virNetDevIPInfo *virNetDevIPInfoPtr;
|
||||
struct _virNetDevIPInfo {
|
||||
size_t nips;
|
||||
virNetDevIPAddrPtr *ips;
|
||||
size_t nroutes;
|
||||
virNetDevIPRoutePtr *routes;
|
||||
} virNetDevIPInfo, *virNetDevIPInfoPtr;
|
||||
};
|
||||
|
||||
/* manipulating/querying the netdev */
|
||||
int virNetDevIPAddrAdd(const char *ifname,
|
||||
|
|
Loading…
Reference in New Issue