]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
vbox: Rewrite vboxNetworkOpen
authorTaowei <uaedante@gmail.com>
Thu, 2 Oct 2014 03:30:26 +0000 (11:30 +0800)
committerMichal Privoznik <mprivozn@redhat.com>
Fri, 3 Oct 2014 08:43:03 +0000 (10:43 +0200)
src/Makefile.am
src/vbox/vbox_network.c [new file with mode: 0644]
src/vbox/vbox_tmpl.c
src/vbox/vbox_uniformed_api.h

index dcd2ae237e37caa43ca000304174405e74adacdb..34eb9f83e303d5753cfe39e3342e643d6ded0550 100644 (file)
@@ -678,6 +678,7 @@ VBOX_DRIVER_SOURCES =                                               \
        vbox/vbox_V4_3.c vbox/vbox_CAPI_v4_3.h                  \
        vbox/vbox_V4_3_4.c vbox/vbox_CAPI_v4_3_4.h              \
        vbox/vbox_common.c vbox/vbox_common.h                   \
+       vbox/vbox_network.c                                     \
        vbox/vbox_uniformed_api.h                               \
        vbox/vbox_get_driver.h
 
diff --git a/src/vbox/vbox_network.c b/src/vbox/vbox_network.c
new file mode 100644 (file)
index 0000000..b8998f4
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2014 Taowei Luo (uaedante@gmail.com)
+ * Copyright (C) 2010-2014 Red Hat, Inc.
+ * Copyright (C) 2008-2009 Sun Microsystems, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library.  If not, see
+ * <http://www.gnu.org/licenses/>.
+ */
+
+#include <config.h>
+
+#include "internal.h"
+#include "datatypes.h"
+#include "domain_conf.h"
+#include "domain_event.h"
+#include "virlog.h"
+
+#include "vbox_common.h"
+#include "vbox_uniformed_api.h"
+
+#define VIR_FROM_THIS VIR_FROM_VBOX
+
+VIR_LOG_INIT("vbox.vbox_network");
+
+/**
+ * The Network Functions here on
+ */
+
+virDrvOpenStatus vboxNetworkOpen(virConnectPtr conn,
+                                 virConnectAuthPtr auth ATTRIBUTE_UNUSED,
+                                 unsigned int flags)
+{
+    vboxGlobalData *data = conn->privateData;
+
+    virCheckFlags(VIR_CONNECT_RO, VIR_DRV_OPEN_ERROR);
+
+    if (STRNEQ(conn->driver->name, "VBOX"))
+        goto cleanup;
+
+    if (!data->pFuncs || !data->vboxObj || !data->vboxSession)
+        goto cleanup;
+
+    VIR_DEBUG("network initialized");
+    /* conn->networkPrivateData = some network specific data */
+    return VIR_DRV_OPEN_SUCCESS;
+
+ cleanup:
+    return VIR_DRV_OPEN_DECLINED;
+}
index e5d6d66a875af057c96beca7edd990a35299696a..da3841f839c174a41b87c3016e39fba057851d0c 100644 (file)
@@ -2059,30 +2059,6 @@ _registerDomainEvent(virDriverPtr driver)
 /**
  * The Network Functions here on
  */
-static virDrvOpenStatus vboxNetworkOpen(virConnectPtr conn,
-                                        virConnectAuthPtr auth ATTRIBUTE_UNUSED,
-                                        unsigned int flags)
-{
-    vboxGlobalData *data = conn->privateData;
-
-    virCheckFlags(VIR_CONNECT_RO, VIR_DRV_OPEN_ERROR);
-
-    if (STRNEQ(conn->driver->name, "VBOX"))
-        goto cleanup;
-
-    if ((data->pFuncs      == NULL) ||
-        (data->vboxObj     == NULL) ||
-        (data->vboxSession == NULL))
-        goto cleanup;
-
-    VIR_DEBUG("network initialized");
-    /* conn->networkPrivateData = some network specific data */
-    return VIR_DRV_OPEN_SUCCESS;
-
- cleanup:
-    return VIR_DRV_OPEN_DECLINED;
-}
-
 static int vboxNetworkClose(virConnectPtr conn)
 {
     VIR_DEBUG("network uninitialized");
index 41ce40f26c54fb3bdbf48990238545151a1b6210..0237160b0cac041cf4020c5644d163a55251f168 100644 (file)
@@ -534,6 +534,9 @@ typedef struct {
 
 virDomainPtr vboxDomainLookupByUUID(virConnectPtr conn,
                                     const unsigned char *uuid);
+virDrvOpenStatus vboxNetworkOpen(virConnectPtr conn,
+                                 virConnectAuthPtr auth,
+                                 unsigned int flags);
 
 /* Version specified functions for installing uniformed API */
 void vbox22InstallUniformedAPI(vboxUniformedAPI *pVBoxAPI);