network: Adjust coding style for network 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-08 10:41:57 -05:00
parent bddbda99df
commit 0cf145b67e
2 changed files with 151 additions and 39 deletions

View File

@ -80,6 +80,7 @@ virPortGroupDefClear(virPortGroupDefPtr def)
def->bandwidth = NULL; def->bandwidth = NULL;
} }
static void static void
virNetworkForwardIfDefClear(virNetworkForwardIfDefPtr def) virNetworkForwardIfDefClear(virNetworkForwardIfDefPtr def)
{ {
@ -87,12 +88,14 @@ virNetworkForwardIfDefClear(virNetworkForwardIfDefPtr def)
VIR_FREE(def->device.dev); VIR_FREE(def->device.dev);
} }
static void static void
virNetworkForwardPfDefClear(virNetworkForwardPfDefPtr def) virNetworkForwardPfDefClear(virNetworkForwardPfDefPtr def)
{ {
VIR_FREE(def->dev); VIR_FREE(def->dev);
} }
static void static void
virNetworkDHCPHostDefClear(virNetworkDHCPHostDefPtr def) virNetworkDHCPHostDefClear(virNetworkDHCPHostDefPtr def)
{ {
@ -101,6 +104,7 @@ virNetworkDHCPHostDefClear(virNetworkDHCPHostDefPtr def)
VIR_FREE(def->name); VIR_FREE(def->name);
} }
static void static void
virNetworkIPDefClear(virNetworkIPDefPtr def) virNetworkIPDefClear(virNetworkIPDefPtr def)
{ {
@ -115,6 +119,7 @@ virNetworkIPDefClear(virNetworkIPDefPtr def)
VIR_FREE(def->bootfile); VIR_FREE(def->bootfile);
} }
static void static void
virNetworkDNSTxtDefClear(virNetworkDNSTxtDefPtr def) virNetworkDNSTxtDefClear(virNetworkDNSTxtDefPtr def)
{ {
@ -122,6 +127,7 @@ virNetworkDNSTxtDefClear(virNetworkDNSTxtDefPtr def)
VIR_FREE(def->value); VIR_FREE(def->value);
} }
static void static void
virNetworkDNSHostDefClear(virNetworkDNSHostDefPtr def) virNetworkDNSHostDefClear(virNetworkDNSHostDefPtr def)
{ {
@ -130,6 +136,7 @@ virNetworkDNSHostDefClear(virNetworkDNSHostDefPtr def)
VIR_FREE(def->names); VIR_FREE(def->names);
} }
static void static void
virNetworkDNSSrvDefClear(virNetworkDNSSrvDefPtr def) virNetworkDNSSrvDefClear(virNetworkDNSSrvDefPtr def)
{ {
@ -172,6 +179,7 @@ virNetworkDNSDefClear(virNetworkDNSDefPtr def)
} }
} }
static void static void
virNetworkForwardDefClear(virNetworkForwardDefPtr def) virNetworkForwardDefClear(virNetworkForwardDefPtr def)
{ {
@ -187,6 +195,7 @@ virNetworkForwardDefClear(virNetworkForwardDefPtr def)
def->nifs = def->npfs = 0; def->nifs = def->npfs = 0;
} }
void void
virNetworkDefFree(virNetworkDefPtr def) virNetworkDefFree(virNetworkDefPtr def)
{ {
@ -225,6 +234,7 @@ virNetworkDefFree(virNetworkDefPtr def)
VIR_FREE(def); VIR_FREE(def);
} }
/* /*
* virNetworkDefCopy: * virNetworkDefCopy:
* @def: NetworkDef to copy * @def: NetworkDef to copy
@ -255,10 +265,12 @@ virNetworkDefCopy(virNetworkDefPtr def, unsigned int flags)
return newDef; return newDef;
} }
/* return ips[index], or NULL if there aren't enough ips */ /* return ips[index], or NULL if there aren't enough ips */
virNetworkIPDefPtr virNetworkIPDefPtr
virNetworkDefGetIPByIndex(const virNetworkDef *def, virNetworkDefGetIPByIndex(const virNetworkDef *def,
int family, size_t n) int family,
size_t n)
{ {
size_t i; size_t i;
@ -279,10 +291,12 @@ virNetworkDefGetIPByIndex(const virNetworkDef *def,
return NULL; return NULL;
} }
/* return routes[index], or NULL if there aren't enough routes */ /* return routes[index], or NULL if there aren't enough routes */
virNetDevIPRoutePtr virNetDevIPRoutePtr
virNetworkDefGetRouteByIndex(const virNetworkDef *def, virNetworkDefGetRouteByIndex(const virNetworkDef *def,
int family, size_t n) int family,
size_t n)
{ {
size_t i; size_t i;
@ -305,16 +319,19 @@ virNetworkDefGetRouteByIndex(const virNetworkDef *def,
return NULL; return NULL;
} }
/* return number of 1 bits in netmask for the network's ipAddress, /* return number of 1 bits in netmask for the network's ipAddress,
* or -1 on error * or -1 on error
*/ */
int virNetworkIPDefPrefix(const virNetworkIPDef *def) int
virNetworkIPDefPrefix(const virNetworkIPDef *def)
{ {
return virSocketAddrGetIPPrefix(&def->address, return virSocketAddrGetIPPrefix(&def->address,
&def->netmask, &def->netmask,
def->prefix); def->prefix);
} }
/* Fill in a virSocketAddr with the proper netmask for this /* Fill in a virSocketAddr with the proper netmask for this
* definition, based on either the definition's netmask, or its * definition, based on either the definition's netmask, or its
* prefix. Return -1 on error (and set the netmask family to AF_UNSPEC) * prefix. Return -1 on error (and set the netmask family to AF_UNSPEC)
@ -374,6 +391,7 @@ virSocketAddrRangeParseXML(const char *networkName,
return ret; return ret;
} }
static int static int
virNetworkDHCPHostDefParseXML(const char *networkName, virNetworkDHCPHostDefParseXML(const char *networkName,
virNetworkIPDefPtr def, virNetworkIPDefPtr def,
@ -494,6 +512,7 @@ virNetworkDHCPHostDefParseXML(const char *networkName,
return ret; return ret;
} }
static int static int
virNetworkDHCPDefParseXML(const char *networkName, virNetworkDHCPDefParseXML(const char *networkName,
xmlNodePtr node, xmlNodePtr node,
@ -561,6 +580,7 @@ virNetworkDHCPDefParseXML(const char *networkName,
return ret; return ret;
} }
static int static int
virNetworkDNSHostDefParseXML(const char *networkName, virNetworkDNSHostDefParseXML(const char *networkName,
xmlNodePtr node, xmlNodePtr node,
@ -628,6 +648,7 @@ virNetworkDNSHostDefParseXML(const char *networkName,
return -1; return -1;
} }
/* This includes all characters used in the names of current /* This includes all characters used in the names of current
* /etc/services and /etc/protocols files (on Fedora 20), except ".", * /etc/services and /etc/protocols files (on Fedora 20), except ".",
* which we can't allow because it would conflict with the use of "." * which we can't allow because it would conflict with the use of "."
@ -755,6 +776,7 @@ virNetworkDNSSrvDefParseXML(const char *networkName,
return -1; return -1;
} }
static int static int
virNetworkDNSTxtDefParseXML(const char *networkName, virNetworkDNSTxtDefParseXML(const char *networkName,
xmlNodePtr node, xmlNodePtr node,
@ -795,6 +817,7 @@ virNetworkDNSTxtDefParseXML(const char *networkName,
return -1; return -1;
} }
static int static int
virNetworkDNSDefParseXML(const char *networkName, virNetworkDNSDefParseXML(const char *networkName,
xmlNodePtr node, xmlNodePtr node,
@ -953,6 +976,7 @@ virNetworkDNSDefParseXML(const char *networkName,
return ret; return ret;
} }
static int static int
virNetworkIPDefParseXML(const char *networkName, virNetworkIPDefParseXML(const char *networkName,
xmlNodePtr node, xmlNodePtr node,
@ -1108,6 +1132,7 @@ virNetworkIPDefParseXML(const char *networkName,
return result; return result;
} }
static int static int
virNetworkPortGroupParseXML(virPortGroupDefPtr def, virNetworkPortGroupParseXML(virPortGroupDefPtr def,
xmlNodePtr node, xmlNodePtr node,
@ -1179,6 +1204,7 @@ virNetworkPortGroupParseXML(virPortGroupDefPtr def,
return result; return result;
} }
static int static int
virNetworkForwardNatDefParseXML(const char *networkName, virNetworkForwardNatDefParseXML(const char *networkName,
xmlNodePtr node, xmlNodePtr node,
@ -1307,6 +1333,7 @@ virNetworkForwardNatDefParseXML(const char *networkName,
return ret; return ret;
} }
static int static int
virNetworkForwardDefParseXML(const char *networkName, virNetworkForwardDefParseXML(const char *networkName,
xmlNodePtr node, xmlNodePtr node,
@ -1555,6 +1582,7 @@ virNetworkForwardDefParseXML(const char *networkName,
return ret; return ret;
} }
virNetworkDefPtr virNetworkDefPtr
virNetworkDefParseXML(xmlXPathContextPtr ctxt) virNetworkDefParseXML(xmlXPathContextPtr ctxt)
{ {
@ -1966,6 +1994,7 @@ virNetworkDefParseXML(xmlXPathContextPtr ctxt)
return NULL; return NULL;
} }
static virNetworkDefPtr static virNetworkDefPtr
virNetworkDefParse(const char *xmlStr, virNetworkDefParse(const char *xmlStr,
const char *filename) const char *filename)
@ -1983,18 +2012,23 @@ virNetworkDefParse(const char *xmlStr,
return def; return def;
} }
virNetworkDefPtr virNetworkDefParseString(const char *xmlStr)
virNetworkDefPtr
virNetworkDefParseString(const char *xmlStr)
{ {
return virNetworkDefParse(xmlStr, NULL); return virNetworkDefParse(xmlStr, NULL);
} }
virNetworkDefPtr virNetworkDefParseFile(const char *filename)
virNetworkDefPtr
virNetworkDefParseFile(const char *filename)
{ {
return virNetworkDefParse(NULL, filename); return virNetworkDefParse(NULL, filename);
} }
virNetworkDefPtr virNetworkDefParseNode(xmlDocPtr xml, virNetworkDefPtr
virNetworkDefParseNode(xmlDocPtr xml,
xmlNodePtr root) xmlNodePtr root)
{ {
xmlXPathContextPtr ctxt = NULL; xmlXPathContextPtr ctxt = NULL;
@ -2129,6 +2163,7 @@ virNetworkDNSDefFormat(virBufferPtr buf,
return 0; return 0;
} }
static int static int
virNetworkIPDefFormat(virBufferPtr buf, virNetworkIPDefFormat(virBufferPtr buf,
const virNetworkIPDef *def) const virNetworkIPDef *def)
@ -2230,6 +2265,7 @@ virNetworkIPDefFormat(virBufferPtr buf,
return result; return result;
} }
static int static int
virPortGroupDefFormat(virBufferPtr buf, virPortGroupDefFormat(virBufferPtr buf,
const virPortGroupDef *def) const virPortGroupDef *def)
@ -2252,6 +2288,7 @@ virPortGroupDefFormat(virBufferPtr buf,
return 0; return 0;
} }
static int static int
virNetworkForwardNatDefFormat(virBufferPtr buf, virNetworkForwardNatDefFormat(virBufferPtr buf,
const virNetworkForwardDef *fwd) const virNetworkForwardDef *fwd)
@ -2302,6 +2339,7 @@ virNetworkForwardNatDefFormat(virBufferPtr buf,
return ret; return ret;
} }
int int
virNetworkDefFormatBuf(virBufferPtr buf, virNetworkDefFormatBuf(virBufferPtr buf,
const virNetworkDef *def, const virNetworkDef *def,
@ -2516,6 +2554,7 @@ virNetworkDefFormatBuf(virBufferPtr buf,
return -1; return -1;
} }
char * char *
virNetworkDefFormat(const virNetworkDef *def, virNetworkDefFormat(const virNetworkDef *def,
unsigned int flags) unsigned int flags)
@ -2535,15 +2574,19 @@ virNetworkDefFormat(const virNetworkDef *def,
return NULL; return NULL;
} }
const char * const char *
virNetworkDefForwardIf(const virNetworkDef *def, size_t n) virNetworkDefForwardIf(const virNetworkDef *def,
size_t n)
{ {
return ((def->forward.ifs && (def->forward.nifs > n) && return ((def->forward.ifs && (def->forward.nifs > n) &&
def->forward.ifs[n].type == VIR_NETWORK_FORWARD_HOSTDEV_DEVICE_NETDEV) def->forward.ifs[n].type == VIR_NETWORK_FORWARD_HOSTDEV_DEVICE_NETDEV)
? def->forward.ifs[n].device.dev : NULL); ? def->forward.ifs[n].device.dev : NULL);
} }
virPortGroupDefPtr virPortGroupFindByName(virNetworkDefPtr net,
virPortGroupDefPtr
virPortGroupFindByName(virNetworkDefPtr net,
const char *portgroup) const char *portgroup)
{ {
size_t i; size_t i;
@ -2559,7 +2602,9 @@ virPortGroupDefPtr virPortGroupFindByName(virNetworkDefPtr net,
return NULL; return NULL;
} }
int virNetworkSaveXML(const char *configDir,
int
virNetworkSaveXML(const char *configDir,
virNetworkDefPtr def, virNetworkDefPtr def,
const char *xml) const char *xml)
{ {
@ -2587,7 +2632,9 @@ int virNetworkSaveXML(const char *configDir,
return ret; return ret;
} }
int virNetworkSaveConfig(const char *configDir,
int
virNetworkSaveConfig(const char *configDir,
virNetworkDefPtr def) virNetworkDefPtr def)
{ {
int ret = -1; int ret = -1;
@ -2605,7 +2652,9 @@ int virNetworkSaveConfig(const char *configDir,
return ret; return ret;
} }
char *virNetworkConfigFile(const char *dir,
char *
virNetworkConfigFile(const char *dir,
const char *name) const char *name)
{ {
char *ret = NULL; char *ret = NULL;
@ -2614,7 +2663,9 @@ char *virNetworkConfigFile(const char *dir,
return ret; return ret;
} }
void virNetworkSetBridgeMacAddr(virNetworkDefPtr def)
void
virNetworkSetBridgeMacAddr(virNetworkDefPtr def)
{ {
if (!def->mac_specified) { if (!def->mac_specified) {
/* if the bridge doesn't have a mac address explicitly defined, /* if the bridge doesn't have a mac address explicitly defined,
@ -2626,6 +2677,7 @@ void virNetworkSetBridgeMacAddr(virNetworkDefPtr def)
} }
} }
/* NetworkObj backend of the virNetworkUpdate API */ /* NetworkObj backend of the virNetworkUpdate API */
static void static void
@ -2636,6 +2688,7 @@ virNetworkDefUpdateNoSupport(virNetworkDefPtr def, const char *section)
section, def->name); section, def->name);
} }
static void static void
virNetworkDefUpdateUnknownCommand(unsigned int command) virNetworkDefUpdateUnknownCommand(unsigned int command)
{ {
@ -2643,6 +2696,7 @@ virNetworkDefUpdateUnknownCommand(unsigned int command)
_("unrecognized network update command code %d"), command); _("unrecognized network update command code %d"), command);
} }
static int static int
virNetworkDefUpdateCheckElementName(virNetworkDefPtr def, virNetworkDefUpdateCheckElementName(virNetworkDefPtr def,
xmlNodePtr node, xmlNodePtr node,
@ -2658,6 +2712,7 @@ virNetworkDefUpdateCheckElementName(virNetworkDefPtr def,
return 0; return 0;
} }
static int static int
virNetworkDefUpdateBridge(virNetworkDefPtr def, virNetworkDefUpdateBridge(virNetworkDefPtr def,
unsigned int command ATTRIBUTE_UNUSED, unsigned int command ATTRIBUTE_UNUSED,
@ -2670,6 +2725,7 @@ virNetworkDefUpdateBridge(virNetworkDefPtr def,
return -1; return -1;
} }
static int static int
virNetworkDefUpdateDomain(virNetworkDefPtr def, virNetworkDefUpdateDomain(virNetworkDefPtr def,
unsigned int command ATTRIBUTE_UNUSED, unsigned int command ATTRIBUTE_UNUSED,
@ -2682,6 +2738,7 @@ virNetworkDefUpdateDomain(virNetworkDefPtr def,
return -1; return -1;
} }
static int static int
virNetworkDefUpdateIP(virNetworkDefPtr def, virNetworkDefUpdateIP(virNetworkDefPtr def,
unsigned int command ATTRIBUTE_UNUSED, unsigned int command ATTRIBUTE_UNUSED,
@ -2694,6 +2751,7 @@ virNetworkDefUpdateIP(virNetworkDefPtr def,
return -1; return -1;
} }
static virNetworkIPDefPtr static virNetworkIPDefPtr
virNetworkIPDefByIndex(virNetworkDefPtr def, int parentIndex) virNetworkIPDefByIndex(virNetworkDefPtr def, int parentIndex)
{ {
@ -2897,6 +2955,7 @@ virNetworkDefUpdateIPDHCPHost(virNetworkDefPtr def,
return ret; return ret;
} }
static int static int
virNetworkDefUpdateIPDHCPRange(virNetworkDefPtr def, virNetworkDefUpdateIPDHCPRange(virNetworkDefPtr def,
unsigned int command, unsigned int command,
@ -2998,6 +3057,7 @@ virNetworkDefUpdateIPDHCPRange(virNetworkDefPtr def,
return ret; return ret;
} }
static int static int
virNetworkDefUpdateForward(virNetworkDefPtr def, virNetworkDefUpdateForward(virNetworkDefPtr def,
unsigned int command ATTRIBUTE_UNUSED, unsigned int command ATTRIBUTE_UNUSED,
@ -3010,6 +3070,7 @@ virNetworkDefUpdateForward(virNetworkDefPtr def,
return -1; return -1;
} }
static int static int
virNetworkDefUpdateForwardInterface(virNetworkDefPtr def, virNetworkDefUpdateForwardInterface(virNetworkDefPtr def,
unsigned int command, unsigned int command,
@ -3104,6 +3165,7 @@ virNetworkDefUpdateForwardInterface(virNetworkDefPtr def,
return ret; return ret;
} }
static int static int
virNetworkDefUpdateForwardPF(virNetworkDefPtr def, virNetworkDefUpdateForwardPF(virNetworkDefPtr def,
unsigned int command ATTRIBUTE_UNUSED, unsigned int command ATTRIBUTE_UNUSED,
@ -3116,6 +3178,7 @@ virNetworkDefUpdateForwardPF(virNetworkDefPtr def,
return -1; return -1;
} }
static int static int
virNetworkDefUpdatePortGroup(virNetworkDefPtr def, virNetworkDefUpdatePortGroup(virNetworkDefPtr def,
unsigned int command, unsigned int command,
@ -3210,6 +3273,7 @@ virNetworkDefUpdatePortGroup(virNetworkDefPtr def,
return ret; return ret;
} }
static int static int
virNetworkDefUpdateDNSHost(virNetworkDefPtr def, virNetworkDefUpdateDNSHost(virNetworkDefPtr def,
unsigned int command ATTRIBUTE_UNUSED, unsigned int command ATTRIBUTE_UNUSED,
@ -3304,6 +3368,7 @@ virNetworkDefUpdateDNSHost(virNetworkDefPtr def,
return ret; return ret;
} }
static int static int
virNetworkDefUpdateDNSSrv(virNetworkDefPtr def, virNetworkDefUpdateDNSSrv(virNetworkDefPtr def,
unsigned int command ATTRIBUTE_UNUSED, unsigned int command ATTRIBUTE_UNUSED,
@ -3390,6 +3455,7 @@ virNetworkDefUpdateDNSSrv(virNetworkDefPtr def,
return ret; return ret;
} }
static int static int
virNetworkDefUpdateDNSTxt(virNetworkDefPtr def, virNetworkDefUpdateDNSTxt(virNetworkDefPtr def,
unsigned int command ATTRIBUTE_UNUSED, unsigned int command ATTRIBUTE_UNUSED,
@ -3463,6 +3529,7 @@ virNetworkDefUpdateDNSTxt(virNetworkDefPtr def,
return ret; return ret;
} }
int int
virNetworkDefUpdateSection(virNetworkDefPtr def, virNetworkDefUpdateSection(virNetworkDefPtr def,
unsigned int command, /* virNetworkUpdateCommand */ unsigned int command, /* virNetworkUpdateCommand */

View File

@ -48,7 +48,8 @@ static virClassPtr virNetworkObjListClass;
static void virNetworkObjDispose(void *obj); static void virNetworkObjDispose(void *obj);
static void virNetworkObjListDispose(void *obj); static void virNetworkObjListDispose(void *obj);
static int virNetworkObjOnceInit(void) static int
virNetworkObjOnceInit(void)
{ {
if (!(virNetworkObjClass = virClassNew(virClassForObjectLockable(), if (!(virNetworkObjClass = virClassNew(virClassForObjectLockable(),
"virNetworkObj", "virNetworkObj",
@ -93,6 +94,7 @@ virNetworkObjNew(void)
return NULL; return NULL;
} }
void void
virNetworkObjEndAPI(virNetworkObjPtr *net) virNetworkObjEndAPI(virNetworkObjPtr *net)
{ {
@ -104,7 +106,9 @@ virNetworkObjEndAPI(virNetworkObjPtr *net)
*net = NULL; *net = NULL;
} }
virNetworkObjListPtr virNetworkObjListNew(void)
virNetworkObjListPtr
virNetworkObjListNew(void)
{ {
virNetworkObjListPtr nets; virNetworkObjListPtr nets;
@ -122,6 +126,7 @@ virNetworkObjListPtr virNetworkObjListNew(void)
return nets; return nets;
} }
/** /**
* virNetworkObjFindByUUIDLocked: * virNetworkObjFindByUUIDLocked:
* @nets: list of network objects * @nets: list of network objects
@ -146,6 +151,7 @@ virNetworkObjFindByUUIDLocked(virNetworkObjListPtr nets,
return ret; return ret;
} }
/** /**
* virNetworkObjFindByUUID: * virNetworkObjFindByUUID:
* @nets: list of network objects * @nets: list of network objects
@ -170,6 +176,7 @@ virNetworkObjFindByUUID(virNetworkObjListPtr nets,
return ret; return ret;
} }
static int static int
virNetworkObjSearchName(const void *payload, virNetworkObjSearchName(const void *payload,
const void *name ATTRIBUTE_UNUSED, const void *name ATTRIBUTE_UNUSED,
@ -185,6 +192,7 @@ virNetworkObjSearchName(const void *payload,
return want; return want;
} }
/* /*
* virNetworkObjFindByNameLocked: * virNetworkObjFindByNameLocked:
* @nets: list of network objects * @nets: list of network objects
@ -206,6 +214,7 @@ virNetworkObjFindByNameLocked(virNetworkObjListPtr nets,
return ret; return ret;
} }
/** /**
* virNetworkObjFindByName: * virNetworkObjFindByName:
* @nets: list of network objects * @nets: list of network objects
@ -230,6 +239,7 @@ virNetworkObjFindByName(virNetworkObjListPtr nets,
return ret; return ret;
} }
bool bool
virNetworkObjTaint(virNetworkObjPtr obj, virNetworkObjTaint(virNetworkObjPtr obj,
virNetworkTaintFlags taint) virNetworkTaintFlags taint)
@ -255,6 +265,7 @@ virNetworkObjDispose(void *obj)
virObjectUnref(net->macmap); virObjectUnref(net->macmap);
} }
static void static void
virNetworkObjListDispose(void *obj) virNetworkObjListDispose(void *obj)
{ {
@ -263,6 +274,7 @@ virNetworkObjListDispose(void *obj)
virHashFree(nets->objs); virHashFree(nets->objs);
} }
/* /*
* virNetworkObjAssignDef: * virNetworkObjAssignDef:
* @network: the network object to update * @network: the network object to update
@ -324,6 +336,7 @@ virNetworkObjAssignDef(virNetworkObjPtr network,
} }
} }
/* /*
* If flags & VIR_NETWORK_OBJ_LIST_ADD_CHECK_LIVE then this will * If flags & VIR_NETWORK_OBJ_LIST_ADD_CHECK_LIVE then this will
* refuse updating an existing def if the current def is live * refuse updating an existing def if the current def is live
@ -401,6 +414,7 @@ virNetworkAssignDefLocked(virNetworkObjListPtr nets,
return ret; return ret;
} }
/* /*
* virNetworkAssignDef: * virNetworkAssignDef:
* @nets: list of all networks * @nets: list of all networks
@ -429,6 +443,7 @@ virNetworkAssignDef(virNetworkObjListPtr nets,
return network; return network;
} }
/* /*
* virNetworkObjSetDefTransient: * virNetworkObjSetDefTransient:
* @network: network object pointer * @network: network object pointer
@ -444,7 +459,8 @@ virNetworkAssignDef(virNetworkObjListPtr nets,
* Returns 0 on success, -1 on failure * Returns 0 on success, -1 on failure
*/ */
int int
virNetworkObjSetDefTransient(virNetworkObjPtr network, bool live) virNetworkObjSetDefTransient(virNetworkObjPtr network,
bool live)
{ {
if (!virNetworkObjIsActive(network) && !live) if (!virNetworkObjIsActive(network) && !live)
return 0; return 0;
@ -456,6 +472,7 @@ virNetworkObjSetDefTransient(virNetworkObjPtr network, bool live)
return network->newDef ? 0 : -1; return network->newDef ? 0 : -1;
} }
/* virNetworkObjUnsetDefTransient: /* virNetworkObjUnsetDefTransient:
* *
* This *undoes* what virNetworkObjSetDefTransient did. * This *undoes* what virNetworkObjSetDefTransient did.
@ -470,6 +487,7 @@ virNetworkObjUnsetDefTransient(virNetworkObjPtr network)
} }
} }
/* /*
* virNetworkObjGetPersistentDef: * virNetworkObjGetPersistentDef:
* @network: network object pointer * @network: network object pointer
@ -488,6 +506,7 @@ virNetworkObjGetPersistentDef(virNetworkObjPtr network)
return network->def; return network->def;
} }
/* /*
* virNetworkObjReplacePersistentDef: * virNetworkObjReplacePersistentDef:
* @network: network object pointer * @network: network object pointer
@ -513,6 +532,7 @@ virNetworkObjReplacePersistentDef(virNetworkObjPtr network,
return 0; return 0;
} }
/* /*
* virNetworkConfigChangeSetup: * virNetworkConfigChangeSetup:
* *
@ -525,7 +545,8 @@ virNetworkObjReplacePersistentDef(virNetworkObjPtr network,
* Returns 0 on success, -1 on error. * Returns 0 on success, -1 on error.
*/ */
int int
virNetworkConfigChangeSetup(virNetworkObjPtr network, unsigned int flags) virNetworkConfigChangeSetup(virNetworkObjPtr network,
unsigned int flags)
{ {
bool isActive; bool isActive;
int ret = -1; int ret = -1;
@ -557,7 +578,9 @@ virNetworkConfigChangeSetup(virNetworkObjPtr network, unsigned int flags)
return ret; return ret;
} }
void virNetworkRemoveInactive(virNetworkObjListPtr nets,
void
virNetworkRemoveInactive(virNetworkObjListPtr nets,
virNetworkObjPtr net) virNetworkObjPtr net)
{ {
char uuidstr[VIR_UUID_STRING_BUFLEN]; char uuidstr[VIR_UUID_STRING_BUFLEN];
@ -572,6 +595,7 @@ void virNetworkRemoveInactive(virNetworkObjListPtr nets,
virObjectUnref(net); virObjectUnref(net);
} }
static char * static char *
virNetworkObjFormat(virNetworkObjPtr net, virNetworkObjFormat(virNetworkObjPtr net,
unsigned int flags) unsigned int flags)
@ -611,7 +635,9 @@ virNetworkObjFormat(virNetworkObjPtr net,
return NULL; return NULL;
} }
int virNetworkSaveStatus(const char *statusDir,
int
virNetworkSaveStatus(const char *statusDir,
virNetworkObjPtr network) virNetworkObjPtr network)
{ {
int ret = -1; int ret = -1;
@ -630,6 +656,7 @@ int virNetworkSaveStatus(const char *statusDir,
return ret; return ret;
} }
virNetworkObjPtr virNetworkObjPtr
virNetworkLoadState(virNetworkObjListPtr nets, virNetworkLoadState(virNetworkObjListPtr nets,
const char *stateDir, const char *stateDir,
@ -754,7 +781,9 @@ virNetworkLoadState(virNetworkObjListPtr nets,
goto cleanup; goto cleanup;
} }
virNetworkObjPtr virNetworkLoadConfig(virNetworkObjListPtr nets,
virNetworkObjPtr
virNetworkLoadConfig(virNetworkObjListPtr nets,
const char *configDir, const char *configDir,
const char *autostartDir, const char *autostartDir,
const char *name) const char *name)
@ -843,7 +872,8 @@ virNetworkLoadAllState(virNetworkObjListPtr nets,
} }
int virNetworkLoadAllConfigs(virNetworkObjListPtr nets, int
virNetworkLoadAllConfigs(virNetworkObjListPtr nets,
const char *configDir, const char *configDir,
const char *autostartDir) const char *autostartDir)
{ {
@ -874,7 +904,9 @@ int virNetworkLoadAllConfigs(virNetworkObjListPtr nets,
return ret; return ret;
} }
int virNetworkDeleteConfig(const char *configDir,
int
virNetworkDeleteConfig(const char *configDir,
const char *autostartDir, const char *autostartDir,
virNetworkObjPtr net) virNetworkObjPtr net)
{ {
@ -906,6 +938,7 @@ int virNetworkDeleteConfig(const char *configDir,
return ret; return ret;
} }
struct virNetworkBridgeInUseHelperData { struct virNetworkBridgeInUseHelperData {
const char *bridge; const char *bridge;
const char *skipname; const char *skipname;
@ -936,7 +969,9 @@ virNetworkBridgeInUseHelper(const void *payload,
return ret; return ret;
} }
int virNetworkBridgeInUse(virNetworkObjListPtr nets,
int
virNetworkBridgeInUse(virNetworkObjListPtr nets,
const char *bridge, const char *bridge,
const char *skipname) const char *skipname)
{ {
@ -1037,6 +1072,7 @@ virNetworkObjUpdate(virNetworkObjPtr network,
return ret; return ret;
} }
#define MATCH(FLAG) (flags & (FLAG)) #define MATCH(FLAG) (flags & (FLAG))
static bool static bool
virNetworkMatch(virNetworkObjPtr netobj, virNetworkMatch(virNetworkObjPtr netobj,
@ -1070,6 +1106,7 @@ virNetworkMatch(virNetworkObjPtr netobj,
} }
#undef MATCH #undef MATCH
struct virNetworkObjListData { struct virNetworkObjListData {
virConnectPtr conn; virConnectPtr conn;
virNetworkPtr *nets; virNetworkPtr *nets;
@ -1117,6 +1154,7 @@ virNetworkObjListPopulate(void *payload,
return 0; return 0;
} }
int int
virNetworkObjListExport(virConnectPtr conn, virNetworkObjListExport(virConnectPtr conn,
virNetworkObjListPtr netobjs, virNetworkObjListPtr netobjs,
@ -1153,6 +1191,7 @@ virNetworkObjListExport(virConnectPtr conn,
return ret; return ret;
} }
struct virNetworkObjListForEachHelperData { struct virNetworkObjListForEachHelperData {
virNetworkObjListIterator callback; virNetworkObjListIterator callback;
void *opaque; void *opaque;
@ -1171,6 +1210,7 @@ virNetworkObjListForEachHelper(void *payload,
return 0; return 0;
} }
/** /**
* virNetworkObjListForEach: * virNetworkObjListForEach:
* @nets: a list of network objects * @nets: a list of network objects
@ -1196,6 +1236,7 @@ virNetworkObjListForEach(virNetworkObjListPtr nets,
return data.ret; return data.ret;
} }
struct virNetworkObjListGetHelperData { struct virNetworkObjListGetHelperData {
virConnectPtr conn; virConnectPtr conn;
virNetworkObjListFilter filter; virNetworkObjListFilter filter;
@ -1242,6 +1283,7 @@ virNetworkObjListGetHelper(void *payload,
return 0; return 0;
} }
int int
virNetworkObjListGetNames(virNetworkObjListPtr nets, virNetworkObjListGetNames(virNetworkObjListPtr nets,
bool active, bool active,
@ -1271,6 +1313,7 @@ virNetworkObjListGetNames(virNetworkObjListPtr nets,
return ret; return ret;
} }
int int
virNetworkObjListNumOfNetworks(virNetworkObjListPtr nets, virNetworkObjListNumOfNetworks(virNetworkObjListPtr nets,
bool active, bool active,
@ -1287,6 +1330,7 @@ virNetworkObjListNumOfNetworks(virNetworkObjListPtr nets,
return data.got; return data.got;
} }
struct virNetworkObjListPruneHelperData { struct virNetworkObjListPruneHelperData {
unsigned int flags; unsigned int flags;
}; };
@ -1306,6 +1350,7 @@ virNetworkObjListPruneHelper(const void *payload,
return want; return want;
} }
/** /**
* virNetworkObjListPrune: * virNetworkObjListPrune:
* @nets: a list of network objects * @nets: a list of network objects