From: "Daniel P. Berrange" <berrange@xxxxxxxxxx> The driver.h struct for node devices used an inconsistent naming scheme 'DeviceMonitor' instead of the more usual 'NodeDeviceDriver'. Fix this everywhere it has leaked out to. Signed-off-by: Daniel P. Berrange <berrange@xxxxxxxxxx> --- docs/hvsupport.pl | 4 +- src/conf/node_device_conf.h | 6 +-- src/datatypes.c | 4 +- src/datatypes.h | 4 +- src/driver.h | 10 ++--- src/esx/esx_device_monitor.c | 8 ++-- src/hyperv/hyperv_device_monitor.c | 8 ++-- src/libvirt.c | 76 ++++++++++++++++++------------------ src/libvirt_private.syms | 2 +- src/node_device/node_device_driver.c | 28 ++++++------- src/node_device/node_device_driver.h | 4 +- src/node_device/node_device_hal.c | 30 +++++++------- src/node_device/node_device_udev.c | 30 +++++++------- src/remote/remote_driver.c | 24 ++++++------ src/rpc/gendispatch.pl | 4 +- src/test/test_driver.c | 20 +++++----- tests/object-locking.ml | 4 +- 17 files changed, 133 insertions(+), 133 deletions(-) diff --git a/docs/hvsupport.pl b/docs/hvsupport.pl index baebfc4..707b512 100755 --- a/docs/hvsupport.pl +++ b/docs/hvsupport.pl @@ -18,7 +18,7 @@ my %groupheaders = ( "virDriver" => "Hypervisor APIs", "virNetworkDriver" => "Virtual Network APIs", "virInterfaceDriver" => "Host Interface APIs", - "virDeviceMonitor" => "Host Device APIs", + "virNodeDeviceDriver" => "Host Device APIs", "virStorageDriver" => "Storage Pool APIs", "virSecretDriver" => "Secret APIs", "virNWFilterDriver" => "Network Filter APIs", @@ -182,7 +182,7 @@ open FILE, "<$drivertable" my %groups; my $ingrp; while (defined($line = <FILE>)) { - if ($line =~ /struct _(vir\w*(?:Driver|Monitor))/) { + if ($line =~ /struct _(vir\w*Driver)/) { my $grp = $1; if ($grp ne "virStateDriver" && $grp ne "virStreamDriver") { diff --git a/src/conf/node_device_conf.h b/src/conf/node_device_conf.h index ca5ec72..1c5855c 100644 --- a/src/conf/node_device_conf.h +++ b/src/conf/node_device_conf.h @@ -200,9 +200,9 @@ struct _virNodeDeviceObjList { virNodeDeviceObjPtr *objs; }; -typedef struct _virDeviceMonitorState virDeviceMonitorState; -typedef virDeviceMonitorState *virDeviceMonitorStatePtr; -struct _virDeviceMonitorState { +typedef struct _virNodeDeviceDriverState virNodeDeviceDriverState; +typedef virNodeDeviceDriverState *virNodeDeviceDriverStatePtr; +struct _virNodeDeviceDriverState { virMutex lock; virNodeDeviceObjList devs; /* currently-known devices */ diff --git a/src/datatypes.c b/src/datatypes.c index f8b6f49..f6c01ce 100644 --- a/src/datatypes.c +++ b/src/datatypes.c @@ -149,8 +149,8 @@ virConnectDispose(void *obj) conn->interfaceDriver->connectClose(conn); if (conn->storageDriver) conn->storageDriver->connectClose(conn); - if (conn->deviceMonitor) - conn->deviceMonitor->connectClose(conn); + if (conn->nodeDeviceDriver) + conn->nodeDeviceDriver->connectClose(conn); if (conn->secretDriver) conn->secretDriver->connectClose(conn); if (conn->nwfilterDriver) diff --git a/src/datatypes.h b/src/datatypes.h index e5ecf18..6026bb0 100644 --- a/src/datatypes.h +++ b/src/datatypes.h @@ -128,7 +128,7 @@ struct _virConnect { virNetworkDriverPtr networkDriver; virInterfaceDriverPtr interfaceDriver; virStorageDriverPtr storageDriver; - virDeviceMonitorPtr deviceMonitor; + virNodeDeviceDriverPtr nodeDeviceDriver; virSecretDriverPtr secretDriver; virNWFilterDriverPtr nwfilterDriver; @@ -140,7 +140,7 @@ struct _virConnect { void * networkPrivateData; void * interfacePrivateData; void * storagePrivateData; - void * devMonPrivateData; + void * nodeDevicePrivateData; void * secretPrivateData; void * nwfilterPrivateData; diff --git a/src/driver.h b/src/driver.h index 8eb25ea..8b4f603 100644 --- a/src/driver.h +++ b/src/driver.h @@ -1757,17 +1757,17 @@ typedef int -typedef struct _virDeviceMonitor virDeviceMonitor; -typedef virDeviceMonitor *virDeviceMonitorPtr; +typedef struct _virNodeDeviceDriver virNodeDeviceDriver; +typedef virNodeDeviceDriver *virNodeDeviceDriverPtr; /** - * _virDeviceMonitor: + * _virNodeDeviceDriver: * * Structure associated with monitoring the devices * on a virtualized node. * */ -struct _virDeviceMonitor { +struct _virNodeDeviceDriver { const char * name; /* the name of the driver */ virDrvConnectOpen connectOpen; virDrvConnectClose connectClose; @@ -1980,7 +1980,7 @@ int virRegisterDriver(virDriverPtr); int virRegisterNetworkDriver(virNetworkDriverPtr); int virRegisterInterfaceDriver(virInterfaceDriverPtr); int virRegisterStorageDriver(virStorageDriverPtr); -int virRegisterDeviceMonitor(virDeviceMonitorPtr); +int virRegisterNodeDeviceDriver(virNodeDeviceDriverPtr); int virRegisterSecretDriver(virSecretDriverPtr); int virRegisterNWFilterDriver(virNWFilterDriverPtr); # ifdef WITH_LIBVIRTD diff --git a/src/esx/esx_device_monitor.c b/src/esx/esx_device_monitor.c index 826b171..0812bdf 100644 --- a/src/esx/esx_device_monitor.c +++ b/src/esx/esx_device_monitor.c @@ -50,7 +50,7 @@ esxDeviceOpen(virConnectPtr conn, return VIR_DRV_OPEN_DECLINED; } - conn->devMonPrivateData = conn->privateData; + conn->nodeDevicePrivateData = conn->privateData; return VIR_DRV_OPEN_SUCCESS; } @@ -60,14 +60,14 @@ esxDeviceOpen(virConnectPtr conn, static int esxDeviceClose(virConnectPtr conn) { - conn->devMonPrivateData = NULL; + conn->nodeDevicePrivateData = NULL; return 0; } -static virDeviceMonitor esxDeviceMonitor = { +static virNodeDeviceDriver esxNodeDeviceDriver = { .name = "ESX", .connectOpen = esxDeviceOpen, /* 0.7.6 */ .connectClose = esxDeviceClose, /* 0.7.6 */ @@ -78,5 +78,5 @@ static virDeviceMonitor esxDeviceMonitor = { int esxDeviceRegister(void) { - return virRegisterDeviceMonitor(&esxDeviceMonitor); + return virRegisterNodeDeviceDriver(&esxNodeDeviceDriver); } diff --git a/src/hyperv/hyperv_device_monitor.c b/src/hyperv/hyperv_device_monitor.c index cf3ba25..ace9e71 100644 --- a/src/hyperv/hyperv_device_monitor.c +++ b/src/hyperv/hyperv_device_monitor.c @@ -47,7 +47,7 @@ hypervDeviceOpen(virConnectPtr conn, return VIR_DRV_OPEN_DECLINED; } - conn->devMonPrivateData = conn->privateData; + conn->nodeDevicePrivateData = conn->privateData; return VIR_DRV_OPEN_SUCCESS; } @@ -57,14 +57,14 @@ hypervDeviceOpen(virConnectPtr conn, static int hypervDeviceClose(virConnectPtr conn) { - conn->devMonPrivateData = NULL; + conn->nodeDevicePrivateData = NULL; return 0; } -static virDeviceMonitor hypervDeviceMonitor = { +static virNodeDeviceDriver hypervNodeDeviceDriver = { "Hyper-V", .connectOpen = hypervDeviceOpen, /* 0.9.5 */ .connectClose = hypervDeviceClose, /* 0.9.5 */ @@ -75,5 +75,5 @@ static virDeviceMonitor hypervDeviceMonitor = { int hypervDeviceRegister(void) { - return virRegisterDeviceMonitor(&hypervDeviceMonitor); + return virRegisterNodeDeviceDriver(&hypervNodeDeviceDriver); } diff --git a/src/libvirt.c b/src/libvirt.c index 7818e7f..b784bee 100644 --- a/src/libvirt.c +++ b/src/libvirt.c @@ -112,8 +112,8 @@ static virInterfaceDriverPtr virInterfaceDriverTab[MAX_DRIVERS]; static int virInterfaceDriverTabCount = 0; static virStorageDriverPtr virStorageDriverTab[MAX_DRIVERS]; static int virStorageDriverTabCount = 0; -static virDeviceMonitorPtr virDeviceMonitorTab[MAX_DRIVERS]; -static int virDeviceMonitorTabCount = 0; +static virNodeDeviceDriverPtr virNodeDeviceDriverTab[MAX_DRIVERS]; +static int virNodeDeviceDriverTabCount = 0; static virSecretDriverPtr virSecretDriverTab[MAX_DRIVERS]; static int virSecretDriverTabCount = 0; static virNWFilterDriverPtr virNWFilterDriverTab[MAX_DRIVERS]; @@ -672,7 +672,7 @@ virRegisterStorageDriver(virStorageDriverPtr driver) } /** - * virRegisterDeviceMonitor: + * virRegisterNodeDeviceDriver: * @driver: pointer to a device monitor block * * Register a device monitor @@ -680,11 +680,11 @@ virRegisterStorageDriver(virStorageDriverPtr driver) * Returns the driver priority or -1 in case of error. */ int -virRegisterDeviceMonitor(virDeviceMonitorPtr driver) +virRegisterNodeDeviceDriver(virNodeDeviceDriverPtr driver) { virCheckNonNullArgReturn(driver, -1); - if (virDeviceMonitorTabCount >= MAX_DRIVERS) { + if (virNodeDeviceDriverTabCount >= MAX_DRIVERS) { virLibConnError(VIR_ERR_INTERNAL_ERROR, _("Too many drivers, cannot register %s"), driver->name); @@ -692,10 +692,10 @@ virRegisterDeviceMonitor(virDeviceMonitorPtr driver) } VIR_DEBUG("registering %s as device driver %d", - driver->name, virDeviceMonitorTabCount); + driver->name, virNodeDeviceDriverTabCount); - virDeviceMonitorTab[virDeviceMonitorTabCount] = driver; - return virDeviceMonitorTabCount++; + virNodeDeviceDriverTab[virNodeDeviceDriverTabCount] = driver; + return virNodeDeviceDriverTabCount++; } /** @@ -1282,16 +1282,16 @@ do_open(const char *name, } /* Node driver (optional) */ - for (i = 0; i < virDeviceMonitorTabCount; i++) { - res = virDeviceMonitorTab[i]->connectOpen(ret, auth, flags); + for (i = 0; i < virNodeDeviceDriverTabCount; i++) { + res = virNodeDeviceDriverTab[i]->connectOpen(ret, auth, flags); VIR_DEBUG("node driver %d %s returned %s", - i, virDeviceMonitorTab[i]->name, + i, virNodeDeviceDriverTab[i]->name, res == VIR_DRV_OPEN_SUCCESS ? "SUCCESS" : (res == VIR_DRV_OPEN_DECLINED ? "DECLINED" : (res == VIR_DRV_OPEN_ERROR ? "ERROR" : "unknown status"))); if (res == VIR_DRV_OPEN_SUCCESS) { - ret->deviceMonitor = virDeviceMonitorTab[i]; + ret->nodeDeviceDriver = virNodeDeviceDriverTab[i]; break; } else if (res == VIR_DRV_OPEN_ERROR) { break; @@ -14220,9 +14220,9 @@ virNodeNumOfDevices(virConnectPtr conn, const char *cap, unsigned int flags) return -1; } - if (conn->deviceMonitor && conn->deviceMonitor->nodeNumOfDevices) { + if (conn->nodeDeviceDriver && conn->nodeDeviceDriver->nodeNumOfDevices) { int ret; - ret = conn->deviceMonitor->nodeNumOfDevices(conn, cap, flags); + ret = conn->nodeDeviceDriver->nodeNumOfDevices(conn, cap, flags); if (ret < 0) goto error; return ret; @@ -14291,10 +14291,10 @@ virConnectListAllNodeDevices(virConnectPtr conn, return -1; } - if (conn->deviceMonitor && - conn->deviceMonitor->connectListAllNodeDevices) { + if (conn->nodeDeviceDriver && + conn->nodeDeviceDriver->connectListAllNodeDevices) { int ret; - ret = conn->deviceMonitor->connectListAllNodeDevices(conn, devices, flags); + ret = conn->nodeDeviceDriver->connectListAllNodeDevices(conn, devices, flags); if (ret < 0) goto error; return ret; @@ -14343,9 +14343,9 @@ virNodeListDevices(virConnectPtr conn, virCheckNonNullArgGoto(names, error); virCheckNonNegativeArgGoto(maxnames, error); - if (conn->deviceMonitor && conn->deviceMonitor->nodeListDevices) { + if (conn->nodeDeviceDriver && conn->nodeDeviceDriver->nodeListDevices) { int ret; - ret = conn->deviceMonitor->nodeListDevices(conn, cap, names, maxnames, flags); + ret = conn->nodeDeviceDriver->nodeListDevices(conn, cap, names, maxnames, flags); if (ret < 0) goto error; return ret; @@ -14382,9 +14382,9 @@ virNodeDevicePtr virNodeDeviceLookupByName(virConnectPtr conn, const char *name) virCheckNonNullArgGoto(name, error); - if (conn->deviceMonitor && conn->deviceMonitor->nodeDeviceLookupByName) { + if (conn->nodeDeviceDriver && conn->nodeDeviceDriver->nodeDeviceLookupByName) { virNodeDevicePtr ret; - ret = conn->deviceMonitor->nodeDeviceLookupByName(conn, name); + ret = conn->nodeDeviceDriver->nodeDeviceLookupByName(conn, name); if (!ret) goto error; return ret; @@ -14427,10 +14427,10 @@ virNodeDeviceLookupSCSIHostByWWN(virConnectPtr conn, virCheckNonNullArgGoto(wwnn, error); virCheckNonNullArgGoto(wwpn, error); - if (conn->deviceMonitor && - conn->deviceMonitor->nodeDeviceLookupSCSIHostByWWN) { + if (conn->nodeDeviceDriver && + conn->nodeDeviceDriver->nodeDeviceLookupSCSIHostByWWN) { virNodeDevicePtr ret; - ret = conn->deviceMonitor->nodeDeviceLookupSCSIHostByWWN(conn, wwnn, + ret = conn->nodeDeviceDriver->nodeDeviceLookupSCSIHostByWWN(conn, wwnn, wwpn, flags); if (!ret) goto error; @@ -14466,9 +14466,9 @@ char *virNodeDeviceGetXMLDesc(virNodeDevicePtr dev, unsigned int flags) return NULL; } - if (dev->conn->deviceMonitor && dev->conn->deviceMonitor->nodeDeviceGetXMLDesc) { + if (dev->conn->nodeDeviceDriver && dev->conn->nodeDeviceDriver->nodeDeviceGetXMLDesc) { char *ret; - ret = dev->conn->deviceMonitor->nodeDeviceGetXMLDesc(dev, flags); + ret = dev->conn->nodeDeviceDriver->nodeDeviceGetXMLDesc(dev, flags); if (!ret) goto error; return ret; @@ -14525,8 +14525,8 @@ const char *virNodeDeviceGetParent(virNodeDevicePtr dev) } if (!dev->parent) { - if (dev->conn->deviceMonitor && dev->conn->deviceMonitor->nodeDeviceGetParent) { - dev->parent = dev->conn->deviceMonitor->nodeDeviceGetParent(dev); + if (dev->conn->nodeDeviceDriver && dev->conn->nodeDeviceDriver->nodeDeviceGetParent) { + dev->parent = dev->conn->nodeDeviceDriver->nodeDeviceGetParent(dev); } else { virLibConnError(VIR_ERR_NO_SUPPORT, __FUNCTION__); virDispatchError(dev->conn); @@ -14556,9 +14556,9 @@ int virNodeDeviceNumOfCaps(virNodeDevicePtr dev) return -1; } - if (dev->conn->deviceMonitor && dev->conn->deviceMonitor->nodeDeviceNumOfCaps) { + if (dev->conn->nodeDeviceDriver && dev->conn->nodeDeviceDriver->nodeDeviceNumOfCaps) { int ret; - ret = dev->conn->deviceMonitor->nodeDeviceNumOfCaps(dev); + ret = dev->conn->nodeDeviceDriver->nodeDeviceNumOfCaps(dev); if (ret < 0) goto error; return ret; @@ -14599,9 +14599,9 @@ int virNodeDeviceListCaps(virNodeDevicePtr dev, virCheckNonNullArgGoto(names, error); virCheckNonNegativeArgGoto(maxnames, error); - if (dev->conn->deviceMonitor && dev->conn->deviceMonitor->nodeDeviceListCaps) { + if (dev->conn->nodeDeviceDriver && dev->conn->nodeDeviceDriver->nodeDeviceListCaps) { int ret; - ret = dev->conn->deviceMonitor->nodeDeviceListCaps(dev, names, maxnames); + ret = dev->conn->nodeDeviceDriver->nodeDeviceListCaps(dev, names, maxnames); if (ret < 0) goto error; return ret; @@ -14854,9 +14854,9 @@ virNodeDeviceCreateXML(virConnectPtr conn, virCheckNonNullArgGoto(xmlDesc, error); - if (conn->deviceMonitor && - conn->deviceMonitor->nodeDeviceCreateXML) { - virNodeDevicePtr dev = conn->deviceMonitor->nodeDeviceCreateXML(conn, xmlDesc, flags); + if (conn->nodeDeviceDriver && + conn->nodeDeviceDriver->nodeDeviceCreateXML) { + virNodeDevicePtr dev = conn->nodeDeviceDriver->nodeDeviceCreateXML(conn, xmlDesc, flags); if (dev == NULL) goto error; return dev; @@ -14897,9 +14897,9 @@ virNodeDeviceDestroy(virNodeDevicePtr dev) goto error; } - if (dev->conn->deviceMonitor && - dev->conn->deviceMonitor->nodeDeviceDestroy) { - int retval = dev->conn->deviceMonitor->nodeDeviceDestroy(dev); + if (dev->conn->nodeDeviceDriver && + dev->conn->nodeDeviceDriver->nodeDeviceDestroy) { + int retval = dev->conn->nodeDeviceDriver->nodeDeviceDestroy(dev); if (retval < 0) { goto error; } diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index c4ae681..b3f8521 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -713,10 +713,10 @@ virDomainMigratePrepare2; virDomainMigratePrepare3; virDomainMigratePrepareTunnel; virDomainMigratePrepareTunnel3; -virRegisterDeviceMonitor; virRegisterDriver; virRegisterInterfaceDriver; virRegisterNetworkDriver; +virRegisterNodeDeviceDriver; virRegisterNWFilterDriver; virRegisterSecretDriver; virRegisterStorageDriver; diff --git a/src/node_device/node_device_driver.c b/src/node_device/node_device_driver.c index 6be7a25..c9bd68b 100644 --- a/src/node_device/node_device_driver.c +++ b/src/node_device/node_device_driver.c @@ -112,11 +112,11 @@ static int update_driver_name(virNodeDeviceObjPtr dev ATTRIBUTE_UNUSED) #endif -void nodeDeviceLock(virDeviceMonitorStatePtr driver) +void nodeDeviceLock(virNodeDeviceDriverStatePtr driver) { virMutexLock(&driver->lock); } -void nodeDeviceUnlock(virDeviceMonitorStatePtr driver) +void nodeDeviceUnlock(virNodeDeviceDriverStatePtr driver) { virMutexUnlock(&driver->lock); } @@ -126,7 +126,7 @@ nodeNumOfDevices(virConnectPtr conn, const char *cap, unsigned int flags) { - virDeviceMonitorStatePtr driver = conn->devMonPrivateData; + virNodeDeviceDriverStatePtr driver = conn->nodeDevicePrivateData; int ndevs = 0; unsigned int i; @@ -151,7 +151,7 @@ nodeListDevices(virConnectPtr conn, char **const names, int maxnames, unsigned int flags) { - virDeviceMonitorStatePtr driver = conn->devMonPrivateData; + virNodeDeviceDriverStatePtr driver = conn->nodeDevicePrivateData; int ndevs = 0; unsigned int i; @@ -187,7 +187,7 @@ nodeListAllNodeDevices(virConnectPtr conn, virNodeDevicePtr **devices, unsigned int flags) { - virDeviceMonitorStatePtr driver = conn->devMonPrivateData; + virNodeDeviceDriverStatePtr driver = conn->nodeDevicePrivateData; int ret = -1; virCheckFlags(VIR_CONNECT_LIST_NODE_DEVICES_FILTERS_CAP, -1); @@ -201,7 +201,7 @@ nodeListAllNodeDevices(virConnectPtr conn, virNodeDevicePtr nodeDeviceLookupByName(virConnectPtr conn, const char *name) { - virDeviceMonitorStatePtr driver = conn->devMonPrivateData; + virNodeDeviceDriverStatePtr driver = conn->nodeDevicePrivateData; virNodeDeviceObjPtr obj; virNodeDevicePtr ret = NULL; @@ -230,7 +230,7 @@ nodeDeviceLookupSCSIHostByWWN(virConnectPtr conn, unsigned int flags) { unsigned int i; - virDeviceMonitorStatePtr driver = conn->devMonPrivateData; + virNodeDeviceDriverStatePtr driver = conn->nodeDevicePrivateData; virNodeDeviceObjListPtr devs = &driver->devs; virNodeDevCapsDefPtr cap = NULL; virNodeDeviceObjPtr obj = NULL; @@ -274,7 +274,7 @@ char * nodeDeviceGetXMLDesc(virNodeDevicePtr dev, unsigned int flags) { - virDeviceMonitorStatePtr driver = dev->conn->devMonPrivateData; + virNodeDeviceDriverStatePtr driver = dev->conn->nodeDevicePrivateData; virNodeDeviceObjPtr obj; char *ret = NULL; @@ -306,7 +306,7 @@ cleanup: char * nodeDeviceGetParent(virNodeDevicePtr dev) { - virDeviceMonitorStatePtr driver = dev->conn->devMonPrivateData; + virNodeDeviceDriverStatePtr driver = dev->conn->nodeDevicePrivateData; virNodeDeviceObjPtr obj; char *ret = NULL; @@ -340,7 +340,7 @@ cleanup: int nodeDeviceNumOfCaps(virNodeDevicePtr dev) { - virDeviceMonitorStatePtr driver = dev->conn->devMonPrivateData; + virNodeDeviceDriverStatePtr driver = dev->conn->nodeDevicePrivateData; virNodeDeviceObjPtr obj; virNodeDevCapsDefPtr caps; int ncaps = 0; @@ -371,7 +371,7 @@ cleanup: int nodeDeviceListCaps(virNodeDevicePtr dev, char **const names, int maxnames) { - virDeviceMonitorStatePtr driver = dev->conn->devMonPrivateData; + virNodeDeviceDriverStatePtr driver = dev->conn->nodeDevicePrivateData; virNodeDeviceObjPtr obj; virNodeDevCapsDefPtr caps; int ncaps = 0; @@ -442,7 +442,7 @@ get_time(time_t *t) static virNodeDevicePtr find_new_device(virConnectPtr conn, const char *wwnn, const char *wwpn) { - virDeviceMonitorStatePtr driver = conn->devMonPrivateData; + virNodeDeviceDriverStatePtr driver = conn->nodeDevicePrivateData; virNodeDevicePtr dev = NULL; time_t start = 0, now = 0; @@ -481,7 +481,7 @@ nodeDeviceCreateXML(virConnectPtr conn, const char *xmlDesc, unsigned int flags) { - virDeviceMonitorStatePtr driver = conn->devMonPrivateData; + virNodeDeviceDriverStatePtr driver = conn->nodeDevicePrivateData; virNodeDeviceDefPtr def = NULL; char *wwnn = NULL, *wwpn = NULL; int parent_host = -1; @@ -537,7 +537,7 @@ int nodeDeviceDestroy(virNodeDevicePtr dev) { int ret = -1; - virDeviceMonitorStatePtr driver = dev->conn->devMonPrivateData; + virNodeDeviceDriverStatePtr driver = dev->conn->nodeDevicePrivateData; virNodeDeviceObjPtr obj = NULL; char *parent_name = NULL, *wwnn = NULL, *wwpn = NULL; int parent_host = -1; diff --git a/src/node_device/node_device_driver.h b/src/node_device/node_device_driver.h index ea81917..b6c6f18 100644 --- a/src/node_device/node_device_driver.h +++ b/src/node_device/node_device_driver.h @@ -46,8 +46,8 @@ int halNodeRegister(void); int udevNodeRegister(void); # endif -void nodeDeviceLock(virDeviceMonitorStatePtr driver); -void nodeDeviceUnlock(virDeviceMonitorStatePtr driver); +void nodeDeviceLock(virNodeDeviceDriverStatePtr driver); +void nodeDeviceUnlock(virNodeDeviceDriverStatePtr driver); int nodedevRegister(void); diff --git a/src/node_device/node_device_hal.c b/src/node_device/node_device_hal.c index 16c59d9..682b66a 100644 --- a/src/node_device/node_device_hal.c +++ b/src/node_device/node_device_hal.c @@ -46,10 +46,10 @@ * Host device enumeration (HAL implementation) */ -static virDeviceMonitorStatePtr driverState; +static virNodeDeviceDriverStatePtr driverState; #define CONN_DRV_STATE(conn) \ - ((virDeviceMonitorStatePtr)((conn)->devMonPrivateData)) + ((virNodeDeviceDriverStatePtr)((conn)->nodeDevicePrivateData)) #define DRV_STATE_HAL_CTX(ds) ((LibHalContext *)((ds)->privateData)) #define CONN_HAL_CTX(conn) DRV_STATE_HAL_CTX(CONN_DRV_STATE(conn)) @@ -590,9 +590,9 @@ static void device_prop_modified(LibHalContext *ctx ATTRIBUTE_UNUSED, } -static int halDeviceMonitorStartup(bool privileged ATTRIBUTE_UNUSED, - virStateInhibitCallback callback ATTRIBUTE_UNUSED, - void *opaque ATTRIBUTE_UNUSED) +static int halNodeDeviceDriverStartup(bool privileged ATTRIBUTE_UNUSED, + virStateInhibitCallback callback ATTRIBUTE_UNUSED, + void *opaque ATTRIBUTE_UNUSED) { LibHalContext *hal_ctx = NULL; char **udi = NULL; @@ -691,7 +691,7 @@ static int halDeviceMonitorStartup(bool privileged ATTRIBUTE_UNUSED, } -static int halDeviceMonitorShutdown(void) +static int halNodeDeviceDriverShutdown(void) { if (driverState) { nodeDeviceLock(driverState); @@ -708,7 +708,7 @@ static int halDeviceMonitorShutdown(void) } -static int halDeviceMonitorReload(void) +static int halNodeDeviceDriverReload(void) { DBusError err; char **udi = NULL; @@ -749,20 +749,20 @@ static virDrvOpenStatus halNodeDrvOpen(virConnectPtr conn, if (driverState == NULL) return VIR_DRV_OPEN_DECLINED; - conn->devMonPrivateData = driverState; + conn->nodeDevicePrivateData = driverState; return VIR_DRV_OPEN_SUCCESS; } static int halNodeDrvClose(virConnectPtr conn ATTRIBUTE_UNUSED) { - conn->devMonPrivateData = NULL; + conn->nodeDevicePrivateData = NULL; return 0; } -static virDeviceMonitor halDeviceMonitor = { - .name = "halDeviceMonitor", +static virNodeDeviceDriver halNodeDeviceDriver = { + .name = "halNodeDeviceDriver", .connectOpen = halNodeDrvOpen, /* 0.5.0 */ .connectClose = halNodeDrvClose, /* 0.5.0 */ .nodeNumOfDevices = nodeNumOfDevices, /* 0.5.0 */ @@ -781,14 +781,14 @@ static virDeviceMonitor halDeviceMonitor = { static virStateDriver halStateDriver = { .name = "HAL", - .stateInitialize = halDeviceMonitorStartup, /* 0.5.0 */ - .stateCleanup = halDeviceMonitorShutdown, /* 0.5.0 */ - .stateReload = halDeviceMonitorReload, /* 0.5.0 */ + .stateInitialize = halNodeDeviceDriverStartup, /* 0.5.0 */ + .stateCleanup = halNodeDeviceDriverShutdown, /* 0.5.0 */ + .stateReload = halNodeDeviceDriverReload, /* 0.5.0 */ }; int halNodeRegister(void) { - if (virRegisterDeviceMonitor(&halDeviceMonitor) < 0) + if (virRegisterNodeDeviceDriver(&halNodeDeviceDriver) < 0) return -1; return virRegisterStateDriver(&halStateDriver); } diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c index 353cac5..5a9c6e3 100644 --- a/src/node_device/node_device_udev.c +++ b/src/node_device/node_device_udev.c @@ -50,7 +50,7 @@ struct _udevPrivate { int watch; }; -static virDeviceMonitorStatePtr driverState = NULL; +static virNodeDeviceDriverStatePtr driverState = NULL; static int udevStrToLong_ull(char const *s, char **end_ptr, @@ -1437,7 +1437,7 @@ out: } -static int udevDeviceMonitorShutdown(void) +static int udevNodeDeviceDriverShutdown(void) { int ret = 0; @@ -1649,9 +1649,9 @@ out: return ret; } -static int udevDeviceMonitorStartup(bool privileged ATTRIBUTE_UNUSED, - virStateInhibitCallback callback ATTRIBUTE_UNUSED, - void *opaque ATTRIBUTE_UNUSED) +static int udevNodeDeviceDriverStartup(bool privileged ATTRIBUTE_UNUSED, + virStateInhibitCallback callback ATTRIBUTE_UNUSED, + void *opaque ATTRIBUTE_UNUSED) { udevPrivate *priv = NULL; struct udev *udev = NULL; @@ -1758,13 +1758,13 @@ out_unlock: out: if (ret == -1) { - udevDeviceMonitorShutdown(); + udevNodeDeviceDriverShutdown(); } return ret; } -static int udevDeviceMonitorReload(void) +static int udevNodeDeviceDriverReload(void) { return 0; } @@ -1780,19 +1780,19 @@ static virDrvOpenStatus udevNodeDrvOpen(virConnectPtr conn, return VIR_DRV_OPEN_DECLINED; } - conn->devMonPrivateData = driverState; + conn->nodeDevicePrivateData = driverState; return VIR_DRV_OPEN_SUCCESS; } static int udevNodeDrvClose(virConnectPtr conn) { - conn->devMonPrivateData = NULL; + conn->nodeDevicePrivateData = NULL; return 0; } -static virDeviceMonitor udevDeviceMonitor = { - .name = "udevDeviceMonitor", +static virNodeDeviceDriver udevNodeDeviceDriver = { + .name = "udevNodeDeviceDriver", .connectOpen = udevNodeDrvOpen, /* 0.7.3 */ .connectClose = udevNodeDrvClose, /* 0.7.3 */ .nodeNumOfDevices = nodeNumOfDevices, /* 0.7.3 */ @@ -1810,16 +1810,16 @@ static virDeviceMonitor udevDeviceMonitor = { static virStateDriver udevStateDriver = { .name = "udev", - .stateInitialize = udevDeviceMonitorStartup, /* 0.7.3 */ - .stateCleanup = udevDeviceMonitorShutdown, /* 0.7.3 */ - .stateReload = udevDeviceMonitorReload, /* 0.7.3 */ + .stateInitialize = udevNodeDeviceDriverStartup, /* 0.7.3 */ + .stateCleanup = udevNodeDeviceDriverShutdown, /* 0.7.3 */ + .stateReload = udevNodeDeviceDriverReload, /* 0.7.3 */ }; int udevNodeRegister(void) { VIR_DEBUG("Registering udev node device backend"); - if (virRegisterDeviceMonitor(&udevDeviceMonitor) < 0) { + if (virRegisterNodeDeviceDriver(&udevNodeDeviceDriver) < 0) { return -1; } diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c index 4aec150..83dc0fe 100644 --- a/src/remote/remote_driver.c +++ b/src/remote/remote_driver.c @@ -3367,16 +3367,16 @@ done: /*----------------------------------------------------------------------*/ static virDrvOpenStatus ATTRIBUTE_NONNULL(1) -remoteDevMonOpen(virConnectPtr conn, virConnectAuthPtr auth, - unsigned int flags) +remoteNodeDeviceOpen(virConnectPtr conn, virConnectAuthPtr auth, + unsigned int flags) { - return remoteGenericOpen(conn, auth, flags, &conn->devMonPrivateData); + return remoteGenericOpen(conn, auth, flags, &conn->nodeDevicePrivateData); } static int -remoteDevMonClose(virConnectPtr conn) +remoteNodeDeviceClose(virConnectPtr conn) { - return remoteGenericClose(conn, &conn->devMonPrivateData); + return remoteGenericClose(conn, &conn->nodeDevicePrivateData); } static int @@ -3385,7 +3385,7 @@ remoteNodeDeviceDettach(virNodeDevicePtr dev) int rv = -1; remote_node_device_dettach_args args; /* This method is unusual in that it uses the HV driver, not the devMon driver - * hence its use of privateData, instead of devMonPrivateData */ + * hence its use of privateData, instead of nodeDevicePrivateData */ struct private_data *priv = dev->conn->privateData; remoteDriverLock(priv); @@ -3410,7 +3410,7 @@ remoteNodeDeviceReAttach(virNodeDevicePtr dev) int rv = -1; remote_node_device_re_attach_args args; /* This method is unusual in that it uses the HV driver, not the devMon driver - * hence its use of privateData, instead of devMonPrivateData */ + * hence its use of privateData, instead of nodeDevicePrivateData */ struct private_data *priv = dev->conn->privateData; remoteDriverLock(priv); @@ -3435,7 +3435,7 @@ remoteNodeDeviceReset(virNodeDevicePtr dev) int rv = -1; remote_node_device_reset_args args; /* This method is unusual in that it uses the HV driver, not the devMon driver - * hence its use of privateData, instead of devMonPrivateData */ + * hence its use of privateData, instead of nodeDevicePrivateData */ struct private_data *priv = dev->conn->privateData; remoteDriverLock(priv); @@ -6414,10 +6414,10 @@ static virSecretDriver secret_driver = { .secretUndefine = remoteSecretUndefine /* 0.7.1 */ }; -static virDeviceMonitor dev_monitor = { +static virNodeDeviceDriver node_device_driver = { .name = "remote", - .connectOpen = remoteDevMonOpen, /* 0.5.0 */ - .connectClose = remoteDevMonClose, /* 0.5.0 */ + .connectOpen = remoteNodeDeviceOpen, /* 0.5.0 */ + .connectClose = remoteNodeDeviceClose, /* 0.5.0 */ .nodeNumOfDevices = remoteNodeNumOfDevices, /* 0.5.0 */ .nodeListDevices = remoteNodeListDevices, /* 0.5.0 */ .connectListAllNodeDevices = remoteConnectListAllNodeDevices, /* 0.10.2 */ @@ -6469,7 +6469,7 @@ remoteRegister(void) if (virRegisterNetworkDriver(&network_driver) == -1) return -1; if (virRegisterInterfaceDriver(&interface_driver) == -1) return -1; if (virRegisterStorageDriver(&storage_driver) == -1) return -1; - if (virRegisterDeviceMonitor(&dev_monitor) == -1) return -1; + if (virRegisterNodeDeviceDriver(&node_device_driver) == -1) return -1; if (virRegisterSecretDriver(&secret_driver) == -1) return -1; if (virRegisterNWFilterDriver(&nwfilter_driver) == -1) return -1; #ifdef WITH_LIBVIRTD diff --git a/src/rpc/gendispatch.pl b/src/rpc/gendispatch.pl index 7bbc76a..d364e1c 100755 --- a/src/rpc/gendispatch.pl +++ b/src/rpc/gendispatch.pl @@ -1072,7 +1072,7 @@ elsif ($mode eq "client") { !($argtype =~ m/^remote_node_device_lookup_by_name_/) and !($argtype =~ m/^remote_node_device_create_xml_/)) { $has_node_device = 1; - $priv_name = "devMonPrivateData"; + $priv_name = "nodeDevicePrivateData"; } foreach my $args_member (@{$call->{args_members}}) { @@ -1309,7 +1309,7 @@ elsif ($mode eq "client") { my $type_name = name_to_TypeName($name); if ($name eq "node_device") { - $priv_name = "devMonPrivateData"; + $priv_name = "nodeDevicePrivateData"; } elsif ($name =~ m/^storage_/) { $priv_name = "storagePrivateData"; } elsif (!($name =~ m/^domain/)) { diff --git a/src/test/test_driver.c b/src/test/test_driver.c index 5272f06..ebcb160 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -5245,21 +5245,21 @@ cleanup: /* Node device implementations */ -static virDrvOpenStatus testDevMonOpen(virConnectPtr conn, - virConnectAuthPtr auth ATTRIBUTE_UNUSED, - unsigned int flags) +static virDrvOpenStatus testNodeDeviceOpen(virConnectPtr conn, + virConnectAuthPtr auth ATTRIBUTE_UNUSED, + unsigned int flags) { virCheckFlags(VIR_CONNECT_RO, VIR_DRV_OPEN_ERROR); if (STRNEQ(conn->driver->name, "Test")) return VIR_DRV_OPEN_DECLINED; - conn->devMonPrivateData = conn->privateData; + conn->nodeDevicePrivateData = conn->privateData; return VIR_DRV_OPEN_SUCCESS; } -static int testDevMonClose(virConnectPtr conn) { - conn->devMonPrivateData = NULL; +static int testNodeDeviceClose(virConnectPtr conn) { + conn->nodeDevicePrivateData = NULL; return 0; } @@ -5952,10 +5952,10 @@ static virStorageDriver testStorageDriver = { .storagePoolIsPersistent = testStoragePoolIsPersistent, /* 0.7.3 */ }; -static virDeviceMonitor testDevMonitor = { +static virNodeDeviceDriver testNodeDeviceDriver = { .name = "Test", - .connectOpen = testDevMonOpen, /* 0.6.0 */ - .connectClose = testDevMonClose, /* 0.6.0 */ + .connectOpen = testNodeDeviceOpen, /* 0.6.0 */ + .connectClose = testNodeDeviceClose, /* 0.6.0 */ .nodeNumOfDevices = testNodeNumOfDevices, /* 0.7.2 */ .nodeListDevices = testNodeListDevices, /* 0.7.2 */ @@ -5997,7 +5997,7 @@ testRegister(void) return -1; if (virRegisterStorageDriver(&testStorageDriver) < 0) return -1; - if (virRegisterDeviceMonitor(&testDevMonitor) < 0) + if (virRegisterNodeDeviceDriver(&testNodeDeviceDriver) < 0) return -1; if (virRegisterSecretDriver(&testSecretDriver) < 0) return -1; diff --git a/tests/object-locking.ml b/tests/object-locking.ml index 88485fc..009b8f8 100644 --- a/tests/object-locking.ml +++ b/tests/object-locking.ml @@ -47,7 +47,7 @@ let driverTables = [ "virDriver"; "virNetworkDriver"; "virStorageDriver"; - "virDeviceMonitor"; + "virNodeDeviceDriver"; (* "virStateDriver"; Disable for now, since shutdown/startup have weird locking rules *) ] @@ -160,7 +160,7 @@ let lockableDrivers = [ "uml_driver"; "virStorageDriverStatePtr"; "network_driver"; - "virDeviceMonitorState"; + "virNodeDeviceState"; "one_driver_t"; ] -- 1.8.1.4 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list