mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-08 22:15:21 +00:00
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:
parent
bc20200e53
commit
29714483a6
@ -86,7 +86,8 @@ virNodeDevCapsDefParseString(const char *xpath,
|
||||
}
|
||||
|
||||
|
||||
void virNodeDeviceDefFree(virNodeDeviceDefPtr def)
|
||||
void
|
||||
virNodeDeviceDefFree(virNodeDeviceDefPtr def)
|
||||
{
|
||||
virNodeDevCapsDefPtr caps;
|
||||
|
||||
@ -133,6 +134,7 @@ virPCIELinkFormat(virBufferPtr buf,
|
||||
virBufferAddLit(buf, "/>\n");
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
virPCIEDeviceInfoFormat(virBufferPtr buf,
|
||||
virPCIEDeviceInfoPtr info)
|
||||
@ -152,7 +154,9 @@ virPCIEDeviceInfoFormat(virBufferPtr buf,
|
||||
virBufferAddLit(buf, "</pci-express>\n");
|
||||
}
|
||||
|
||||
char *virNodeDeviceDefFormat(const virNodeDeviceDef *def)
|
||||
|
||||
char *
|
||||
virNodeDeviceDefFormat(const virNodeDeviceDef *def)
|
||||
{
|
||||
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
||||
virNodeDevCapsDefPtr caps;
|
||||
@ -489,6 +493,7 @@ char *virNodeDeviceDefFormat(const virNodeDeviceDef *def)
|
||||
return virBufferContentAndReset(&buf);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* virNodeDevCapsDefParseIntOptional:
|
||||
* @xpath: XPath to evaluate
|
||||
@ -524,6 +529,7 @@ virNodeDevCapsDefParseIntOptional(const char *xpath,
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
virNodeDevCapsDefParseULong(const char *xpath,
|
||||
xmlXPathContextPtr ctxt,
|
||||
@ -547,6 +553,7 @@ virNodeDevCapsDefParseULong(const char *xpath,
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
virNodeDevCapsDefParseULongLong(const char *xpath,
|
||||
xmlXPathContextPtr ctxt,
|
||||
@ -570,6 +577,7 @@ virNodeDevCapsDefParseULongLong(const char *xpath,
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
virNodeDevCapDRMParseXML(xmlXPathContextPtr ctxt,
|
||||
virNodeDeviceDefPtr def,
|
||||
@ -600,6 +608,7 @@ virNodeDevCapDRMParseXML(xmlXPathContextPtr ctxt,
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
virNodeDevCapStorageParseXML(xmlXPathContextPtr ctxt,
|
||||
virNodeDeviceDefPtr def,
|
||||
@ -694,6 +703,7 @@ virNodeDevCapStorageParseXML(xmlXPathContextPtr ctxt,
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
virNodeDevCapSCSIParseXML(xmlXPathContextPtr ctxt,
|
||||
virNodeDeviceDefPtr def,
|
||||
@ -954,6 +964,7 @@ virNodeDevCapNetParseXML(xmlXPathContextPtr ctxt,
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
virNodeDevCapUSBInterfaceParseXML(xmlXPathContextPtr ctxt,
|
||||
virNodeDeviceDefPtr def,
|
||||
@ -998,6 +1009,7 @@ virNodeDevCapUSBInterfaceParseXML(xmlXPathContextPtr ctxt,
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
virNodeDevCapsDefParseHexId(const char *xpath,
|
||||
xmlXPathContextPtr ctxt,
|
||||
@ -1021,6 +1033,7 @@ virNodeDevCapsDefParseHexId(const char *xpath,
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
virNodeDevCapUSBDevParseXML(xmlXPathContextPtr ctxt,
|
||||
virNodeDeviceDefPtr def,
|
||||
@ -1066,6 +1079,7 @@ virNodeDevCapUSBDevParseXML(xmlXPathContextPtr ctxt,
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
virNodeDevCapPCIDevIommuGroupParseXML(xmlXPathContextPtr ctxt,
|
||||
xmlNodePtr iommuGroupNode,
|
||||
@ -1122,6 +1136,7 @@ virNodeDevCapPCIDevIommuGroupParseXML(xmlXPathContextPtr ctxt,
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
virPCIEDeviceInfoLinkParseXML(xmlXPathContextPtr ctxt,
|
||||
xmlNodePtr linkNode,
|
||||
@ -1168,6 +1183,7 @@ virPCIEDeviceInfoLinkParseXML(xmlXPathContextPtr ctxt,
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
virPCIEDeviceInfoParseXML(xmlXPathContextPtr ctxt,
|
||||
xmlNodePtr pciExpressNode,
|
||||
@ -1391,6 +1407,7 @@ virNodeDevCapPCIDevParseXML(xmlXPathContextPtr ctxt,
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
virNodeDevCapSystemParseXML(xmlXPathContextPtr ctxt,
|
||||
virNodeDeviceDefPtr def,
|
||||
@ -1435,6 +1452,7 @@ virNodeDevCapSystemParseXML(xmlXPathContextPtr ctxt,
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
static virNodeDevCapsDefPtr
|
||||
virNodeDevCapsDefParseXML(xmlXPathContextPtr ctxt,
|
||||
virNodeDeviceDefPtr def,
|
||||
@ -1519,6 +1537,7 @@ virNodeDevCapsDefParseXML(xmlXPathContextPtr ctxt,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
static virNodeDeviceDefPtr
|
||||
virNodeDeviceDefParseXML(xmlXPathContextPtr ctxt,
|
||||
int create,
|
||||
@ -1633,6 +1652,7 @@ virNodeDeviceDefParseXML(xmlXPathContextPtr ctxt,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
virNodeDeviceDefPtr
|
||||
virNodeDeviceDefParseNode(xmlDocPtr xml,
|
||||
xmlNodePtr root,
|
||||
@ -1664,6 +1684,7 @@ virNodeDeviceDefParseNode(xmlDocPtr xml,
|
||||
return def;
|
||||
}
|
||||
|
||||
|
||||
static virNodeDeviceDefPtr
|
||||
virNodeDeviceDefParse(const char *str,
|
||||
const char *filename,
|
||||
@ -1682,6 +1703,7 @@ virNodeDeviceDefParse(const char *str,
|
||||
return def;
|
||||
}
|
||||
|
||||
|
||||
virNodeDeviceDefPtr
|
||||
virNodeDeviceDefParseString(const char *str,
|
||||
int create,
|
||||
@ -1690,6 +1712,7 @@ virNodeDeviceDefParseString(const char *str,
|
||||
return virNodeDeviceDefParse(str, NULL, create, virt_type);
|
||||
}
|
||||
|
||||
|
||||
virNodeDeviceDefPtr
|
||||
virNodeDeviceDefParseFile(const char *filename,
|
||||
int create,
|
||||
@ -1698,6 +1721,7 @@ virNodeDeviceDefParseFile(const char *filename,
|
||||
return virNodeDeviceDefParse(NULL, filename, create, virt_type);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 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;
|
||||
virNodeDevCapDataPtr data = &caps->data;
|
||||
|
@ -33,7 +33,9 @@
|
||||
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;
|
||||
const char *fc_host_cap =
|
||||
@ -125,8 +127,9 @@ virNodeDeviceFindBySysfsPath(virNodeDeviceObjListPtr devs,
|
||||
}
|
||||
|
||||
|
||||
virNodeDeviceObjPtr virNodeDeviceFindByName(virNodeDeviceObjListPtr devs,
|
||||
const char *name)
|
||||
virNodeDeviceObjPtr
|
||||
virNodeDeviceFindByName(virNodeDeviceObjListPtr devs,
|
||||
const char *name)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
@ -198,7 +201,8 @@ virNodeDeviceFindByCap(virNodeDeviceObjListPtr devs,
|
||||
}
|
||||
|
||||
|
||||
void virNodeDeviceObjFree(virNodeDeviceObjPtr dev)
|
||||
void
|
||||
virNodeDeviceObjFree(virNodeDeviceObjPtr dev)
|
||||
{
|
||||
if (!dev)
|
||||
return;
|
||||
@ -212,7 +216,9 @@ void virNodeDeviceObjFree(virNodeDeviceObjPtr dev)
|
||||
VIR_FREE(dev);
|
||||
}
|
||||
|
||||
void virNodeDeviceObjListFree(virNodeDeviceObjListPtr devs)
|
||||
|
||||
void
|
||||
virNodeDeviceObjListFree(virNodeDeviceObjListPtr devs)
|
||||
{
|
||||
size_t i;
|
||||
for (i = 0; i < devs->count; i++)
|
||||
@ -221,8 +227,10 @@ void virNodeDeviceObjListFree(virNodeDeviceObjListPtr devs)
|
||||
devs->count = 0;
|
||||
}
|
||||
|
||||
virNodeDeviceObjPtr virNodeDeviceAssignDef(virNodeDeviceObjListPtr devs,
|
||||
virNodeDeviceDefPtr def)
|
||||
|
||||
virNodeDeviceObjPtr
|
||||
virNodeDeviceAssignDef(virNodeDeviceObjListPtr devs,
|
||||
virNodeDeviceDefPtr def)
|
||||
{
|
||||
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;
|
||||
|
||||
@ -423,16 +433,20 @@ virNodeDeviceGetParentHost(virNodeDeviceObjListPtr devs,
|
||||
}
|
||||
|
||||
|
||||
void virNodeDeviceObjLock(virNodeDeviceObjPtr obj)
|
||||
void
|
||||
virNodeDeviceObjLock(virNodeDeviceObjPtr obj)
|
||||
{
|
||||
virMutexLock(&obj->lock);
|
||||
}
|
||||
|
||||
void virNodeDeviceObjUnlock(virNodeDeviceObjPtr obj)
|
||||
|
||||
void
|
||||
virNodeDeviceObjUnlock(virNodeDeviceObjPtr obj)
|
||||
{
|
||||
virMutexUnlock(&obj->lock);
|
||||
}
|
||||
|
||||
|
||||
static bool
|
||||
virNodeDeviceCapMatch(virNodeDeviceObjPtr devobj,
|
||||
int type)
|
||||
@ -459,6 +473,7 @@ virNodeDeviceCapMatch(virNodeDeviceObjPtr devobj,
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
#define MATCH(FLAG) ((flags & (VIR_CONNECT_LIST_NODE_DEVICES_CAP_ ## FLAG)) && \
|
||||
virNodeDeviceCapMatch(devobj, VIR_NODE_DEV_CAP_ ## FLAG))
|
||||
static bool
|
||||
@ -487,6 +502,7 @@ virNodeDeviceMatch(virNodeDeviceObjPtr devobj,
|
||||
}
|
||||
#undef MATCH
|
||||
|
||||
|
||||
int
|
||||
virNodeDeviceObjListExport(virConnectPtr conn,
|
||||
virNodeDeviceObjList devobjs,
|
||||
|
Loading…
Reference in New Issue
Block a user