conf: Adjust coding style for interface 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 11:44:11 -05:00
parent eabeff8ea3
commit 7e702a862d
2 changed files with 89 additions and 32 deletions

View File

@ -40,12 +40,13 @@ VIR_ENUM_IMPL(virInterface,
static virInterfaceDefPtr static virInterfaceDefPtr
virInterfaceDefParseXML(xmlXPathContextPtr ctxt, int parentIfType); virInterfaceDefParseXML(xmlXPathContextPtr ctxt, int parentIfType);
static int static int
virInterfaceDefDevFormat(virBufferPtr buf, const virInterfaceDef *def, virInterfaceDefDevFormat(virBufferPtr buf, const virInterfaceDef *def,
virInterfaceType parentIfType); virInterfaceType parentIfType);
static static void
void virInterfaceIPDefFree(virInterfaceIPDefPtr def) virInterfaceIPDefFree(virInterfaceIPDefPtr def)
{ {
if (def == NULL) if (def == NULL)
return; return;
@ -53,8 +54,9 @@ void virInterfaceIPDefFree(virInterfaceIPDefPtr def)
VIR_FREE(def); VIR_FREE(def);
} }
static
void virInterfaceProtocolDefFree(virInterfaceProtocolDefPtr def) static void
virInterfaceProtocolDefFree(virInterfaceProtocolDefPtr def)
{ {
size_t i; size_t i;
@ -68,7 +70,9 @@ void virInterfaceProtocolDefFree(virInterfaceProtocolDefPtr def)
VIR_FREE(def); VIR_FREE(def);
} }
void virInterfaceDefFree(virInterfaceDefPtr def)
void
virInterfaceDefFree(virInterfaceDefPtr def)
{ {
size_t i; size_t i;
int pp; int pp;
@ -111,6 +115,7 @@ void virInterfaceDefFree(virInterfaceDefPtr def)
VIR_FREE(def); VIR_FREE(def);
} }
static int static int
virInterfaceDefParseName(virInterfaceDefPtr def, virInterfaceDefParseName(virInterfaceDefPtr def,
xmlXPathContextPtr ctxt) xmlXPathContextPtr ctxt)
@ -127,6 +132,7 @@ virInterfaceDefParseName(virInterfaceDefPtr def,
return 0; return 0;
} }
static int static int
virInterfaceDefParseMtu(virInterfaceDefPtr def, virInterfaceDefParseMtu(virInterfaceDefPtr def,
xmlXPathContextPtr ctxt) xmlXPathContextPtr ctxt)
@ -145,6 +151,7 @@ virInterfaceDefParseMtu(virInterfaceDefPtr def,
return 0; return 0;
} }
static int static int
virInterfaceDefParseStartMode(virInterfaceDefPtr def, virInterfaceDefParseStartMode(virInterfaceDefPtr def,
xmlXPathContextPtr ctxt) xmlXPathContextPtr ctxt)
@ -170,6 +177,7 @@ virInterfaceDefParseStartMode(virInterfaceDefPtr def,
return 0; return 0;
} }
static int static int
virInterfaceDefParseBondMode(xmlXPathContextPtr ctxt) virInterfaceDefParseBondMode(xmlXPathContextPtr ctxt)
{ {
@ -202,6 +210,7 @@ virInterfaceDefParseBondMode(xmlXPathContextPtr ctxt)
return ret; return ret;
} }
static int static int
virInterfaceDefParseBondMiiCarrier(xmlXPathContextPtr ctxt) virInterfaceDefParseBondMiiCarrier(xmlXPathContextPtr ctxt)
{ {
@ -224,6 +233,7 @@ virInterfaceDefParseBondMiiCarrier(xmlXPathContextPtr ctxt)
return ret; return ret;
} }
static int static int
virInterfaceDefParseBondArpValid(xmlXPathContextPtr ctxt) virInterfaceDefParseBondArpValid(xmlXPathContextPtr ctxt)
{ {
@ -248,6 +258,7 @@ virInterfaceDefParseBondArpValid(xmlXPathContextPtr ctxt)
return ret; return ret;
} }
static int static int
virInterfaceDefParseDhcp(virInterfaceProtocolDefPtr def, virInterfaceDefParseDhcp(virInterfaceProtocolDefPtr def,
xmlNodePtr dhcp, xmlXPathContextPtr ctxt) xmlNodePtr dhcp, xmlXPathContextPtr ctxt)
@ -280,6 +291,7 @@ virInterfaceDefParseDhcp(virInterfaceProtocolDefPtr def,
return ret; return ret;
} }
static int static int
virInterfaceDefParseIP(virInterfaceIPDefPtr def, virInterfaceDefParseIP(virInterfaceIPDefPtr def,
xmlXPathContextPtr ctxt) xmlXPathContextPtr ctxt)
@ -304,6 +316,7 @@ virInterfaceDefParseIP(virInterfaceIPDefPtr def,
return 0; return 0;
} }
static int static int
virInterfaceDefParseProtoIPv4(virInterfaceProtocolDefPtr def, virInterfaceDefParseProtoIPv4(virInterfaceProtocolDefPtr def,
xmlXPathContextPtr ctxt) xmlXPathContextPtr ctxt)
@ -355,6 +368,7 @@ virInterfaceDefParseProtoIPv4(virInterfaceProtocolDefPtr def,
return ret; return ret;
} }
static int static int
virInterfaceDefParseProtoIPv6(virInterfaceProtocolDefPtr def, virInterfaceDefParseProtoIPv6(virInterfaceProtocolDefPtr def,
xmlXPathContextPtr ctxt) xmlXPathContextPtr ctxt)
@ -410,6 +424,7 @@ virInterfaceDefParseProtoIPv6(virInterfaceProtocolDefPtr def,
return ret; return ret;
} }
static int static int
virInterfaceDefParseIfAdressing(virInterfaceDefPtr def, virInterfaceDefParseIfAdressing(virInterfaceDefPtr def,
xmlXPathContextPtr ctxt) xmlXPathContextPtr ctxt)
@ -480,6 +495,7 @@ virInterfaceDefParseIfAdressing(virInterfaceDefPtr def,
} }
static int static int
virInterfaceDefParseBridge(virInterfaceDefPtr def, virInterfaceDefParseBridge(virInterfaceDefPtr def,
xmlXPathContextPtr ctxt) xmlXPathContextPtr ctxt)
@ -539,6 +555,7 @@ virInterfaceDefParseBridge(virInterfaceDefPtr def,
return ret; return ret;
} }
static int static int
virInterfaceDefParseBondItfs(virInterfaceDefPtr def, virInterfaceDefParseBondItfs(virInterfaceDefPtr def,
xmlXPathContextPtr ctxt) xmlXPathContextPtr ctxt)
@ -581,6 +598,7 @@ virInterfaceDefParseBondItfs(virInterfaceDefPtr def,
return ret; return ret;
} }
static int static int
virInterfaceDefParseBond(virInterfaceDefPtr def, virInterfaceDefParseBond(virInterfaceDefPtr def,
xmlXPathContextPtr ctxt) xmlXPathContextPtr ctxt)
@ -653,6 +671,7 @@ virInterfaceDefParseBond(virInterfaceDefPtr def,
return 0; return 0;
} }
static int static int
virInterfaceDefParseVlan(virInterfaceDefPtr def, virInterfaceDefParseVlan(virInterfaceDefPtr def,
xmlXPathContextPtr ctxt) xmlXPathContextPtr ctxt)
@ -674,8 +693,10 @@ virInterfaceDefParseVlan(virInterfaceDefPtr def,
return 0; return 0;
} }
static virInterfaceDefPtr static virInterfaceDefPtr
virInterfaceDefParseXML(xmlXPathContextPtr ctxt, int parentIfType) virInterfaceDefParseXML(xmlXPathContextPtr ctxt,
int parentIfType)
{ {
virInterfaceDefPtr def; virInterfaceDefPtr def;
int type; int type;
@ -795,8 +816,10 @@ virInterfaceDefParseXML(xmlXPathContextPtr ctxt, int parentIfType)
return NULL; return NULL;
} }
virInterfaceDefPtr virInterfaceDefParseNode(xmlDocPtr xml,
xmlNodePtr root) virInterfaceDefPtr
virInterfaceDefParseNode(xmlDocPtr xml,
xmlNodePtr root)
{ {
xmlXPathContextPtr ctxt = NULL; xmlXPathContextPtr ctxt = NULL;
virInterfaceDefPtr def = NULL; virInterfaceDefPtr def = NULL;
@ -823,6 +846,7 @@ virInterfaceDefPtr virInterfaceDefParseNode(xmlDocPtr xml,
return def; return def;
} }
static virInterfaceDefPtr static virInterfaceDefPtr
virInterfaceDefParse(const char *xmlStr, virInterfaceDefParse(const char *xmlStr,
const char *filename) const char *filename)
@ -838,18 +862,24 @@ virInterfaceDefParse(const char *xmlStr,
return def; return def;
} }
virInterfaceDefPtr virInterfaceDefParseString(const char *xmlStr)
virInterfaceDefPtr
virInterfaceDefParseString(const char *xmlStr)
{ {
return virInterfaceDefParse(xmlStr, NULL); return virInterfaceDefParse(xmlStr, NULL);
} }
virInterfaceDefPtr virInterfaceDefParseFile(const char *filename)
virInterfaceDefPtr
virInterfaceDefParseFile(const char *filename)
{ {
return virInterfaceDefParse(NULL, filename); return virInterfaceDefParse(NULL, filename);
} }
static int static int
virInterfaceBridgeDefFormat(virBufferPtr buf, const virInterfaceDef *def) virInterfaceBridgeDefFormat(virBufferPtr buf,
const virInterfaceDef *def)
{ {
size_t i; size_t i;
int ret = 0; int ret = 0;
@ -875,8 +905,10 @@ virInterfaceBridgeDefFormat(virBufferPtr buf, const virInterfaceDef *def)
return ret; return ret;
} }
static int static int
virInterfaceBondDefFormat(virBufferPtr buf, const virInterfaceDef *def) virInterfaceBondDefFormat(virBufferPtr buf,
const virInterfaceDef *def)
{ {
size_t i; size_t i;
int ret = 0; int ret = 0;
@ -938,8 +970,10 @@ virInterfaceBondDefFormat(virBufferPtr buf, const virInterfaceDef *def)
return ret; return ret;
} }
static int static int
virInterfaceVlanDefFormat(virBufferPtr buf, const virInterfaceDef *def) virInterfaceVlanDefFormat(virBufferPtr buf,
const virInterfaceDef *def)
{ {
if (def->data.vlan.tag == NULL) { if (def->data.vlan.tag == NULL) {
virReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
@ -961,8 +995,10 @@ virInterfaceVlanDefFormat(virBufferPtr buf, const virInterfaceDef *def)
return 0; return 0;
} }
static int static int
virInterfaceProtocolDefFormat(virBufferPtr buf, const virInterfaceDef *def) virInterfaceProtocolDefFormat(virBufferPtr buf,
const virInterfaceDef *def)
{ {
size_t i, j; size_t i, j;
@ -1006,6 +1042,7 @@ virInterfaceProtocolDefFormat(virBufferPtr buf, const virInterfaceDef *def)
return 0; return 0;
} }
static int static int
virInterfaceStartmodeDefFormat(virBufferPtr buf, virInterfaceStartmodeDefFormat(virBufferPtr buf,
virInterfaceStartMode startmode) virInterfaceStartMode startmode)
@ -1032,8 +1069,10 @@ virInterfaceStartmodeDefFormat(virBufferPtr buf,
return 0; return 0;
} }
static int static int
virInterfaceDefDevFormat(virBufferPtr buf, const virInterfaceDef *def, virInterfaceDefDevFormat(virBufferPtr buf,
const virInterfaceDef *def,
virInterfaceType parentIfType) virInterfaceType parentIfType)
{ {
const char *type = NULL; const char *type = NULL;
@ -1104,7 +1143,9 @@ virInterfaceDefDevFormat(virBufferPtr buf, const virInterfaceDef *def,
return -1; return -1;
} }
char *virInterfaceDefFormat(const virInterfaceDef *def)
char *
virInterfaceDefFormat(const virInterfaceDef *def)
{ {
virBuffer buf = VIR_BUFFER_INITIALIZER; virBuffer buf = VIR_BUFFER_INITIALIZER;

View File

@ -36,17 +36,22 @@ VIR_LOG_INIT("conf.virinterfaceobj");
/* virInterfaceObj manipulation */ /* virInterfaceObj manipulation */
void virInterfaceObjLock(virInterfaceObjPtr obj) void
virInterfaceObjLock(virInterfaceObjPtr obj)
{ {
virMutexLock(&obj->lock); virMutexLock(&obj->lock);
} }
void virInterfaceObjUnlock(virInterfaceObjPtr obj)
void
virInterfaceObjUnlock(virInterfaceObjPtr obj)
{ {
virMutexUnlock(&obj->lock); virMutexUnlock(&obj->lock);
} }
void virInterfaceObjFree(virInterfaceObjPtr iface)
void
virInterfaceObjFree(virInterfaceObjPtr iface)
{ {
if (!iface) if (!iface)
return; return;
@ -56,11 +61,12 @@ void virInterfaceObjFree(virInterfaceObjPtr iface)
VIR_FREE(iface); VIR_FREE(iface);
} }
/* virInterfaceObjList manipulation */
int virInterfaceFindByMACString(virInterfaceObjListPtr interfaces, /* virInterfaceObjList manipulation */
const char *mac, int
virInterfaceObjPtr *matches, int maxmatches) virInterfaceFindByMACString(virInterfaceObjListPtr interfaces,
const char *mac,
virInterfaceObjPtr *matches, int maxmatches)
{ {
size_t i; size_t i;
unsigned int matchct = 0; unsigned int matchct = 0;
@ -83,8 +89,10 @@ int virInterfaceFindByMACString(virInterfaceObjListPtr interfaces,
return matchct; return matchct;
} }
virInterfaceObjPtr virInterfaceFindByName(virInterfaceObjListPtr interfaces,
const char *name) virInterfaceObjPtr
virInterfaceFindByName(virInterfaceObjListPtr interfaces,
const char *name)
{ {
size_t i; size_t i;
@ -98,7 +106,9 @@ virInterfaceObjPtr virInterfaceFindByName(virInterfaceObjListPtr interfaces,
return NULL; return NULL;
} }
void virInterfaceObjListFree(virInterfaceObjListPtr interfaces)
void
virInterfaceObjListFree(virInterfaceObjListPtr interfaces)
{ {
size_t i; size_t i;
@ -109,8 +119,10 @@ void virInterfaceObjListFree(virInterfaceObjListPtr interfaces)
interfaces->count = 0; interfaces->count = 0;
} }
int virInterfaceObjListClone(virInterfaceObjListPtr src,
virInterfaceObjListPtr dest) int
virInterfaceObjListClone(virInterfaceObjListPtr src,
virInterfaceObjListPtr dest)
{ {
int ret = -1; int ret = -1;
size_t i; size_t i;
@ -148,8 +160,10 @@ int virInterfaceObjListClone(virInterfaceObjListPtr src,
return ret; return ret;
} }
virInterfaceObjPtr virInterfaceAssignDef(virInterfaceObjListPtr interfaces,
virInterfaceDefPtr def) virInterfaceObjPtr
virInterfaceAssignDef(virInterfaceObjListPtr interfaces,
virInterfaceDefPtr def)
{ {
virInterfaceObjPtr iface; virInterfaceObjPtr iface;
@ -181,8 +195,10 @@ virInterfaceObjPtr virInterfaceAssignDef(virInterfaceObjListPtr interfaces,
} }
void virInterfaceRemove(virInterfaceObjListPtr interfaces,
virInterfaceObjPtr iface) void
virInterfaceRemove(virInterfaceObjListPtr interfaces,
virInterfaceObjPtr iface)
{ {
size_t i; size_t i;