[RFC PATCH 1/3] driver: Implement new state driver field

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

 



This implements a new field in the virStateDriver struct. In order to prevent possible compilation issues, this patch also implements te new field in all of the existing drivers. Other than in driver.h, the changes are all a single line addition to the files.

Signed-off-by: Adam Walters <adam@xxxxxxxxxxxxxxxxx>
---
 src/config/config_driver.c              | 1 +
 src/driver.h                            | 6 ++++++
 src/interface/interface_backend_netcf.c | 1 +
 src/libxl/libxl_driver.c                | 1 +
 src/lxc/lxc_driver.c                    | 1 +
 src/network/bridge_driver.c             | 1 +
 src/node_device/node_device_hal.c       | 1 +
 src/node_device/node_device_udev.c      | 1 +
 src/nwfilter/nwfilter_driver.c          | 1 +
 src/qemu/qemu_driver.c                  | 1 +
 src/remote/remote_driver.c              | 1 +
 src/secret/secret_driver.c              | 1 +
 src/storage/storage_driver.c            | 1 +
 src/uml/uml_driver.c                    | 1 +
 src/xen/xen_driver.c                    | 1 +
 15 files changed, 20 insertions(+)

diff --git a/src/config/config_driver.c b/src/config/config_driver.c
index a057300..a817c7a 100644
--- a/src/config/config_driver.c
+++ b/src/config/config_driver.c
@@ -228,6 +228,7 @@ static virStateDriver configStateDriver = {
     .stateInitialize = configStateInitialize,
     .stateCleanup = configStateCleanup,
     .stateReload = configStateReload,
+    .stateType = VIR_DRV_STATE_DRV_LIBVIRT,
 };
 
 int configRegister(void) {
diff --git a/src/driver.h b/src/driver.h
index b6927ea..6863910 100644
--- a/src/driver.h
+++ b/src/driver.h
@@ -1833,6 +1833,11 @@ typedef int
 typedef int
 (*virDrvStateStop)(void);
 
+typedef enum {
+    VIR_DRV_STATE_DRV_LIBVIRT = 1,
+    VIR_DRV_STATE_DRV_HYPERVISOR = 2,
+} virDrvStateDrvType;
+
 typedef struct _virStateDriver virStateDriver;
 typedef virStateDriver *virStateDriverPtr;
 
@@ -1843,6 +1848,7 @@ struct _virStateDriver {
     virDrvStateCleanup stateCleanup;
     virDrvStateReload stateReload;
     virDrvStateStop stateStop;
+    virDrvStateDrvType stateType;
 };
 # endif
 
diff --git a/src/interface/interface_backend_netcf.c b/src/interface/interface_backend_netcf.c
index c4e18c4..8b910f9 100644
--- a/src/interface/interface_backend_netcf.c
+++ b/src/interface/interface_backend_netcf.c
@@ -1157,6 +1157,7 @@ static virStateDriver interfaceStateDriver = {
     .stateInitialize = netcfStateInitialize,
     .stateCleanup = netcfStateCleanup,
     .stateReload = netcfStateReload,
+    .stateType = VIR_DRV_STATE_DRV_LIBVIRT,
 };
 
 int netcfIfaceRegister(void) {
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index d91744f..cce7798 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -4292,6 +4292,7 @@ static virStateDriver libxlStateDriver = {
     .stateAutoStart = libxlStateAutoStart,
     .stateCleanup = libxlStateCleanup,
     .stateReload = libxlStateReload,
+    .stateType = VIR_DRV_STATE_DRV_HYPERVISOR,
 };
 
 
diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
index e5298d1..3fe88c6 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -4815,6 +4815,7 @@ static virStateDriver lxcStateDriver = {
     .stateAutoStart = lxcStateAutoStart,
     .stateCleanup = lxcStateCleanup,
     .stateReload = lxcStateReload,
+    .stateType = VIR_DRV_STATE_DRV_HYPERVISOR,
 };
 
 int lxcRegister(void)
diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index 3e10758..be49c78 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -3131,6 +3131,7 @@ static virStateDriver networkStateDriver = {
     .stateAutoStart  = networkStateAutoStart,
     .stateCleanup = networkStateCleanup,
     .stateReload = networkStateReload,
+    .stateType = VIR_DRV_STATE_DRV_LIBVIRT,
 };
 
 int networkRegister(void) {
diff --git a/src/node_device/node_device_hal.c b/src/node_device/node_device_hal.c
index fafd520..23cee5e 100644
--- a/src/node_device/node_device_hal.c
+++ b/src/node_device/node_device_hal.c
@@ -827,6 +827,7 @@ static virStateDriver halStateDriver = {
     .stateInitialize = nodeStateInitialize, /* 0.5.0 */
     .stateCleanup = nodeStateCleanup, /* 0.5.0 */
     .stateReload = nodeStateReload, /* 0.5.0 */
+    .stateType = VIR_DRV_STATE_DRV_LIBVIRT,
 };
 
 int
diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c
index 5d49968..6282072 100644
--- a/src/node_device/node_device_udev.c
+++ b/src/node_device/node_device_udev.c
@@ -1816,6 +1816,7 @@ static virStateDriver udevStateDriver = {
     .stateInitialize = nodeStateInitialize, /* 0.7.3 */
     .stateCleanup = nodeStateCleanup, /* 0.7.3 */
     .stateReload = nodeStateReload, /* 0.7.3 */
+    .stateType = VIR_DRV_STATE_DRV_LIBVIRT,
 };
 
 int udevNodeRegister(void)
diff --git a/src/nwfilter/nwfilter_driver.c b/src/nwfilter/nwfilter_driver.c
index d21dd82..a427a0b 100644
--- a/src/nwfilter/nwfilter_driver.c
+++ b/src/nwfilter/nwfilter_driver.c
@@ -702,6 +702,7 @@ static virStateDriver stateDriver = {
     .stateInitialize = nwfilterStateInitialize,
     .stateCleanup = nwfilterStateCleanup,
     .stateReload = nwfilterStateReload,
+    .stateType = VIR_DRV_STATE_DRV_LIBVIRT,
 };
 
 
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 45d11cd..8d68220 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -16190,6 +16190,7 @@ static virStateDriver qemuStateDriver = {
     .stateCleanup = qemuStateCleanup,
     .stateReload = qemuStateReload,
     .stateStop = qemuStateStop,
+    .stateType = VIR_DRV_STATE_DRV_HYPERVISOR,
 };
 
 int qemuRegister(void) {
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index be282d6..5e2fbd1 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -7299,6 +7299,7 @@ static virNWFilterDriver nwfilter_driver = {
 static virStateDriver state_driver = {
     .name = "Remote",
     .stateInitialize = remoteStateInitialize,
+    .stateType = VIR_DRV_STATE_DRV_LIBVIRT,
 };
 #endif
 
diff --git a/src/secret/secret_driver.c b/src/secret/secret_driver.c
index 9f7f946..32ee81d 100644
--- a/src/secret/secret_driver.c
+++ b/src/secret/secret_driver.c
@@ -1189,6 +1189,7 @@ static virStateDriver stateDriver = {
     .stateInitialize = secretStateInitialize,
     .stateCleanup = secretStateCleanup,
     .stateReload = secretStateReload,
+    .stateType = VIR_DRV_STATE_DRV_LIBVIRT,
 };
 
 int
diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c
index baba9c9..a614279 100644
--- a/src/storage/storage_driver.c
+++ b/src/storage/storage_driver.c
@@ -2646,6 +2646,7 @@ static virStateDriver stateDriver = {
     .stateAutoStart = storageStateAutoStart,
     .stateCleanup = storageStateCleanup,
     .stateReload = storageStateReload,
+    .stateType = VIR_DRV_STATE_DRV_LIBVIRT,
 };
 
 int storageRegister(void)
diff --git a/src/uml/uml_driver.c b/src/uml/uml_driver.c
index 1784eb5..336ffde 100644
--- a/src/uml/uml_driver.c
+++ b/src/uml/uml_driver.c
@@ -2900,6 +2900,7 @@ static virStateDriver umlStateDriver = {
     .stateAutoStart = umlStateAutoStart,
     .stateCleanup = umlStateCleanup,
     .stateReload = umlStateReload,
+    .stateType = VIR_DRV_STATE_DRV_HYPERVISOR,
 };
 
 int umlRegister(void) {
diff --git a/src/xen/xen_driver.c b/src/xen/xen_driver.c
index 4103dc9..97084ed 100644
--- a/src/xen/xen_driver.c
+++ b/src/xen/xen_driver.c
@@ -279,6 +279,7 @@ static virStateDriver state_driver = {
     .name = "Xen",
     .stateInitialize = xenUnifiedStateInitialize,
     .stateCleanup = xenUnifiedStateCleanup,
+    .stateType = VIR_DRV_STATE_DRV_HYPERVISOR,
 };
 
 /*----- Dispatch functions. -----*/
-- 
1.8.5.2

--
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]