network: Perform some formatting cleanup in bridge_driver

Modify code to have two spaces between functions, follow function more
recent function formatting w/r/t args per line and function return type
and name on separate lines.

Signed-off-by: John Ferlan <jferlan@redhat.com>
This commit is contained in:
John Ferlan 2017-05-09 15:57:48 -04:00
parent d7af0de38e
commit 71b3b1b867

View File

@ -91,6 +91,7 @@ VIR_LOG_INIT("network.bridge_driver");
static virNetworkDriverStatePtr network_driver; static virNetworkDriverStatePtr network_driver;
static virNetworkDriverStatePtr static virNetworkDriverStatePtr
networkGetDriver(void) networkGetDriver(void)
{ {
@ -100,15 +101,21 @@ networkGetDriver(void)
return network_driver; return network_driver;
} }
static void networkDriverLock(virNetworkDriverStatePtr driver)
static void
networkDriverLock(virNetworkDriverStatePtr driver)
{ {
virMutexLock(&driver->lock); virMutexLock(&driver->lock);
} }
static void networkDriverUnlock(virNetworkDriverStatePtr driver)
static void
networkDriverUnlock(virNetworkDriverStatePtr driver)
{ {
virMutexUnlock(&driver->lock); virMutexUnlock(&driver->lock);
} }
static dnsmasqCapsPtr static dnsmasqCapsPtr
networkGetDnsmasqCaps(virNetworkDriverStatePtr driver) networkGetDnsmasqCaps(virNetworkDriverStatePtr driver)
{ {
@ -119,6 +126,7 @@ networkGetDnsmasqCaps(virNetworkDriverStatePtr driver)
return ret; return ret;
} }
static int static int
networkDnsmasqCapsRefresh(virNetworkDriverStatePtr driver) networkDnsmasqCapsRefresh(virNetworkDriverStatePtr driver)
{ {
@ -134,34 +142,50 @@ networkDnsmasqCapsRefresh(virNetworkDriverStatePtr driver)
return 0; return 0;
} }
static int networkStateCleanup(void);
static int networkStartNetwork(virNetworkDriverStatePtr driver, static int
virNetworkObjPtr network); networkStateCleanup(void);
static int networkShutdownNetwork(virNetworkDriverStatePtr driver, static int
virNetworkObjPtr network); networkStartNetwork(virNetworkDriverStatePtr driver,
virNetworkObjPtr network);
static int networkStartNetworkVirtual(virNetworkDriverStatePtr driver, static int
virNetworkObjPtr network); networkShutdownNetwork(virNetworkDriverStatePtr driver,
virNetworkObjPtr network);
static int networkShutdownNetworkVirtual(virNetworkDriverStatePtr driver, static int
virNetworkObjPtr network); networkStartNetworkVirtual(virNetworkDriverStatePtr driver,
virNetworkObjPtr network);
static int networkStartNetworkExternal(virNetworkObjPtr network); static int
networkShutdownNetworkVirtual(virNetworkDriverStatePtr driver,
virNetworkObjPtr network);
static int networkShutdownNetworkExternal(virNetworkObjPtr network); static int
networkStartNetworkExternal(virNetworkObjPtr network);
static void networkReloadFirewallRules(virNetworkDriverStatePtr driver); static int
static void networkRefreshDaemons(virNetworkDriverStatePtr driver); networkShutdownNetworkExternal(virNetworkObjPtr network);
static int networkPlugBandwidth(virNetworkObjPtr net, static void
virDomainNetDefPtr iface); networkReloadFirewallRules(virNetworkDriverStatePtr driver);
static int networkUnplugBandwidth(virNetworkObjPtr net,
virDomainNetDefPtr iface); static void
networkRefreshDaemons(virNetworkDriverStatePtr driver);
static int
networkPlugBandwidth(virNetworkObjPtr net,
virDomainNetDefPtr iface);
static int
networkUnplugBandwidth(virNetworkObjPtr net,
virDomainNetDefPtr iface);
static void
networkNetworkObjTaint(virNetworkObjPtr net,
virNetworkTaintFlags taint);
static void networkNetworkObjTaint(virNetworkObjPtr net,
virNetworkTaintFlags taint);
static virNetworkObjPtr static virNetworkObjPtr
networkObjFromNetwork(virNetworkPtr net) networkObjFromNetwork(virNetworkPtr net)
@ -181,6 +205,7 @@ networkObjFromNetwork(virNetworkPtr net)
return network; return network;
} }
static int static int
networkRunHook(virNetworkObjPtr network, networkRunHook(virNetworkObjPtr network,
virDomainDefPtr dom, virDomainDefPtr dom,
@ -237,6 +262,7 @@ networkRunHook(virNetworkObjPtr network,
return ret; return ret;
} }
static char * static char *
networkDnsmasqLeaseFileNameDefault(virNetworkDriverStatePtr driver, networkDnsmasqLeaseFileNameDefault(virNetworkDriverStatePtr driver,
const char *netname) const char *netname)
@ -248,6 +274,7 @@ networkDnsmasqLeaseFileNameDefault(virNetworkDriverStatePtr driver,
return leasefile; return leasefile;
} }
static char * static char *
networkDnsmasqLeaseFileNameCustom(virNetworkDriverStatePtr driver, networkDnsmasqLeaseFileNameCustom(virNetworkDriverStatePtr driver,
const char *bridge) const char *bridge)
@ -259,6 +286,7 @@ networkDnsmasqLeaseFileNameCustom(virNetworkDriverStatePtr driver,
return leasefile; return leasefile;
} }
static char * static char *
networkDnsmasqConfigFileName(virNetworkDriverStatePtr driver, networkDnsmasqConfigFileName(virNetworkDriverStatePtr driver,
const char *netname) const char *netname)
@ -270,6 +298,7 @@ networkDnsmasqConfigFileName(virNetworkDriverStatePtr driver,
return conffile; return conffile;
} }
static char * static char *
networkRadvdPidfileBasename(const char *netname) networkRadvdPidfileBasename(const char *netname)
{ {
@ -280,6 +309,7 @@ networkRadvdPidfileBasename(const char *netname)
return pidfilebase; return pidfilebase;
} }
static char * static char *
networkRadvdConfigFileName(virNetworkDriverStatePtr driver, networkRadvdConfigFileName(virNetworkDriverStatePtr driver,
const char *netname) const char *netname)
@ -291,6 +321,7 @@ networkRadvdConfigFileName(virNetworkDriverStatePtr driver,
return configfile; return configfile;
} }
static char * static char *
networkMacMgrFileName(virNetworkDriverStatePtr driver, networkMacMgrFileName(virNetworkDriverStatePtr driver,
const char *bridge) const char *bridge)
@ -302,6 +333,7 @@ networkMacMgrFileName(virNetworkDriverStatePtr driver,
return filename; return filename;
} }
/* do needed cleanup steps and remove the network from the list */ /* do needed cleanup steps and remove the network from the list */
static int static int
networkRemoveInactive(virNetworkDriverStatePtr driver, networkRemoveInactive(virNetworkDriverStatePtr driver,
@ -379,6 +411,7 @@ networkRemoveInactive(virNetworkDriverStatePtr driver,
return ret; return ret;
} }
static int static int
networkMacMgrAdd(virNetworkDriverStatePtr driver, networkMacMgrAdd(virNetworkDriverStatePtr driver,
virNetworkObjPtr network, virNetworkObjPtr network,
@ -409,6 +442,7 @@ networkMacMgrAdd(virNetworkDriverStatePtr driver,
return ret; return ret;
} }
static int static int
networkMacMgrDel(virNetworkDriverStatePtr driver, networkMacMgrDel(virNetworkDriverStatePtr driver,
virNetworkObjPtr network, virNetworkObjPtr network,
@ -439,6 +473,7 @@ networkMacMgrDel(virNetworkDriverStatePtr driver,
return ret; return ret;
} }
static char * static char *
networkBridgeDummyNicName(const char *brname) networkBridgeDummyNicName(const char *brname)
{ {
@ -463,6 +498,7 @@ networkBridgeDummyNicName(const char *brname)
return nicname; return nicname;
} }
static int static int
networkUpdateState(virNetworkObjPtr obj, networkUpdateState(virNetworkObjPtr obj,
void *opaque) void *opaque)
@ -563,10 +599,12 @@ networkAutostartConfig(virNetworkObjPtr net,
return ret; return ret;
} }
#if HAVE_FIREWALLD #if HAVE_FIREWALLD
static DBusHandlerResult static DBusHandlerResult
firewalld_dbus_filter_bridge(DBusConnection *connection ATTRIBUTE_UNUSED, firewalld_dbus_filter_bridge(DBusConnection *connection ATTRIBUTE_UNUSED,
DBusMessage *message, void *user_data) DBusMessage *message,
void *user_data)
{ {
virNetworkDriverStatePtr driver = user_data; virNetworkDriverStatePtr driver = user_data;
@ -583,6 +621,7 @@ firewalld_dbus_filter_bridge(DBusConnection *connection ATTRIBUTE_UNUSED,
} }
#endif #endif
static int static int
networkMigrateStateFiles(virNetworkDriverStatePtr driver) networkMigrateStateFiles(virNetworkDriverStatePtr driver)
{ {
@ -668,6 +707,7 @@ networkMigrateStateFiles(virNetworkDriverStatePtr driver)
return ret; return ret;
} }
/** /**
* networkStateInitialize: * networkStateInitialize:
* *
@ -813,6 +853,7 @@ networkStateInitialize(bool privileged,
goto cleanup; goto cleanup;
} }
/** /**
* networkStateAutoStart: * networkStateAutoStart:
* *
@ -829,6 +870,7 @@ networkStateAutoStart(void)
network_driver); network_driver);
} }
/** /**
* networkStateReload: * networkStateReload:
* *
@ -893,7 +935,9 @@ networkStateCleanup(void)
* kill the specified pid/name, and wait a bit to make sure it's dead. * kill the specified pid/name, and wait a bit to make sure it's dead.
*/ */
static int static int
networkKillDaemon(pid_t pid, const char *daemonName, const char *networkName) networkKillDaemon(pid_t pid,
const char *daemonName,
const char *networkName)
{ {
size_t i; size_t i;
int ret = -1; int ret = -1;
@ -948,10 +992,10 @@ networkKillDaemon(pid_t pid, const char *daemonName, const char *networkName)
return ret; return ret;
} }
/* the following does not build a file, it builds a list /* the following does not build a file, it builds a list
* which is later saved into a file * which is later saved into a file
*/ */
static int static int
networkBuildDnsmasqDhcpHostsList(dnsmasqContext *dctx, networkBuildDnsmasqDhcpHostsList(dnsmasqContext *dctx,
virNetworkIPDefPtr ipdef) virNetworkIPDefPtr ipdef)
@ -972,6 +1016,7 @@ networkBuildDnsmasqDhcpHostsList(dnsmasqContext *dctx,
return 0; return 0;
} }
static int static int
networkBuildDnsmasqHostsList(dnsmasqContext *dctx, networkBuildDnsmasqHostsList(dnsmasqContext *dctx,
virNetworkDNSDefPtr dnsdef) virNetworkDNSDefPtr dnsdef)
@ -1489,6 +1534,7 @@ networkDnsmasqConfContents(virNetworkObjPtr network,
return ret; return ret;
} }
/* build the dnsmasq command line */ /* build the dnsmasq command line */
static int ATTRIBUTE_NONNULL(3) static int ATTRIBUTE_NONNULL(3)
networkBuildDhcpDaemonCommandLine(virNetworkDriverStatePtr driver, networkBuildDhcpDaemonCommandLine(virNetworkDriverStatePtr driver,
@ -1547,6 +1593,7 @@ networkBuildDhcpDaemonCommandLine(virNetworkDriverStatePtr driver,
return ret; return ret;
} }
static int static int
networkStartDhcpDaemon(virNetworkDriverStatePtr driver, networkStartDhcpDaemon(virNetworkDriverStatePtr driver,
virNetworkObjPtr network) virNetworkObjPtr network)
@ -1637,6 +1684,7 @@ networkStartDhcpDaemon(virNetworkDriverStatePtr driver,
return ret; return ret;
} }
/* networkRefreshDhcpDaemon: /* networkRefreshDhcpDaemon:
* Update dnsmasq config files, then send a SIGHUP so that it rereads * Update dnsmasq config files, then send a SIGHUP so that it rereads
* them. This only works for the dhcp-hostsfile and the * them. This only works for the dhcp-hostsfile and the
@ -1705,6 +1753,7 @@ networkRefreshDhcpDaemon(virNetworkDriverStatePtr driver,
return ret; return ret;
} }
/* networkRestartDhcpDaemon: /* networkRestartDhcpDaemon:
* *
* kill and restart dnsmasq, in order to update any config that is on * kill and restart dnsmasq, in order to update any config that is on
@ -1726,6 +1775,7 @@ networkRestartDhcpDaemon(virNetworkDriverStatePtr driver,
return networkStartDhcpDaemon(driver, network); return networkStartDhcpDaemon(driver, network);
} }
static char radvd1[] = " AdvOtherConfigFlag off;\n\n"; static char radvd1[] = " AdvOtherConfigFlag off;\n\n";
static char radvd2[] = " AdvAutonomous off;\n"; static char radvd2[] = " AdvAutonomous off;\n";
static char radvd3[] = " AdvOnLink on;\n" static char radvd3[] = " AdvOnLink on;\n"
@ -1733,7 +1783,8 @@ static char radvd3[] = " AdvOnLink on;\n"
" AdvRouterAddr off;\n"; " AdvRouterAddr off;\n";
static int static int
networkRadvdConfContents(virNetworkObjPtr network, char **configstr) networkRadvdConfContents(virNetworkObjPtr network,
char **configstr)
{ {
virBuffer configbuf = VIR_BUFFER_INITIALIZER; virBuffer configbuf = VIR_BUFFER_INITIALIZER;
int ret = -1; int ret = -1;
@ -1810,6 +1861,7 @@ networkRadvdConfContents(virNetworkObjPtr network, char **configstr)
return ret; return ret;
} }
/* write file and return its name (which must be freed by caller) */ /* write file and return its name (which must be freed by caller) */
static int static int
networkRadvdConfWrite(virNetworkDriverStatePtr driver, networkRadvdConfWrite(virNetworkDriverStatePtr driver,
@ -1851,6 +1903,7 @@ networkRadvdConfWrite(virNetworkDriverStatePtr driver,
return ret; return ret;
} }
static int static int
networkStartRadvd(virNetworkDriverStatePtr driver, networkStartRadvd(virNetworkDriverStatePtr driver,
virNetworkObjPtr network) virNetworkObjPtr network)
@ -1939,6 +1992,7 @@ networkStartRadvd(virNetworkDriverStatePtr driver,
return ret; return ret;
} }
static int static int
networkRefreshRadvd(virNetworkDriverStatePtr driver, networkRefreshRadvd(virNetworkDriverStatePtr driver,
virNetworkObjPtr network) virNetworkObjPtr network)
@ -1979,6 +2033,7 @@ networkRefreshRadvd(virNetworkDriverStatePtr driver,
return kill(network->radvdPid, SIGHUP); return kill(network->radvdPid, SIGHUP);
} }
#if 0 #if 0
/* currently unused, so it causes a build error unless we #if it out */ /* currently unused, so it causes a build error unless we #if it out */
static int static int
@ -2006,6 +2061,7 @@ networkRestartRadvd(virNetworkObjPtr network)
} }
#endif /* #if 0 */ #endif /* #if 0 */
static int static int
networkRefreshDaemonsHelper(virNetworkObjPtr net, networkRefreshDaemonsHelper(virNetworkObjPtr net,
void *opaque) void *opaque)
@ -2031,6 +2087,7 @@ networkRefreshDaemonsHelper(virNetworkObjPtr net,
return 0; return 0;
} }
/* SIGHUP/restart any dnsmasq or radvd daemons. /* SIGHUP/restart any dnsmasq or radvd daemons.
* This should be called when libvirtd is restarted. * This should be called when libvirtd is restarted.
*/ */
@ -2043,6 +2100,7 @@ networkRefreshDaemons(virNetworkDriverStatePtr driver)
driver); driver);
} }
static int static int
networkReloadFirewallRulesHelper(virNetworkObjPtr net, networkReloadFirewallRulesHelper(virNetworkObjPtr net,
void *opaque ATTRIBUTE_UNUSED) void *opaque ATTRIBUTE_UNUSED)
@ -2067,6 +2125,7 @@ networkReloadFirewallRulesHelper(virNetworkObjPtr net,
return 0; return 0;
} }
static void static void
networkReloadFirewallRules(virNetworkDriverStatePtr driver) networkReloadFirewallRules(virNetworkDriverStatePtr driver)
{ {
@ -2076,9 +2135,11 @@ networkReloadFirewallRules(virNetworkDriverStatePtr driver)
NULL); NULL);
} }
/* Enable IP Forwarding. Return 0 for success, -1 for failure. */ /* Enable IP Forwarding. Return 0 for success, -1 for failure. */
static int static int
networkEnableIPForwarding(bool enableIPv4, bool enableIPv6) networkEnableIPForwarding(bool enableIPv4,
bool enableIPv6)
{ {
int ret = 0; int ret = 0;
#ifdef HAVE_SYSCTLBYNAME #ifdef HAVE_SYSCTLBYNAME
@ -2099,6 +2160,7 @@ networkEnableIPForwarding(bool enableIPv4, bool enableIPv6)
return ret; return ret;
} }
static int static int
networkSetIPv6Sysctls(virNetworkObjPtr network) networkSetIPv6Sysctls(virNetworkObjPtr network)
{ {
@ -2167,6 +2229,7 @@ networkSetIPv6Sysctls(virNetworkObjPtr network)
return ret; return ret;
} }
/* add an IP address to a bridge */ /* add an IP address to a bridge */
static int static int
networkAddAddrToBridge(virNetworkObjPtr network, networkAddAddrToBridge(virNetworkObjPtr network,
@ -2262,6 +2325,7 @@ networkWaitDadFinish(virNetworkObjPtr network)
return ret; return ret;
} }
static int static int
networkStartNetworkVirtual(virNetworkDriverStatePtr driver, networkStartNetworkVirtual(virNetworkDriverStatePtr driver,
virNetworkObjPtr network) virNetworkObjPtr network)
@ -2479,6 +2543,7 @@ networkStartNetworkVirtual(virNetworkDriverStatePtr driver,
return -1; return -1;
} }
static int static int
networkShutdownNetworkVirtual(virNetworkDriverStatePtr driver, networkShutdownNetworkVirtual(virNetworkDriverStatePtr driver,
virNetworkObjPtr network) virNetworkObjPtr network)
@ -2543,6 +2608,7 @@ networkStartNetworkBridge(virNetworkObjPtr network)
return networkStartHandleMACTableManagerMode(network, NULL); return networkStartHandleMACTableManagerMode(network, NULL);
} }
static int static int
networkShutdownNetworkBridge(virNetworkObjPtr network ATTRIBUTE_UNUSED) networkShutdownNetworkBridge(virNetworkObjPtr network ATTRIBUTE_UNUSED)
{ {
@ -2673,7 +2739,9 @@ networkStartNetworkExternal(virNetworkObjPtr network)
return networkCreateInterfacePool(network->def); return networkCreateInterfacePool(network->def);
} }
static int networkShutdownNetworkExternal(virNetworkObjPtr network ATTRIBUTE_UNUSED)
static int
networkShutdownNetworkExternal(virNetworkObjPtr network ATTRIBUTE_UNUSED)
{ {
/* put anything here that needs to be done each time a network of /* put anything here that needs to be done each time a network of
* type BRIDGE, PRIVATE, VEPA, HOSTDEV or PASSTHROUGH is shutdown. On * type BRIDGE, PRIVATE, VEPA, HOSTDEV or PASSTHROUGH is shutdown. On
@ -2683,6 +2751,7 @@ static int networkShutdownNetworkExternal(virNetworkObjPtr network ATTRIBUTE_UNU
return 0; return 0;
} }
static int static int
networkStartNetwork(virNetworkDriverStatePtr driver, networkStartNetwork(virNetworkDriverStatePtr driver,
virNetworkObjPtr network) virNetworkObjPtr network)
@ -2771,6 +2840,7 @@ networkStartNetwork(virNetworkDriverStatePtr driver,
return ret; return ret;
} }
static int static int
networkShutdownNetwork(virNetworkDriverStatePtr driver, networkShutdownNetwork(virNetworkDriverStatePtr driver,
virNetworkObjPtr network) virNetworkObjPtr network)
@ -2829,8 +2899,9 @@ networkShutdownNetwork(virNetworkDriverStatePtr driver,
} }
static virNetworkPtr networkLookupByUUID(virConnectPtr conn, static virNetworkPtr
const unsigned char *uuid) networkLookupByUUID(virConnectPtr conn,
const unsigned char *uuid)
{ {
virNetworkDriverStatePtr driver = networkGetDriver(); virNetworkDriverStatePtr driver = networkGetDriver();
virNetworkObjPtr network; virNetworkObjPtr network;
@ -2856,8 +2927,10 @@ static virNetworkPtr networkLookupByUUID(virConnectPtr conn,
return ret; return ret;
} }
static virNetworkPtr networkLookupByName(virConnectPtr conn,
const char *name) static virNetworkPtr
networkLookupByName(virConnectPtr conn,
const char *name)
{ {
virNetworkDriverStatePtr driver = networkGetDriver(); virNetworkDriverStatePtr driver = networkGetDriver();
virNetworkObjPtr network; virNetworkObjPtr network;
@ -2880,7 +2953,9 @@ static virNetworkPtr networkLookupByName(virConnectPtr conn,
return ret; return ret;
} }
static int networkConnectNumOfNetworks(virConnectPtr conn)
static int
networkConnectNumOfNetworks(virConnectPtr conn)
{ {
virNetworkDriverStatePtr driver = networkGetDriver(); virNetworkDriverStatePtr driver = networkGetDriver();
int nactive; int nactive;
@ -2896,9 +2971,11 @@ static int networkConnectNumOfNetworks(virConnectPtr conn)
return nactive; return nactive;
} }
static int networkConnectListNetworks(virConnectPtr conn,
char **const names, static int
int nnames) networkConnectListNetworks(virConnectPtr conn,
char **const names,
int nnames)
{ {
virNetworkDriverStatePtr driver = networkGetDriver(); virNetworkDriverStatePtr driver = networkGetDriver();
int got = 0; int got = 0;
@ -2914,7 +2991,9 @@ static int networkConnectListNetworks(virConnectPtr conn,
return got; return got;
} }
static int networkConnectNumOfDefinedNetworks(virConnectPtr conn)
static int
networkConnectNumOfDefinedNetworks(virConnectPtr conn)
{ {
virNetworkDriverStatePtr driver = networkGetDriver(); virNetworkDriverStatePtr driver = networkGetDriver();
int ninactive = 0; int ninactive = 0;
@ -2930,7 +3009,11 @@ static int networkConnectNumOfDefinedNetworks(virConnectPtr conn)
return ninactive; return ninactive;
} }
static int networkConnectListDefinedNetworks(virConnectPtr conn, char **const names, int nnames)
static int
networkConnectListDefinedNetworks(virConnectPtr conn,
char **const names,
int nnames)
{ {
virNetworkDriverStatePtr driver = networkGetDriver(); virNetworkDriverStatePtr driver = networkGetDriver();
int got = 0; int got = 0;
@ -2945,6 +3028,7 @@ static int networkConnectListDefinedNetworks(virConnectPtr conn, char **const na
return got; return got;
} }
static int static int
networkConnectListAllNetworks(virConnectPtr conn, networkConnectListAllNetworks(virConnectPtr conn,
virNetworkPtr **nets, virNetworkPtr **nets,
@ -2966,6 +3050,7 @@ networkConnectListAllNetworks(virConnectPtr conn,
return ret; return ret;
} }
static int static int
networkConnectNetworkEventRegisterAny(virConnectPtr conn, networkConnectNetworkEventRegisterAny(virConnectPtr conn,
virNetworkPtr net, virNetworkPtr net,
@ -2989,6 +3074,7 @@ networkConnectNetworkEventRegisterAny(virConnectPtr conn,
return ret; return ret;
} }
static int static int
networkConnectNetworkEventDeregisterAny(virConnectPtr conn, networkConnectNetworkEventDeregisterAny(virConnectPtr conn,
int callbackID) int callbackID)
@ -3010,7 +3096,9 @@ networkConnectNetworkEventDeregisterAny(virConnectPtr conn,
return ret; return ret;
} }
static int networkIsActive(virNetworkPtr net)
static int
networkIsActive(virNetworkPtr net)
{ {
virNetworkObjPtr obj; virNetworkObjPtr obj;
int ret = -1; int ret = -1;
@ -3028,7 +3116,9 @@ static int networkIsActive(virNetworkPtr net)
return ret; return ret;
} }
static int networkIsPersistent(virNetworkPtr net)
static int
networkIsPersistent(virNetworkPtr net)
{ {
virNetworkObjPtr obj; virNetworkObjPtr obj;
int ret = -1; int ret = -1;
@ -3097,7 +3187,6 @@ networkFindUnusedBridgeName(virNetworkObjListPtr nets,
} }
/* /*
* networkValidateBridgeName() - if no bridge name is set, or if the * networkValidateBridgeName() - if no bridge name is set, or if the
* bridge name contains a %d (indicating that this is a template for * bridge name contains a %d (indicating that this is a template for
@ -3408,7 +3497,10 @@ networkValidate(virNetworkDriverStatePtr driver,
return 0; return 0;
} }
static virNetworkPtr networkCreateXML(virConnectPtr conn, const char *xml)
static virNetworkPtr
networkCreateXML(virConnectPtr conn,
const char *xml)
{ {
virNetworkDriverStatePtr driver = networkGetDriver(); virNetworkDriverStatePtr driver = networkGetDriver();
virNetworkDefPtr def; virNetworkDefPtr def;
@ -3456,7 +3548,10 @@ static virNetworkPtr networkCreateXML(virConnectPtr conn, const char *xml)
return ret; return ret;
} }
static virNetworkPtr networkDefineXML(virConnectPtr conn, const char *xml)
static virNetworkPtr
networkDefineXML(virConnectPtr conn,
const char *xml)
{ {
virNetworkDriverStatePtr driver = networkGetDriver(); virNetworkDriverStatePtr driver = networkGetDriver();
virNetworkDefPtr def = NULL; virNetworkDefPtr def = NULL;
@ -3509,6 +3604,7 @@ static virNetworkPtr networkDefineXML(virConnectPtr conn, const char *xml)
return ret; return ret;
} }
static int static int
networkUndefine(virNetworkPtr net) networkUndefine(virNetworkPtr net)
{ {
@ -3565,6 +3661,7 @@ networkUndefine(virNetworkPtr net)
return ret; return ret;
} }
static int static int
networkUpdate(virNetworkPtr net, networkUpdate(virNetworkPtr net,
unsigned int command, unsigned int command,
@ -3739,7 +3836,9 @@ networkUpdate(virNetworkPtr net,
return ret; return ret;
} }
static int networkCreate(virNetworkPtr net)
static int
networkCreate(virNetworkPtr net)
{ {
virNetworkDriverStatePtr driver = networkGetDriver(); virNetworkDriverStatePtr driver = networkGetDriver();
virNetworkObjPtr network; virNetworkObjPtr network;
@ -3767,7 +3866,9 @@ static int networkCreate(virNetworkPtr net)
return ret; return ret;
} }
static int networkDestroy(virNetworkPtr net)
static int
networkDestroy(virNetworkPtr net)
{ {
virNetworkDriverStatePtr driver = networkGetDriver(); virNetworkDriverStatePtr driver = networkGetDriver();
virNetworkObjPtr network; virNetworkObjPtr network;
@ -3808,8 +3909,10 @@ static int networkDestroy(virNetworkPtr net)
return ret; return ret;
} }
static char *networkGetXMLDesc(virNetworkPtr net,
unsigned int flags) static char *
networkGetXMLDesc(virNetworkPtr net,
unsigned int flags)
{ {
virNetworkObjPtr network; virNetworkObjPtr network;
virNetworkDefPtr def; virNetworkDefPtr def;
@ -3835,7 +3938,10 @@ static char *networkGetXMLDesc(virNetworkPtr net,
return ret; return ret;
} }
static char *networkGetBridgeName(virNetworkPtr net) {
static char *
networkGetBridgeName(virNetworkPtr net)
{
virNetworkObjPtr network; virNetworkObjPtr network;
char *bridge = NULL; char *bridge = NULL;
@ -3859,8 +3965,10 @@ static char *networkGetBridgeName(virNetworkPtr net) {
return bridge; return bridge;
} }
static int networkGetAutostart(virNetworkPtr net,
int *autostart) static int
networkGetAutostart(virNetworkPtr net,
int *autostart)
{ {
virNetworkObjPtr network; virNetworkObjPtr network;
int ret = -1; int ret = -1;
@ -3879,8 +3987,10 @@ static int networkGetAutostart(virNetworkPtr net,
return ret; return ret;
} }
static int networkSetAutostart(virNetworkPtr net,
int autostart) static int
networkSetAutostart(virNetworkPtr net,
int autostart)
{ {
virNetworkDriverStatePtr driver = networkGetDriver(); virNetworkDriverStatePtr driver = networkGetDriver();
virNetworkObjPtr network; virNetworkObjPtr network;
@ -3942,6 +4052,7 @@ static int networkSetAutostart(virNetworkPtr net,
return ret; return ret;
} }
static int static int
networkGetDHCPLeases(virNetworkPtr network, networkGetDHCPLeases(virNetworkPtr network,
const char *mac, const char *mac,
@ -4165,7 +4276,8 @@ static virStateDriver networkStateDriver = {
.stateReload = networkStateReload, .stateReload = networkStateReload,
}; };
int networkRegister(void) int
networkRegister(void)
{ {
if (virSetSharedNetworkDriver(&networkDriver) < 0) if (virSetSharedNetworkDriver(&networkDriver) < 0)
return -1; return -1;
@ -4174,6 +4286,7 @@ int networkRegister(void)
return 0; return 0;
} }
/********************************************************/ /********************************************************/
/* A unified function to log network connections and disconnections */ /* A unified function to log network connections and disconnections */
@ -4211,6 +4324,7 @@ networkLogAllocation(virNetworkDefPtr netdef,
} }
} }
/* Private API to deal with logical switch capabilities. /* Private API to deal with logical switch capabilities.
* These functions are exported so that other parts of libvirt can * These functions are exported so that other parts of libvirt can
* call them, but are not part of the public API and not in the * call them, but are not part of the public API and not in the
@ -4639,6 +4753,7 @@ networkAllocateActualDevice(virDomainDefPtr dom,
goto cleanup; goto cleanup;
} }
/* networkNotifyActualDevice: /* networkNotifyActualDevice:
* @dom: domain definition that @iface belongs to * @dom: domain definition that @iface belongs to
* @iface: the domain's NetDef with an "actual" device already filled in. * @iface: the domain's NetDef with an "actual" device already filled in.
@ -4857,7 +4972,6 @@ networkNotifyActualDevice(virDomainDefPtr dom,
} }
/* networkReleaseActualDevice: /* networkReleaseActualDevice:
* @dom: domain definition that @iface belongs to * @dom: domain definition that @iface belongs to
* @iface: a domain's NetDef (interface definition) * @iface: a domain's NetDef (interface definition)
@ -5001,6 +5115,7 @@ networkReleaseActualDevice(virDomainDefPtr dom,
goto cleanup; goto cleanup;
} }
/* /*
* networkGetNetworkAddress: * networkGetNetworkAddress:
* @netname: the name of a network * @netname: the name of a network
@ -5021,7 +5136,8 @@ networkReleaseActualDevice(virDomainDefPtr dom,
* completely unsupported. * completely unsupported.
*/ */
int int
networkGetNetworkAddress(const char *netname, char **netaddr) networkGetNetworkAddress(const char *netname,
char **netaddr)
{ {
virNetworkDriverStatePtr driver = networkGetDriver(); virNetworkDriverStatePtr driver = networkGetDriver();
int ret = -1; int ret = -1;
@ -5098,6 +5214,7 @@ networkGetNetworkAddress(const char *netname, char **netaddr)
return ret; return ret;
} }
/* networkGetActualType: /* networkGetActualType:
* @dom: domain definition that @iface belongs to * @dom: domain definition that @iface belongs to
* @iface: the original NetDef from the domain * @iface: the original NetDef from the domain
@ -5260,6 +5377,7 @@ networkCheckBandwidth(virNetworkObjPtr net,
return ret; return ret;
} }
/** /**
* networkNextClassID: * networkNextClassID:
* @net: network object * @net: network object
@ -5374,6 +5492,7 @@ networkPlugBandwidth(virNetworkObjPtr net,
return ret; return ret;
} }
static int static int
networkUnplugBandwidth(virNetworkObjPtr net, networkUnplugBandwidth(virNetworkObjPtr net,
virDomainNetDefPtr iface) virDomainNetDefPtr iface)
@ -5426,6 +5545,7 @@ networkUnplugBandwidth(virNetworkObjPtr net,
return ret; return ret;
} }
static void static void
networkNetworkObjTaint(virNetworkObjPtr net, networkNetworkObjTaint(virNetworkObjPtr net,
virNetworkTaintFlags taint) virNetworkTaintFlags taint)