[PATCH 03/10] network: move driver registration back to end of the file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



By convention the last thing in the driver.c files should be the driver
callback table and function to register it.

Signed-off-by: Daniel P. Berrangé <berrange@xxxxxxxxxx>
---
 src/network/bridge_driver.c | 90 ++++++++++++++++++++++-----------------------
 1 file changed, 45 insertions(+), 45 deletions(-)

diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index 334da7a85d..7f21381bd4 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -4241,51 +4241,6 @@ networkGetDHCPLeases(virNetworkPtr net,
 }
 
 
-static virNetworkDriver networkDriver = {
-    .name = "bridge",
-    .connectNumOfNetworks = networkConnectNumOfNetworks, /* 0.2.0 */
-    .connectListNetworks = networkConnectListNetworks, /* 0.2.0 */
-    .connectNumOfDefinedNetworks = networkConnectNumOfDefinedNetworks, /* 0.2.0 */
-    .connectListDefinedNetworks = networkConnectListDefinedNetworks, /* 0.2.0 */
-    .connectListAllNetworks = networkConnectListAllNetworks, /* 0.10.2 */
-    .connectNetworkEventRegisterAny = networkConnectNetworkEventRegisterAny, /* 1.2.1 */
-    .connectNetworkEventDeregisterAny = networkConnectNetworkEventDeregisterAny, /* 1.2.1 */
-    .networkLookupByUUID = networkLookupByUUID, /* 0.2.0 */
-    .networkLookupByName = networkLookupByName, /* 0.2.0 */
-    .networkCreateXML = networkCreateXML, /* 0.2.0 */
-    .networkDefineXML = networkDefineXML, /* 0.2.0 */
-    .networkUndefine = networkUndefine, /* 0.2.0 */
-    .networkUpdate = networkUpdate, /* 0.10.2 */
-    .networkCreate = networkCreate, /* 0.2.0 */
-    .networkDestroy = networkDestroy, /* 0.2.0 */
-    .networkGetXMLDesc = networkGetXMLDesc, /* 0.2.0 */
-    .networkGetBridgeName = networkGetBridgeName, /* 0.2.0 */
-    .networkGetAutostart = networkGetAutostart, /* 0.2.1 */
-    .networkSetAutostart = networkSetAutostart, /* 0.2.1 */
-    .networkIsActive = networkIsActive, /* 0.7.3 */
-    .networkIsPersistent = networkIsPersistent, /* 0.7.3 */
-    .networkGetDHCPLeases = networkGetDHCPLeases, /* 1.2.6 */
-};
-
-static virStateDriver networkStateDriver = {
-    .name = "bridge",
-    .stateInitialize  = networkStateInitialize,
-    .stateAutoStart  = networkStateAutoStart,
-    .stateCleanup = networkStateCleanup,
-    .stateReload = networkStateReload,
-};
-
-int
-networkRegister(void)
-{
-    if (virSetSharedNetworkDriver(&networkDriver) < 0)
-        return -1;
-    if (virRegisterStateDriver(&networkStateDriver) < 0)
-        return -1;
-    return 0;
-}
-
-
 /* A unified function to log network connections and disconnections */
 
 static void
@@ -5716,3 +5671,48 @@ networkBandwidthUpdate(virDomainNetDefPtr iface,
     virNetworkObjEndAPI(&obj);
     return ret;
 }
+
+
+static virNetworkDriver networkDriver = {
+    .name = "bridge",
+    .connectNumOfNetworks = networkConnectNumOfNetworks, /* 0.2.0 */
+    .connectListNetworks = networkConnectListNetworks, /* 0.2.0 */
+    .connectNumOfDefinedNetworks = networkConnectNumOfDefinedNetworks, /* 0.2.0 */
+    .connectListDefinedNetworks = networkConnectListDefinedNetworks, /* 0.2.0 */
+    .connectListAllNetworks = networkConnectListAllNetworks, /* 0.10.2 */
+    .connectNetworkEventRegisterAny = networkConnectNetworkEventRegisterAny, /* 1.2.1 */
+    .connectNetworkEventDeregisterAny = networkConnectNetworkEventDeregisterAny, /* 1.2.1 */
+    .networkLookupByUUID = networkLookupByUUID, /* 0.2.0 */
+    .networkLookupByName = networkLookupByName, /* 0.2.0 */
+    .networkCreateXML = networkCreateXML, /* 0.2.0 */
+    .networkDefineXML = networkDefineXML, /* 0.2.0 */
+    .networkUndefine = networkUndefine, /* 0.2.0 */
+    .networkUpdate = networkUpdate, /* 0.10.2 */
+    .networkCreate = networkCreate, /* 0.2.0 */
+    .networkDestroy = networkDestroy, /* 0.2.0 */
+    .networkGetXMLDesc = networkGetXMLDesc, /* 0.2.0 */
+    .networkGetBridgeName = networkGetBridgeName, /* 0.2.0 */
+    .networkGetAutostart = networkGetAutostart, /* 0.2.1 */
+    .networkSetAutostart = networkSetAutostart, /* 0.2.1 */
+    .networkIsActive = networkIsActive, /* 0.7.3 */
+    .networkIsPersistent = networkIsPersistent, /* 0.7.3 */
+    .networkGetDHCPLeases = networkGetDHCPLeases, /* 1.2.6 */
+};
+
+static virStateDriver networkStateDriver = {
+    .name = "bridge",
+    .stateInitialize  = networkStateInitialize,
+    .stateAutoStart  = networkStateAutoStart,
+    .stateCleanup = networkStateCleanup,
+    .stateReload = networkStateReload,
+};
+
+int
+networkRegister(void)
+{
+    if (virSetSharedNetworkDriver(&networkDriver) < 0)
+        return -1;
+    if (virRegisterStateDriver(&networkStateDriver) < 0)
+        return -1;
+    return 0;
+}
-- 
2.14.3

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux