提交 7e702a86 编写于 作者: J John Ferlan

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.
上级 eabeff8e
......@@ -40,12 +40,13 @@ VIR_ENUM_IMPL(virInterface,
static virInterfaceDefPtr
virInterfaceDefParseXML(xmlXPathContextPtr ctxt, int parentIfType);
static int
virInterfaceDefDevFormat(virBufferPtr buf, const virInterfaceDef *def,
virInterfaceType parentIfType);
static
void virInterfaceIPDefFree(virInterfaceIPDefPtr def)
static void
virInterfaceIPDefFree(virInterfaceIPDefPtr def)
{
if (def == NULL)
return;
......@@ -53,8 +54,9 @@ void virInterfaceIPDefFree(virInterfaceIPDefPtr def)
VIR_FREE(def);
}
static
void virInterfaceProtocolDefFree(virInterfaceProtocolDefPtr def)
static void
virInterfaceProtocolDefFree(virInterfaceProtocolDefPtr def)
{
size_t i;
......@@ -68,7 +70,9 @@ void virInterfaceProtocolDefFree(virInterfaceProtocolDefPtr def)
VIR_FREE(def);
}
void virInterfaceDefFree(virInterfaceDefPtr def)
void
virInterfaceDefFree(virInterfaceDefPtr def)
{
size_t i;
int pp;
......@@ -111,6 +115,7 @@ void virInterfaceDefFree(virInterfaceDefPtr def)
VIR_FREE(def);
}
static int
virInterfaceDefParseName(virInterfaceDefPtr def,
xmlXPathContextPtr ctxt)
......@@ -127,6 +132,7 @@ virInterfaceDefParseName(virInterfaceDefPtr def,
return 0;
}
static int
virInterfaceDefParseMtu(virInterfaceDefPtr def,
xmlXPathContextPtr ctxt)
......@@ -145,6 +151,7 @@ virInterfaceDefParseMtu(virInterfaceDefPtr def,
return 0;
}
static int
virInterfaceDefParseStartMode(virInterfaceDefPtr def,
xmlXPathContextPtr ctxt)
......@@ -170,6 +177,7 @@ virInterfaceDefParseStartMode(virInterfaceDefPtr def,
return 0;
}
static int
virInterfaceDefParseBondMode(xmlXPathContextPtr ctxt)
{
......@@ -202,6 +210,7 @@ virInterfaceDefParseBondMode(xmlXPathContextPtr ctxt)
return ret;
}
static int
virInterfaceDefParseBondMiiCarrier(xmlXPathContextPtr ctxt)
{
......@@ -224,6 +233,7 @@ virInterfaceDefParseBondMiiCarrier(xmlXPathContextPtr ctxt)
return ret;
}
static int
virInterfaceDefParseBondArpValid(xmlXPathContextPtr ctxt)
{
......@@ -248,6 +258,7 @@ virInterfaceDefParseBondArpValid(xmlXPathContextPtr ctxt)
return ret;
}
static int
virInterfaceDefParseDhcp(virInterfaceProtocolDefPtr def,
xmlNodePtr dhcp, xmlXPathContextPtr ctxt)
......@@ -280,6 +291,7 @@ virInterfaceDefParseDhcp(virInterfaceProtocolDefPtr def,
return ret;
}
static int
virInterfaceDefParseIP(virInterfaceIPDefPtr def,
xmlXPathContextPtr ctxt)
......@@ -304,6 +316,7 @@ virInterfaceDefParseIP(virInterfaceIPDefPtr def,
return 0;
}
static int
virInterfaceDefParseProtoIPv4(virInterfaceProtocolDefPtr def,
xmlXPathContextPtr ctxt)
......@@ -355,6 +368,7 @@ virInterfaceDefParseProtoIPv4(virInterfaceProtocolDefPtr def,
return ret;
}
static int
virInterfaceDefParseProtoIPv6(virInterfaceProtocolDefPtr def,
xmlXPathContextPtr ctxt)
......@@ -410,6 +424,7 @@ virInterfaceDefParseProtoIPv6(virInterfaceProtocolDefPtr def,
return ret;
}
static int
virInterfaceDefParseIfAdressing(virInterfaceDefPtr def,
xmlXPathContextPtr ctxt)
......@@ -480,6 +495,7 @@ virInterfaceDefParseIfAdressing(virInterfaceDefPtr def,
}
static int
virInterfaceDefParseBridge(virInterfaceDefPtr def,
xmlXPathContextPtr ctxt)
......@@ -539,6 +555,7 @@ virInterfaceDefParseBridge(virInterfaceDefPtr def,
return ret;
}
static int
virInterfaceDefParseBondItfs(virInterfaceDefPtr def,
xmlXPathContextPtr ctxt)
......@@ -581,6 +598,7 @@ virInterfaceDefParseBondItfs(virInterfaceDefPtr def,
return ret;
}
static int
virInterfaceDefParseBond(virInterfaceDefPtr def,
xmlXPathContextPtr ctxt)
......@@ -653,6 +671,7 @@ virInterfaceDefParseBond(virInterfaceDefPtr def,
return 0;
}
static int
virInterfaceDefParseVlan(virInterfaceDefPtr def,
xmlXPathContextPtr ctxt)
......@@ -674,8 +693,10 @@ virInterfaceDefParseVlan(virInterfaceDefPtr def,
return 0;
}
static virInterfaceDefPtr
virInterfaceDefParseXML(xmlXPathContextPtr ctxt, int parentIfType)
virInterfaceDefParseXML(xmlXPathContextPtr ctxt,
int parentIfType)
{
virInterfaceDefPtr def;
int type;
......@@ -795,7 +816,9 @@ virInterfaceDefParseXML(xmlXPathContextPtr ctxt, int parentIfType)
return NULL;
}
virInterfaceDefPtr virInterfaceDefParseNode(xmlDocPtr xml,
virInterfaceDefPtr
virInterfaceDefParseNode(xmlDocPtr xml,
xmlNodePtr root)
{
xmlXPathContextPtr ctxt = NULL;
......@@ -823,6 +846,7 @@ virInterfaceDefPtr virInterfaceDefParseNode(xmlDocPtr xml,
return def;
}
static virInterfaceDefPtr
virInterfaceDefParse(const char *xmlStr,
const char *filename)
......@@ -838,18 +862,24 @@ virInterfaceDefParse(const char *xmlStr,
return def;
}
virInterfaceDefPtr virInterfaceDefParseString(const char *xmlStr)
virInterfaceDefPtr
virInterfaceDefParseString(const char *xmlStr)
{
return virInterfaceDefParse(xmlStr, NULL);
}
virInterfaceDefPtr virInterfaceDefParseFile(const char *filename)
virInterfaceDefPtr
virInterfaceDefParseFile(const char *filename)
{
return virInterfaceDefParse(NULL, filename);
}
static int
virInterfaceBridgeDefFormat(virBufferPtr buf, const virInterfaceDef *def)
virInterfaceBridgeDefFormat(virBufferPtr buf,
const virInterfaceDef *def)
{
size_t i;
int ret = 0;
......@@ -875,8 +905,10 @@ virInterfaceBridgeDefFormat(virBufferPtr buf, const virInterfaceDef *def)
return ret;
}
static int
virInterfaceBondDefFormat(virBufferPtr buf, const virInterfaceDef *def)
virInterfaceBondDefFormat(virBufferPtr buf,
const virInterfaceDef *def)
{
size_t i;
int ret = 0;
......@@ -938,8 +970,10 @@ virInterfaceBondDefFormat(virBufferPtr buf, const virInterfaceDef *def)
return ret;
}
static int
virInterfaceVlanDefFormat(virBufferPtr buf, const virInterfaceDef *def)
virInterfaceVlanDefFormat(virBufferPtr buf,
const virInterfaceDef *def)
{
if (def->data.vlan.tag == NULL) {
virReportError(VIR_ERR_INTERNAL_ERROR,
......@@ -961,8 +995,10 @@ virInterfaceVlanDefFormat(virBufferPtr buf, const virInterfaceDef *def)
return 0;
}
static int
virInterfaceProtocolDefFormat(virBufferPtr buf, const virInterfaceDef *def)
virInterfaceProtocolDefFormat(virBufferPtr buf,
const virInterfaceDef *def)
{
size_t i, j;
......@@ -1006,6 +1042,7 @@ virInterfaceProtocolDefFormat(virBufferPtr buf, const virInterfaceDef *def)
return 0;
}
static int
virInterfaceStartmodeDefFormat(virBufferPtr buf,
virInterfaceStartMode startmode)
......@@ -1032,8 +1069,10 @@ virInterfaceStartmodeDefFormat(virBufferPtr buf,
return 0;
}
static int
virInterfaceDefDevFormat(virBufferPtr buf, const virInterfaceDef *def,
virInterfaceDefDevFormat(virBufferPtr buf,
const virInterfaceDef *def,
virInterfaceType parentIfType)
{
const char *type = NULL;
......@@ -1104,7 +1143,9 @@ virInterfaceDefDevFormat(virBufferPtr buf, const virInterfaceDef *def,
return -1;
}
char *virInterfaceDefFormat(const virInterfaceDef *def)
char *
virInterfaceDefFormat(const virInterfaceDef *def)
{
virBuffer buf = VIR_BUFFER_INITIALIZER;
......
......@@ -36,17 +36,22 @@ VIR_LOG_INIT("conf.virinterfaceobj");
/* virInterfaceObj manipulation */
void virInterfaceObjLock(virInterfaceObjPtr obj)
void
virInterfaceObjLock(virInterfaceObjPtr obj)
{
virMutexLock(&obj->lock);
}
void virInterfaceObjUnlock(virInterfaceObjPtr obj)
void
virInterfaceObjUnlock(virInterfaceObjPtr obj)
{
virMutexUnlock(&obj->lock);
}
void virInterfaceObjFree(virInterfaceObjPtr iface)
void
virInterfaceObjFree(virInterfaceObjPtr iface)
{
if (!iface)
return;
......@@ -56,9 +61,10 @@ void virInterfaceObjFree(virInterfaceObjPtr iface)
VIR_FREE(iface);
}
/* virInterfaceObjList manipulation */
int virInterfaceFindByMACString(virInterfaceObjListPtr interfaces,
/* virInterfaceObjList manipulation */
int
virInterfaceFindByMACString(virInterfaceObjListPtr interfaces,
const char *mac,
virInterfaceObjPtr *matches, int maxmatches)
{
......@@ -83,7 +89,9 @@ int virInterfaceFindByMACString(virInterfaceObjListPtr interfaces,
return matchct;
}
virInterfaceObjPtr virInterfaceFindByName(virInterfaceObjListPtr interfaces,
virInterfaceObjPtr
virInterfaceFindByName(virInterfaceObjListPtr interfaces,
const char *name)
{
size_t i;
......@@ -98,7 +106,9 @@ virInterfaceObjPtr virInterfaceFindByName(virInterfaceObjListPtr interfaces,
return NULL;
}
void virInterfaceObjListFree(virInterfaceObjListPtr interfaces)
void
virInterfaceObjListFree(virInterfaceObjListPtr interfaces)
{
size_t i;
......@@ -109,7 +119,9 @@ void virInterfaceObjListFree(virInterfaceObjListPtr interfaces)
interfaces->count = 0;
}
int virInterfaceObjListClone(virInterfaceObjListPtr src,
int
virInterfaceObjListClone(virInterfaceObjListPtr src,
virInterfaceObjListPtr dest)
{
int ret = -1;
......@@ -148,7 +160,9 @@ int virInterfaceObjListClone(virInterfaceObjListPtr src,
return ret;
}
virInterfaceObjPtr virInterfaceAssignDef(virInterfaceObjListPtr interfaces,
virInterfaceObjPtr
virInterfaceAssignDef(virInterfaceObjListPtr interfaces,
virInterfaceDefPtr def)
{
virInterfaceObjPtr iface;
......@@ -181,7 +195,9 @@ virInterfaceObjPtr virInterfaceAssignDef(virInterfaceObjListPtr interfaces,
}
void virInterfaceRemove(virInterfaceObjListPtr interfaces,
void
virInterfaceRemove(virInterfaceObjListPtr interfaces,
virInterfaceObjPtr iface)
{
size_t i;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册