conf: Adjust coding style for nodedev conf sources

Alter the format of the code to follow more recent style guidelines of
two empty lines between functions, function decls with "[static] type"
on one line followed by function name with arguments to functions each
on one line.
This commit is contained in:
John Ferlan 2017-03-02 08:39:11 -05:00
parent bc20200e53
commit 29714483a6
2 changed files with 55 additions and 14 deletions

View File

@ -86,7 +86,8 @@ virNodeDevCapsDefParseString(const char *xpath,
} }
void virNodeDeviceDefFree(virNodeDeviceDefPtr def) void
virNodeDeviceDefFree(virNodeDeviceDefPtr def)
{ {
virNodeDevCapsDefPtr caps; virNodeDevCapsDefPtr caps;
@ -133,6 +134,7 @@ virPCIELinkFormat(virBufferPtr buf,
virBufferAddLit(buf, "/>\n"); virBufferAddLit(buf, "/>\n");
} }
static void static void
virPCIEDeviceInfoFormat(virBufferPtr buf, virPCIEDeviceInfoFormat(virBufferPtr buf,
virPCIEDeviceInfoPtr info) virPCIEDeviceInfoPtr info)
@ -152,7 +154,9 @@ virPCIEDeviceInfoFormat(virBufferPtr buf,
virBufferAddLit(buf, "</pci-express>\n"); virBufferAddLit(buf, "</pci-express>\n");
} }
char *virNodeDeviceDefFormat(const virNodeDeviceDef *def)
char *
virNodeDeviceDefFormat(const virNodeDeviceDef *def)
{ {
virBuffer buf = VIR_BUFFER_INITIALIZER; virBuffer buf = VIR_BUFFER_INITIALIZER;
virNodeDevCapsDefPtr caps; virNodeDevCapsDefPtr caps;
@ -489,6 +493,7 @@ char *virNodeDeviceDefFormat(const virNodeDeviceDef *def)
return virBufferContentAndReset(&buf); return virBufferContentAndReset(&buf);
} }
/** /**
* virNodeDevCapsDefParseIntOptional: * virNodeDevCapsDefParseIntOptional:
* @xpath: XPath to evaluate * @xpath: XPath to evaluate
@ -524,6 +529,7 @@ virNodeDevCapsDefParseIntOptional(const char *xpath,
return 1; return 1;
} }
static int static int
virNodeDevCapsDefParseULong(const char *xpath, virNodeDevCapsDefParseULong(const char *xpath,
xmlXPathContextPtr ctxt, xmlXPathContextPtr ctxt,
@ -547,6 +553,7 @@ virNodeDevCapsDefParseULong(const char *xpath,
return 0; return 0;
} }
static int static int
virNodeDevCapsDefParseULongLong(const char *xpath, virNodeDevCapsDefParseULongLong(const char *xpath,
xmlXPathContextPtr ctxt, xmlXPathContextPtr ctxt,
@ -570,6 +577,7 @@ virNodeDevCapsDefParseULongLong(const char *xpath,
return 0; return 0;
} }
static int static int
virNodeDevCapDRMParseXML(xmlXPathContextPtr ctxt, virNodeDevCapDRMParseXML(xmlXPathContextPtr ctxt,
virNodeDeviceDefPtr def, virNodeDeviceDefPtr def,
@ -600,6 +608,7 @@ virNodeDevCapDRMParseXML(xmlXPathContextPtr ctxt,
return ret; return ret;
} }
static int static int
virNodeDevCapStorageParseXML(xmlXPathContextPtr ctxt, virNodeDevCapStorageParseXML(xmlXPathContextPtr ctxt,
virNodeDeviceDefPtr def, virNodeDeviceDefPtr def,
@ -694,6 +703,7 @@ virNodeDevCapStorageParseXML(xmlXPathContextPtr ctxt,
return ret; return ret;
} }
static int static int
virNodeDevCapSCSIParseXML(xmlXPathContextPtr ctxt, virNodeDevCapSCSIParseXML(xmlXPathContextPtr ctxt,
virNodeDeviceDefPtr def, virNodeDeviceDefPtr def,
@ -954,6 +964,7 @@ virNodeDevCapNetParseXML(xmlXPathContextPtr ctxt,
return ret; return ret;
} }
static int static int
virNodeDevCapUSBInterfaceParseXML(xmlXPathContextPtr ctxt, virNodeDevCapUSBInterfaceParseXML(xmlXPathContextPtr ctxt,
virNodeDeviceDefPtr def, virNodeDeviceDefPtr def,
@ -998,6 +1009,7 @@ virNodeDevCapUSBInterfaceParseXML(xmlXPathContextPtr ctxt,
return ret; return ret;
} }
static int static int
virNodeDevCapsDefParseHexId(const char *xpath, virNodeDevCapsDefParseHexId(const char *xpath,
xmlXPathContextPtr ctxt, xmlXPathContextPtr ctxt,
@ -1021,6 +1033,7 @@ virNodeDevCapsDefParseHexId(const char *xpath,
return 0; return 0;
} }
static int static int
virNodeDevCapUSBDevParseXML(xmlXPathContextPtr ctxt, virNodeDevCapUSBDevParseXML(xmlXPathContextPtr ctxt,
virNodeDeviceDefPtr def, virNodeDeviceDefPtr def,
@ -1066,6 +1079,7 @@ virNodeDevCapUSBDevParseXML(xmlXPathContextPtr ctxt,
return ret; return ret;
} }
static int static int
virNodeDevCapPCIDevIommuGroupParseXML(xmlXPathContextPtr ctxt, virNodeDevCapPCIDevIommuGroupParseXML(xmlXPathContextPtr ctxt,
xmlNodePtr iommuGroupNode, xmlNodePtr iommuGroupNode,
@ -1122,6 +1136,7 @@ virNodeDevCapPCIDevIommuGroupParseXML(xmlXPathContextPtr ctxt,
return ret; return ret;
} }
static int static int
virPCIEDeviceInfoLinkParseXML(xmlXPathContextPtr ctxt, virPCIEDeviceInfoLinkParseXML(xmlXPathContextPtr ctxt,
xmlNodePtr linkNode, xmlNodePtr linkNode,
@ -1168,6 +1183,7 @@ virPCIEDeviceInfoLinkParseXML(xmlXPathContextPtr ctxt,
return ret; return ret;
} }
static int static int
virPCIEDeviceInfoParseXML(xmlXPathContextPtr ctxt, virPCIEDeviceInfoParseXML(xmlXPathContextPtr ctxt,
xmlNodePtr pciExpressNode, xmlNodePtr pciExpressNode,
@ -1391,6 +1407,7 @@ virNodeDevCapPCIDevParseXML(xmlXPathContextPtr ctxt,
return ret; return ret;
} }
static int static int
virNodeDevCapSystemParseXML(xmlXPathContextPtr ctxt, virNodeDevCapSystemParseXML(xmlXPathContextPtr ctxt,
virNodeDeviceDefPtr def, virNodeDeviceDefPtr def,
@ -1435,6 +1452,7 @@ virNodeDevCapSystemParseXML(xmlXPathContextPtr ctxt,
return ret; return ret;
} }
static virNodeDevCapsDefPtr static virNodeDevCapsDefPtr
virNodeDevCapsDefParseXML(xmlXPathContextPtr ctxt, virNodeDevCapsDefParseXML(xmlXPathContextPtr ctxt,
virNodeDeviceDefPtr def, virNodeDeviceDefPtr def,
@ -1519,6 +1537,7 @@ virNodeDevCapsDefParseXML(xmlXPathContextPtr ctxt,
return NULL; return NULL;
} }
static virNodeDeviceDefPtr static virNodeDeviceDefPtr
virNodeDeviceDefParseXML(xmlXPathContextPtr ctxt, virNodeDeviceDefParseXML(xmlXPathContextPtr ctxt,
int create, int create,
@ -1633,6 +1652,7 @@ virNodeDeviceDefParseXML(xmlXPathContextPtr ctxt,
return NULL; return NULL;
} }
virNodeDeviceDefPtr virNodeDeviceDefPtr
virNodeDeviceDefParseNode(xmlDocPtr xml, virNodeDeviceDefParseNode(xmlDocPtr xml,
xmlNodePtr root, xmlNodePtr root,
@ -1664,6 +1684,7 @@ virNodeDeviceDefParseNode(xmlDocPtr xml,
return def; return def;
} }
static virNodeDeviceDefPtr static virNodeDeviceDefPtr
virNodeDeviceDefParse(const char *str, virNodeDeviceDefParse(const char *str,
const char *filename, const char *filename,
@ -1682,6 +1703,7 @@ virNodeDeviceDefParse(const char *str,
return def; return def;
} }
virNodeDeviceDefPtr virNodeDeviceDefPtr
virNodeDeviceDefParseString(const char *str, virNodeDeviceDefParseString(const char *str,
int create, int create,
@ -1690,6 +1712,7 @@ virNodeDeviceDefParseString(const char *str,
return virNodeDeviceDefParse(str, NULL, create, virt_type); return virNodeDeviceDefParse(str, NULL, create, virt_type);
} }
virNodeDeviceDefPtr virNodeDeviceDefPtr
virNodeDeviceDefParseFile(const char *filename, virNodeDeviceDefParseFile(const char *filename,
int create, int create,
@ -1698,6 +1721,7 @@ virNodeDeviceDefParseFile(const char *filename,
return virNodeDeviceDefParse(NULL, filename, create, virt_type); return virNodeDeviceDefParse(NULL, filename, create, virt_type);
} }
/* /*
* Return fc_host dev's WWNN and WWPN * Return fc_host dev's WWNN and WWPN
*/ */
@ -1737,7 +1761,8 @@ virNodeDeviceGetWWNs(virNodeDeviceDefPtr def,
} }
void virNodeDevCapsDefFree(virNodeDevCapsDefPtr caps) void
virNodeDevCapsDefFree(virNodeDevCapsDefPtr caps)
{ {
size_t i = 0; size_t i = 0;
virNodeDevCapDataPtr data = &caps->data; virNodeDevCapDataPtr data = &caps->data;

View File

@ -33,7 +33,9 @@
VIR_LOG_INIT("conf.virnodedeviceobj"); VIR_LOG_INIT("conf.virnodedeviceobj");
int virNodeDeviceHasCap(const virNodeDeviceObj *dev, const char *cap) int
virNodeDeviceHasCap(const virNodeDeviceObj *dev,
const char *cap)
{ {
virNodeDevCapsDefPtr caps = dev->def->caps; virNodeDevCapsDefPtr caps = dev->def->caps;
const char *fc_host_cap = const char *fc_host_cap =
@ -125,8 +127,9 @@ virNodeDeviceFindBySysfsPath(virNodeDeviceObjListPtr devs,
} }
virNodeDeviceObjPtr virNodeDeviceFindByName(virNodeDeviceObjListPtr devs, virNodeDeviceObjPtr
const char *name) virNodeDeviceFindByName(virNodeDeviceObjListPtr devs,
const char *name)
{ {
size_t i; size_t i;
@ -198,7 +201,8 @@ virNodeDeviceFindByCap(virNodeDeviceObjListPtr devs,
} }
void virNodeDeviceObjFree(virNodeDeviceObjPtr dev) void
virNodeDeviceObjFree(virNodeDeviceObjPtr dev)
{ {
if (!dev) if (!dev)
return; return;
@ -212,7 +216,9 @@ void virNodeDeviceObjFree(virNodeDeviceObjPtr dev)
VIR_FREE(dev); VIR_FREE(dev);
} }
void virNodeDeviceObjListFree(virNodeDeviceObjListPtr devs)
void
virNodeDeviceObjListFree(virNodeDeviceObjListPtr devs)
{ {
size_t i; size_t i;
for (i = 0; i < devs->count; i++) for (i = 0; i < devs->count; i++)
@ -221,8 +227,10 @@ void virNodeDeviceObjListFree(virNodeDeviceObjListPtr devs)
devs->count = 0; devs->count = 0;
} }
virNodeDeviceObjPtr virNodeDeviceAssignDef(virNodeDeviceObjListPtr devs,
virNodeDeviceDefPtr def) virNodeDeviceObjPtr
virNodeDeviceAssignDef(virNodeDeviceObjListPtr devs,
virNodeDeviceDefPtr def)
{ {
virNodeDeviceObjPtr device; virNodeDeviceObjPtr device;
@ -254,8 +262,10 @@ virNodeDeviceObjPtr virNodeDeviceAssignDef(virNodeDeviceObjListPtr devs,
} }
void virNodeDeviceObjRemove(virNodeDeviceObjListPtr devs,
virNodeDeviceObjPtr *dev) void
virNodeDeviceObjRemove(virNodeDeviceObjListPtr devs,
virNodeDeviceObjPtr *dev)
{ {
size_t i; size_t i;
@ -423,16 +433,20 @@ virNodeDeviceGetParentHost(virNodeDeviceObjListPtr devs,
} }
void virNodeDeviceObjLock(virNodeDeviceObjPtr obj) void
virNodeDeviceObjLock(virNodeDeviceObjPtr obj)
{ {
virMutexLock(&obj->lock); virMutexLock(&obj->lock);
} }
void virNodeDeviceObjUnlock(virNodeDeviceObjPtr obj)
void
virNodeDeviceObjUnlock(virNodeDeviceObjPtr obj)
{ {
virMutexUnlock(&obj->lock); virMutexUnlock(&obj->lock);
} }
static bool static bool
virNodeDeviceCapMatch(virNodeDeviceObjPtr devobj, virNodeDeviceCapMatch(virNodeDeviceObjPtr devobj,
int type) int type)
@ -459,6 +473,7 @@ virNodeDeviceCapMatch(virNodeDeviceObjPtr devobj,
return false; return false;
} }
#define MATCH(FLAG) ((flags & (VIR_CONNECT_LIST_NODE_DEVICES_CAP_ ## FLAG)) && \ #define MATCH(FLAG) ((flags & (VIR_CONNECT_LIST_NODE_DEVICES_CAP_ ## FLAG)) && \
virNodeDeviceCapMatch(devobj, VIR_NODE_DEV_CAP_ ## FLAG)) virNodeDeviceCapMatch(devobj, VIR_NODE_DEV_CAP_ ## FLAG))
static bool static bool
@ -487,6 +502,7 @@ virNodeDeviceMatch(virNodeDeviceObjPtr devobj,
} }
#undef MATCH #undef MATCH
int int
virNodeDeviceObjListExport(virConnectPtr conn, virNodeDeviceObjListExport(virConnectPtr conn,
virNodeDeviceObjList devobjs, virNodeDeviceObjList devobjs,