diff --git a/src/conf/interface_conf.c b/src/conf/interface_conf.c index dc2ddd48fc1729e04cd36bb966fc6a43f715490a..8c46cf52d6e08a2cf4d1c258e4a7d85936d18bea 100644 --- a/src/conf/interface_conf.c +++ b/src/conf/interface_conf.c @@ -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,8 +816,10 @@ virInterfaceDefParseXML(xmlXPathContextPtr ctxt, int parentIfType) return NULL; } -virInterfaceDefPtr virInterfaceDefParseNode(xmlDocPtr xml, - xmlNodePtr root) + +virInterfaceDefPtr +virInterfaceDefParseNode(xmlDocPtr xml, + xmlNodePtr root) { xmlXPathContextPtr ctxt = NULL; virInterfaceDefPtr def = 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; diff --git a/src/conf/virinterfaceobj.c b/src/conf/virinterfaceobj.c index 6c18911ff7d8bab0d5941610883556f946653fba..70f9001f9836b99653cd644ad929d7fbb4b01925 100644 --- a/src/conf/virinterfaceobj.c +++ b/src/conf/virinterfaceobj.c @@ -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,11 +61,12 @@ void virInterfaceObjFree(virInterfaceObjPtr iface) VIR_FREE(iface); } -/* virInterfaceObjList manipulation */ -int virInterfaceFindByMACString(virInterfaceObjListPtr interfaces, - const char *mac, - virInterfaceObjPtr *matches, int maxmatches) +/* virInterfaceObjList manipulation */ +int +virInterfaceFindByMACString(virInterfaceObjListPtr interfaces, + const char *mac, + virInterfaceObjPtr *matches, int maxmatches) { size_t i; unsigned int matchct = 0; @@ -83,8 +89,10 @@ int virInterfaceFindByMACString(virInterfaceObjListPtr interfaces, return matchct; } -virInterfaceObjPtr virInterfaceFindByName(virInterfaceObjListPtr interfaces, - const char *name) + +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,8 +119,10 @@ void virInterfaceObjListFree(virInterfaceObjListPtr interfaces) interfaces->count = 0; } -int virInterfaceObjListClone(virInterfaceObjListPtr src, - virInterfaceObjListPtr dest) + +int +virInterfaceObjListClone(virInterfaceObjListPtr src, + virInterfaceObjListPtr dest) { int ret = -1; size_t i; @@ -148,8 +160,10 @@ int virInterfaceObjListClone(virInterfaceObjListPtr src, return ret; } -virInterfaceObjPtr virInterfaceAssignDef(virInterfaceObjListPtr interfaces, - virInterfaceDefPtr def) + +virInterfaceObjPtr +virInterfaceAssignDef(virInterfaceObjListPtr interfaces, + virInterfaceDefPtr def) { 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;