]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
make all struct typedefs comply with proposed coding conventions
authorLaine Stump <laine@laine.org>
Mon, 6 Mar 2017 17:39:48 +0000 (12:39 -0500)
committerLaine Stump <laine@laine.org>
Mon, 6 Mar 2017 18:00:45 +0000 (13:00 -0500)
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.

src/conf/device_conf.h
src/conf/network_conf.h
src/conf/node_device_conf.h
src/util/virnetdev.h
src/util/virnetdevip.h

index f435fb5e59a1e329be050ef9d5ab5d3e7515a01d..a20de853f8728d1c290b36afaeb72af1bad3d4a1 100644 (file)
@@ -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,
index 9e4ae7161824408d9ec184752bbe5bad783e05ed..dec809e927e00e92b0d44666bde317886af1e5d6 100644 (file)
@@ -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;
index 7aed1f4c9d183237ffd3622b6df14b2054f2fcef..cf51c6995f15c7d38f065e2edd932bbaaa36e434 100644 (file)
@@ -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;
index c3e8ffce9f0e9a047f23d0f3fe86c4811cd274e8..236cf83efea58659e42e0afd1babb18184f66790 100644 (file)
@@ -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,
index 8277654033665650a8bdc1941a4671cbbbe17d75..b7abdf94d3af23c6fa35d620637c7290f0a9be54 100644 (file)
 
 # 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,