render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
43fe83
From 91616a6d6ef5c22502d82bff045d4d44f4a230af Mon Sep 17 00:00:00 2001
43fe83
Message-Id: <91616a6d6ef5c22502d82bff045d4d44f4a230af.1379193141.git.jdenemar@redhat.com>
43fe83
From: Laine Stump <laine@laine.org>
43fe83
Date: Thu, 12 Sep 2013 06:32:05 -0600
43fe83
Subject: [PATCH] rename "struct interface_driver" to virNetcfDriverState
43fe83
43fe83
Prerequisite for the patch to fix:
43fe83
43fe83
  https://bugzilla.redhat.com/show_bug.cgi?id=983026
43fe83
43fe83
This better fits the modern naming scheme in libvirt, and anticipates
43fe83
an upcoming change where a single instance of this state will be
43fe83
maintained by a separate state driver, and every instance of the netcf
43fe83
driver will share the same state.
43fe83
43fe83
(cherry picked from commit 4c5fa430972246b82d60c875654fc57e48adfcce)
43fe83
---
43fe83
 src/interface/interface_backend_netcf.c | 52 +++++++++++++++++----------------
43fe83
 1 file changed, 27 insertions(+), 25 deletions(-)
43fe83
43fe83
diff --git a/src/interface/interface_backend_netcf.c b/src/interface/interface_backend_netcf.c
43fe83
index b92b0ce..f47669e 100644
43fe83
--- a/src/interface/interface_backend_netcf.c
43fe83
+++ b/src/interface/interface_backend_netcf.c
43fe83
@@ -2,7 +2,7 @@
43fe83
  * interface_driver.c: backend driver methods to handle physical
43fe83
  *                     interface configuration using the netcf library.
43fe83
  *
43fe83
- * Copyright (C) 2006-2012 Red Hat, Inc.
43fe83
+ * Copyright (C) 2006-2013 Red Hat, Inc.
43fe83
  *
43fe83
  * This library is free software; you can redistribute it and/or
43fe83
  * modify it under the terms of the GNU Lesser General Public
43fe83
@@ -36,20 +36,22 @@
43fe83
 
43fe83
 #define VIR_FROM_THIS VIR_FROM_INTERFACE
43fe83
 
43fe83
+#define INTERFACE_DRIVER_NAME "netcf"
43fe83
+
43fe83
 /* Main driver state */
43fe83
-struct interface_driver
43fe83
+typedef struct
43fe83
 {
43fe83
     virMutex lock;
43fe83
     struct netcf *netcf;
43fe83
-};
43fe83
+} virNetcfDriverState, *virNetcfDriverStatePtr;
43fe83
 
43fe83
 
43fe83
-static void interfaceDriverLock(struct interface_driver *driver)
43fe83
+static void interfaceDriverLock(virNetcfDriverStatePtr driver)
43fe83
 {
43fe83
     virMutexLock(&driver->lock);
43fe83
 }
43fe83
 
43fe83
-static void interfaceDriverUnlock(struct interface_driver *driver)
43fe83
+static void interfaceDriverUnlock(virNetcfDriverStatePtr driver)
43fe83
 {
43fe83
     virMutexUnlock(&driver->lock);
43fe83
 }
43fe83
@@ -150,7 +152,7 @@ static virDrvOpenStatus netcfInterfaceOpen(virConnectPtr conn,
43fe83
                                            virConnectAuthPtr auth ATTRIBUTE_UNUSED,
43fe83
                                            unsigned int flags)
43fe83
 {
43fe83
-    struct interface_driver *driverState;
43fe83
+    virNetcfDriverStatePtr driverState;
43fe83
 
43fe83
     virCheckFlags(VIR_CONNECT_RO, VIR_DRV_OPEN_ERROR);
43fe83
 
43fe83
@@ -191,7 +193,7 @@ static int netcfInterfaceClose(virConnectPtr conn)
43fe83
 
43fe83
     if (conn->interfacePrivateData != NULL)
43fe83
     {
43fe83
-        struct interface_driver *driver = conn->interfacePrivateData;
43fe83
+        virNetcfDriverStatePtr driver = conn->interfacePrivateData;
43fe83
 
43fe83
         /* close netcf instance */
43fe83
         ncf_close(driver->netcf);
43fe83
@@ -208,7 +210,7 @@ static int netcfConnectNumOfInterfacesImpl(virConnectPtr conn,
43fe83
                                            int status,
43fe83
                                            virInterfaceObjListFilter filter)
43fe83
 {
43fe83
-    struct interface_driver *driver = conn->interfacePrivateData;
43fe83
+    virNetcfDriverStatePtr driver = conn->interfacePrivateData;
43fe83
     int count;
43fe83
     int want = 0;
43fe83
     int ret = -1;
43fe83
@@ -302,7 +304,7 @@ static int netcfConnectListInterfacesImpl(virConnectPtr conn,
43fe83
                                           char **const names, int nnames,
43fe83
                                           virInterfaceObjListFilter filter)
43fe83
 {
43fe83
-    struct interface_driver *driver = conn->interfacePrivateData;
43fe83
+    virNetcfDriverStatePtr driver = conn->interfacePrivateData;
43fe83
     int count = 0;
43fe83
     int want = 0;
43fe83
     int ret = -1;
43fe83
@@ -401,7 +403,7 @@ cleanup:
43fe83
 static int netcfConnectNumOfInterfaces(virConnectPtr conn)
43fe83
 {
43fe83
     int count;
43fe83
-    struct interface_driver *driver = conn->interfacePrivateData;
43fe83
+    virNetcfDriverStatePtr driver = conn->interfacePrivateData;
43fe83
 
43fe83
     if (virConnectNumOfInterfacesEnsureACL(conn) < 0)
43fe83
         return -1;
43fe83
@@ -416,7 +418,7 @@ static int netcfConnectNumOfInterfaces(virConnectPtr conn)
43fe83
 
43fe83
 static int netcfConnectListInterfaces(virConnectPtr conn, char **const names, int nnames)
43fe83
 {
43fe83
-    struct interface_driver *driver = conn->interfacePrivateData;
43fe83
+    virNetcfDriverStatePtr driver = conn->interfacePrivateData;
43fe83
     int count;
43fe83
 
43fe83
     if (virConnectListInterfacesEnsureACL(conn) < 0)
43fe83
@@ -435,7 +437,7 @@ static int netcfConnectListInterfaces(virConnectPtr conn, char **const names, in
43fe83
 static int netcfConnectNumOfDefinedInterfaces(virConnectPtr conn)
43fe83
 {
43fe83
     int count;
43fe83
-    struct interface_driver *driver = conn->interfacePrivateData;
43fe83
+    virNetcfDriverStatePtr driver = conn->interfacePrivateData;
43fe83
 
43fe83
     if (virConnectNumOfDefinedInterfacesEnsureACL(conn) < 0)
43fe83
         return -1;
43fe83
@@ -450,7 +452,7 @@ static int netcfConnectNumOfDefinedInterfaces(virConnectPtr conn)
43fe83
 
43fe83
 static int netcfConnectListDefinedInterfaces(virConnectPtr conn, char **const names, int nnames)
43fe83
 {
43fe83
-    struct interface_driver *driver = conn->interfacePrivateData;
43fe83
+    virNetcfDriverStatePtr driver = conn->interfacePrivateData;
43fe83
     int count;
43fe83
 
43fe83
     if (virConnectListDefinedInterfacesEnsureACL(conn) < 0)
43fe83
@@ -472,7 +474,7 @@ netcfConnectListAllInterfaces(virConnectPtr conn,
43fe83
                               virInterfacePtr **ifaces,
43fe83
                               unsigned int flags)
43fe83
 {
43fe83
-    struct interface_driver *driver = conn->interfacePrivateData;
43fe83
+    virNetcfDriverStatePtr driver = conn->interfacePrivateData;
43fe83
     int count;
43fe83
     size_t i;
43fe83
     struct netcf_if *iface = NULL;
43fe83
@@ -627,7 +629,7 @@ cleanup:
43fe83
 static virInterfacePtr netcfInterfaceLookupByName(virConnectPtr conn,
43fe83
                                                   const char *name)
43fe83
 {
43fe83
-    struct interface_driver *driver = conn->interfacePrivateData;
43fe83
+    virNetcfDriverStatePtr driver = conn->interfacePrivateData;
43fe83
     struct netcf_if *iface;
43fe83
     virInterfacePtr ret = NULL;
43fe83
     virInterfaceDefPtr def = NULL;
43fe83
@@ -667,7 +669,7 @@ cleanup:
43fe83
 static virInterfacePtr netcfInterfaceLookupByMACString(virConnectPtr conn,
43fe83
                                                        const char *macstr)
43fe83
 {
43fe83
-    struct interface_driver *driver = conn->interfacePrivateData;
43fe83
+    virNetcfDriverStatePtr driver = conn->interfacePrivateData;
43fe83
     struct netcf_if *iface;
43fe83
     int niface;
43fe83
     virInterfacePtr ret = NULL;
43fe83
@@ -716,7 +718,7 @@ cleanup:
43fe83
 static char *netcfInterfaceGetXMLDesc(virInterfacePtr ifinfo,
43fe83
                                       unsigned int flags)
43fe83
 {
43fe83
-    struct interface_driver *driver = ifinfo->conn->interfacePrivateData;
43fe83
+    virNetcfDriverStatePtr driver = ifinfo->conn->interfacePrivateData;
43fe83
     struct netcf_if *iface = NULL;
43fe83
     char *xmlstr = NULL;
43fe83
     virInterfaceDefPtr ifacedef = NULL;
43fe83
@@ -774,7 +776,7 @@ static virInterfacePtr netcfInterfaceDefineXML(virConnectPtr conn,
43fe83
                                                const char *xml,
43fe83
                                                unsigned int flags)
43fe83
 {
43fe83
-    struct interface_driver *driver = conn->interfacePrivateData;
43fe83
+    virNetcfDriverStatePtr driver = conn->interfacePrivateData;
43fe83
     struct netcf_if *iface = NULL;
43fe83
     char *xmlstr = NULL;
43fe83
     virInterfaceDefPtr ifacedef = NULL;
43fe83
@@ -821,7 +823,7 @@ cleanup:
43fe83
 }
43fe83
 
43fe83
 static int netcfInterfaceUndefine(virInterfacePtr ifinfo) {
43fe83
-    struct interface_driver *driver = ifinfo->conn->interfacePrivateData;
43fe83
+    virNetcfDriverStatePtr driver = ifinfo->conn->interfacePrivateData;
43fe83
     struct netcf_if *iface = NULL;
43fe83
     virInterfaceDefPtr def = NULL;
43fe83
     int ret = -1;
43fe83
@@ -862,7 +864,7 @@ cleanup:
43fe83
 static int netcfInterfaceCreate(virInterfacePtr ifinfo,
43fe83
                                 unsigned int flags)
43fe83
 {
43fe83
-    struct interface_driver *driver = ifinfo->conn->interfacePrivateData;
43fe83
+    virNetcfDriverStatePtr driver = ifinfo->conn->interfacePrivateData;
43fe83
     struct netcf_if *iface = NULL;
43fe83
     virInterfaceDefPtr def = NULL;
43fe83
     int ret = -1;
43fe83
@@ -905,7 +907,7 @@ cleanup:
43fe83
 static int netcfInterfaceDestroy(virInterfacePtr ifinfo,
43fe83
                                  unsigned int flags)
43fe83
 {
43fe83
-    struct interface_driver *driver = ifinfo->conn->interfacePrivateData;
43fe83
+    virNetcfDriverStatePtr driver = ifinfo->conn->interfacePrivateData;
43fe83
     struct netcf_if *iface = NULL;
43fe83
     virInterfaceDefPtr def = NULL;
43fe83
     int ret = -1;
43fe83
@@ -947,7 +949,7 @@ cleanup:
43fe83
 
43fe83
 static int netcfInterfaceIsActive(virInterfacePtr ifinfo)
43fe83
 {
43fe83
-    struct interface_driver *driver = ifinfo->conn->interfacePrivateData;
43fe83
+    virNetcfDriverStatePtr driver = ifinfo->conn->interfacePrivateData;
43fe83
     struct netcf_if *iface = NULL;
43fe83
     unsigned int flags = 0;
43fe83
     virInterfaceDefPtr def = NULL;
43fe83
@@ -990,7 +992,7 @@ cleanup:
43fe83
 #ifdef HAVE_NETCF_TRANSACTIONS
43fe83
 static int netcfInterfaceChangeBegin(virConnectPtr conn, unsigned int flags)
43fe83
 {
43fe83
-    struct interface_driver *driver = conn->interfacePrivateData;
43fe83
+    virNetcfDriverStatePtr driver = conn->interfacePrivateData;
43fe83
     int ret;
43fe83
 
43fe83
     virCheckFlags(0, -1); /* currently flags must be 0 */
43fe83
@@ -1016,7 +1018,7 @@ static int netcfInterfaceChangeBegin(virConnectPtr conn, unsigned int flags)
43fe83
 
43fe83
 static int netcfInterfaceChangeCommit(virConnectPtr conn, unsigned int flags)
43fe83
 {
43fe83
-    struct interface_driver *driver = conn->interfacePrivateData;
43fe83
+    virNetcfDriverStatePtr driver = conn->interfacePrivateData;
43fe83
     int ret;
43fe83
 
43fe83
     virCheckFlags(0, -1); /* currently flags must be 0 */
43fe83
@@ -1042,7 +1044,7 @@ static int netcfInterfaceChangeCommit(virConnectPtr conn, unsigned int flags)
43fe83
 
43fe83
 static int netcfInterfaceChangeRollback(virConnectPtr conn, unsigned int flags)
43fe83
 {
43fe83
-    struct interface_driver *driver = conn->interfacePrivateData;
43fe83
+    virNetcfDriverStatePtr driver = conn->interfacePrivateData;
43fe83
     int ret;
43fe83
 
43fe83
     virCheckFlags(0, -1); /* currently flags must be 0 */
43fe83
-- 
43fe83
1.8.3.2
43fe83