mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-28 11:31:16 +00:00
nodedev: Alter node device obj list function names
Ensure that any function that walks the node device object list is prefixed by virNodeDeviceObjList. Also, modify the @filter param name for virNodeDeviceObjListExport to be @aclfilter. Signed-off-by: John Ferlan <jferlan@redhat.com>
This commit is contained in:
parent
9c5d98fd83
commit
881a486a7d
@ -165,8 +165,8 @@ virNodeDeviceFindVPORTCapDef(const virNodeDeviceObj *obj)
|
|||||||
|
|
||||||
|
|
||||||
virNodeDeviceObjPtr
|
virNodeDeviceObjPtr
|
||||||
virNodeDeviceObjFindBySysfsPath(virNodeDeviceObjListPtr devs,
|
virNodeDeviceObjListFindBySysfsPath(virNodeDeviceObjListPtr devs,
|
||||||
const char *sysfs_path)
|
const char *sysfs_path)
|
||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
@ -184,8 +184,8 @@ virNodeDeviceObjFindBySysfsPath(virNodeDeviceObjListPtr devs,
|
|||||||
|
|
||||||
|
|
||||||
virNodeDeviceObjPtr
|
virNodeDeviceObjPtr
|
||||||
virNodeDeviceObjFindByName(virNodeDeviceObjListPtr devs,
|
virNodeDeviceObjListFindByName(virNodeDeviceObjListPtr devs,
|
||||||
const char *name)
|
const char *name)
|
||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
@ -201,9 +201,9 @@ virNodeDeviceObjFindByName(virNodeDeviceObjListPtr devs,
|
|||||||
|
|
||||||
|
|
||||||
static virNodeDeviceObjPtr
|
static virNodeDeviceObjPtr
|
||||||
virNodeDeviceFindByWWNs(virNodeDeviceObjListPtr devs,
|
virNodeDeviceObjListFindByWWNs(virNodeDeviceObjListPtr devs,
|
||||||
const char *parent_wwnn,
|
const char *parent_wwnn,
|
||||||
const char *parent_wwpn)
|
const char *parent_wwpn)
|
||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
@ -223,8 +223,8 @@ virNodeDeviceFindByWWNs(virNodeDeviceObjListPtr devs,
|
|||||||
|
|
||||||
|
|
||||||
static virNodeDeviceObjPtr
|
static virNodeDeviceObjPtr
|
||||||
virNodeDeviceFindByFabricWWN(virNodeDeviceObjListPtr devs,
|
virNodeDeviceObjListFindByFabricWWN(virNodeDeviceObjListPtr devs,
|
||||||
const char *parent_fabric_wwn)
|
const char *parent_fabric_wwn)
|
||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
@ -243,8 +243,8 @@ virNodeDeviceFindByFabricWWN(virNodeDeviceObjListPtr devs,
|
|||||||
|
|
||||||
|
|
||||||
static virNodeDeviceObjPtr
|
static virNodeDeviceObjPtr
|
||||||
virNodeDeviceFindByCap(virNodeDeviceObjListPtr devs,
|
virNodeDeviceObjListFindByCap(virNodeDeviceObjListPtr devs,
|
||||||
const char *cap)
|
const char *cap)
|
||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
@ -296,12 +296,12 @@ virNodeDeviceObjListFree(virNodeDeviceObjListPtr devs)
|
|||||||
|
|
||||||
|
|
||||||
virNodeDeviceObjPtr
|
virNodeDeviceObjPtr
|
||||||
virNodeDeviceObjAssignDef(virNodeDeviceObjListPtr devs,
|
virNodeDeviceObjListAssignDef(virNodeDeviceObjListPtr devs,
|
||||||
virNodeDeviceDefPtr def)
|
virNodeDeviceDefPtr def)
|
||||||
{
|
{
|
||||||
virNodeDeviceObjPtr obj;
|
virNodeDeviceObjPtr obj;
|
||||||
|
|
||||||
if ((obj = virNodeDeviceObjFindByName(devs, def->name))) {
|
if ((obj = virNodeDeviceObjListFindByName(devs, def->name))) {
|
||||||
virNodeDeviceDefFree(obj->def);
|
virNodeDeviceDefFree(obj->def);
|
||||||
obj->def = def;
|
obj->def = def;
|
||||||
return obj;
|
return obj;
|
||||||
@ -322,8 +322,8 @@ virNodeDeviceObjAssignDef(virNodeDeviceObjListPtr devs,
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
virNodeDeviceObjRemove(virNodeDeviceObjListPtr devs,
|
virNodeDeviceObjListRemove(virNodeDeviceObjListPtr devs,
|
||||||
virNodeDeviceObjPtr obj)
|
virNodeDeviceObjPtr obj)
|
||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
@ -372,14 +372,14 @@ virNodeDeviceFindFCParentHost(virNodeDeviceObjPtr obj)
|
|||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
virNodeDeviceGetParentHostByParent(virNodeDeviceObjListPtr devs,
|
virNodeDeviceObjListGetParentHostByParent(virNodeDeviceObjListPtr devs,
|
||||||
const char *dev_name,
|
const char *dev_name,
|
||||||
const char *parent_name)
|
const char *parent_name)
|
||||||
{
|
{
|
||||||
virNodeDeviceObjPtr obj = NULL;
|
virNodeDeviceObjPtr obj = NULL;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (!(obj = virNodeDeviceObjFindByName(devs, parent_name))) {
|
if (!(obj = virNodeDeviceObjListFindByName(devs, parent_name))) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("Could not find parent device for '%s'"),
|
_("Could not find parent device for '%s'"),
|
||||||
dev_name);
|
dev_name);
|
||||||
@ -395,15 +395,16 @@ virNodeDeviceGetParentHostByParent(virNodeDeviceObjListPtr devs,
|
|||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
virNodeDeviceGetParentHostByWWNs(virNodeDeviceObjListPtr devs,
|
virNodeDeviceObjListGetParentHostByWWNs(virNodeDeviceObjListPtr devs,
|
||||||
const char *dev_name,
|
const char *dev_name,
|
||||||
const char *parent_wwnn,
|
const char *parent_wwnn,
|
||||||
const char *parent_wwpn)
|
const char *parent_wwpn)
|
||||||
{
|
{
|
||||||
virNodeDeviceObjPtr obj = NULL;
|
virNodeDeviceObjPtr obj = NULL;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (!(obj = virNodeDeviceFindByWWNs(devs, parent_wwnn, parent_wwpn))) {
|
if (!(obj = virNodeDeviceObjListFindByWWNs(devs, parent_wwnn,
|
||||||
|
parent_wwpn))) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("Could not find parent device for '%s'"),
|
_("Could not find parent device for '%s'"),
|
||||||
dev_name);
|
dev_name);
|
||||||
@ -419,14 +420,14 @@ virNodeDeviceGetParentHostByWWNs(virNodeDeviceObjListPtr devs,
|
|||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
virNodeDeviceGetParentHostByFabricWWN(virNodeDeviceObjListPtr devs,
|
virNodeDeviceObjListGetParentHostByFabricWWN(virNodeDeviceObjListPtr devs,
|
||||||
const char *dev_name,
|
const char *dev_name,
|
||||||
const char *parent_fabric_wwn)
|
const char *parent_fabric_wwn)
|
||||||
{
|
{
|
||||||
virNodeDeviceObjPtr obj = NULL;
|
virNodeDeviceObjPtr obj = NULL;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (!(obj = virNodeDeviceFindByFabricWWN(devs, parent_fabric_wwn))) {
|
if (!(obj = virNodeDeviceObjListFindByFabricWWN(devs, parent_fabric_wwn))) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("Could not find parent device for '%s'"),
|
_("Could not find parent device for '%s'"),
|
||||||
dev_name);
|
dev_name);
|
||||||
@ -442,13 +443,13 @@ virNodeDeviceGetParentHostByFabricWWN(virNodeDeviceObjListPtr devs,
|
|||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
virNodeDeviceFindVportParentHost(virNodeDeviceObjListPtr devs)
|
virNodeDeviceObjListFindVportParentHost(virNodeDeviceObjListPtr devs)
|
||||||
{
|
{
|
||||||
virNodeDeviceObjPtr obj = NULL;
|
virNodeDeviceObjPtr obj = NULL;
|
||||||
const char *cap = virNodeDevCapTypeToString(VIR_NODE_DEV_CAP_VPORTS);
|
const char *cap = virNodeDevCapTypeToString(VIR_NODE_DEV_CAP_VPORTS);
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (!(obj = virNodeDeviceFindByCap(devs, cap))) {
|
if (!(obj = virNodeDeviceObjListFindByCap(devs, cap))) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
_("Could not find any vport capable device"));
|
_("Could not find any vport capable device"));
|
||||||
return -1;
|
return -1;
|
||||||
@ -463,26 +464,26 @@ virNodeDeviceFindVportParentHost(virNodeDeviceObjListPtr devs)
|
|||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
virNodeDeviceObjGetParentHost(virNodeDeviceObjListPtr devs,
|
virNodeDeviceObjListGetParentHost(virNodeDeviceObjListPtr devs,
|
||||||
virNodeDeviceDefPtr def,
|
virNodeDeviceDefPtr def,
|
||||||
int create)
|
int create)
|
||||||
{
|
{
|
||||||
int parent_host = -1;
|
int parent_host = -1;
|
||||||
|
|
||||||
if (def->parent) {
|
if (def->parent) {
|
||||||
parent_host = virNodeDeviceGetParentHostByParent(devs, def->name,
|
parent_host = virNodeDeviceObjListGetParentHostByParent(devs, def->name,
|
||||||
def->parent);
|
def->parent);
|
||||||
} else if (def->parent_wwnn && def->parent_wwpn) {
|
} else if (def->parent_wwnn && def->parent_wwpn) {
|
||||||
parent_host = virNodeDeviceGetParentHostByWWNs(devs, def->name,
|
parent_host = virNodeDeviceObjListGetParentHostByWWNs(devs, def->name,
|
||||||
def->parent_wwnn,
|
def->parent_wwnn,
|
||||||
def->parent_wwpn);
|
def->parent_wwpn);
|
||||||
} else if (def->parent_fabric_wwn) {
|
} else if (def->parent_fabric_wwn) {
|
||||||
parent_host =
|
parent_host =
|
||||||
virNodeDeviceGetParentHostByFabricWWN(devs, def->name,
|
virNodeDeviceObjListGetParentHostByFabricWWN(devs, def->name,
|
||||||
def->parent_fabric_wwn);
|
def->parent_fabric_wwn);
|
||||||
} else if (create == CREATE_DEVICE) {
|
} else if (create == CREATE_DEVICE) {
|
||||||
/* Try to find a vport capable scsi_host when no parent supplied */
|
/* Try to find a vport capable scsi_host when no parent supplied */
|
||||||
parent_host = virNodeDeviceFindVportParentHost(devs);
|
parent_host = virNodeDeviceObjListFindVportParentHost(devs);
|
||||||
}
|
}
|
||||||
|
|
||||||
return parent_host;
|
return parent_host;
|
||||||
@ -554,10 +555,10 @@ virNodeDeviceCapMatch(virNodeDeviceObjPtr obj,
|
|||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
virNodeDeviceObjNumOfDevices(virNodeDeviceObjListPtr devs,
|
virNodeDeviceObjListNumOfDevices(virNodeDeviceObjListPtr devs,
|
||||||
virConnectPtr conn,
|
virConnectPtr conn,
|
||||||
const char *cap,
|
const char *cap,
|
||||||
virNodeDeviceObjListFilter aclfilter)
|
virNodeDeviceObjListFilter aclfilter)
|
||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
int ndevs = 0;
|
int ndevs = 0;
|
||||||
@ -576,12 +577,12 @@ virNodeDeviceObjNumOfDevices(virNodeDeviceObjListPtr devs,
|
|||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
virNodeDeviceObjGetNames(virNodeDeviceObjListPtr devs,
|
virNodeDeviceObjListGetNames(virNodeDeviceObjListPtr devs,
|
||||||
virConnectPtr conn,
|
virConnectPtr conn,
|
||||||
virNodeDeviceObjListFilter aclfilter,
|
virNodeDeviceObjListFilter aclfilter,
|
||||||
const char *cap,
|
const char *cap,
|
||||||
char **const names,
|
char **const names,
|
||||||
int maxnames)
|
int maxnames)
|
||||||
{
|
{
|
||||||
int nnames = 0;
|
int nnames = 0;
|
||||||
size_t i;
|
size_t i;
|
||||||
@ -645,7 +646,7 @@ int
|
|||||||
virNodeDeviceObjListExport(virConnectPtr conn,
|
virNodeDeviceObjListExport(virConnectPtr conn,
|
||||||
virNodeDeviceObjListPtr devs,
|
virNodeDeviceObjListPtr devs,
|
||||||
virNodeDevicePtr **devices,
|
virNodeDevicePtr **devices,
|
||||||
virNodeDeviceObjListFilter filter,
|
virNodeDeviceObjListFilter aclfilter,
|
||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
{
|
{
|
||||||
virNodeDevicePtr *tmp_devices = NULL;
|
virNodeDevicePtr *tmp_devices = NULL;
|
||||||
@ -660,7 +661,7 @@ virNodeDeviceObjListExport(virConnectPtr conn,
|
|||||||
for (i = 0; i < devs->count; i++) {
|
for (i = 0; i < devs->count; i++) {
|
||||||
virNodeDeviceObjPtr obj = devs->objs[i];
|
virNodeDeviceObjPtr obj = devs->objs[i];
|
||||||
virNodeDeviceObjLock(obj);
|
virNodeDeviceObjLock(obj);
|
||||||
if ((!filter || filter(conn, obj->def)) &&
|
if ((!aclfilter || aclfilter(conn, obj->def)) &&
|
||||||
virNodeDeviceMatch(obj, flags)) {
|
virNodeDeviceMatch(obj, flags)) {
|
||||||
if (devices) {
|
if (devices) {
|
||||||
if (!(device = virGetNodeDevice(conn, obj->def->name)) ||
|
if (!(device = virGetNodeDevice(conn, obj->def->name)) ||
|
||||||
|
@ -44,25 +44,25 @@ virNodeDeviceDefPtr
|
|||||||
virNodeDeviceObjGetDef(virNodeDeviceObjPtr obj);
|
virNodeDeviceObjGetDef(virNodeDeviceObjPtr obj);
|
||||||
|
|
||||||
virNodeDeviceObjPtr
|
virNodeDeviceObjPtr
|
||||||
virNodeDeviceObjFindByName(virNodeDeviceObjListPtr devs,
|
virNodeDeviceObjListFindByName(virNodeDeviceObjListPtr devs,
|
||||||
const char *name);
|
const char *name);
|
||||||
|
|
||||||
virNodeDeviceObjPtr
|
virNodeDeviceObjPtr
|
||||||
virNodeDeviceObjFindBySysfsPath(virNodeDeviceObjListPtr devs,
|
virNodeDeviceObjListFindBySysfsPath(virNodeDeviceObjListPtr devs,
|
||||||
const char *sysfs_path)
|
const char *sysfs_path)
|
||||||
ATTRIBUTE_NONNULL(2);
|
ATTRIBUTE_NONNULL(2);
|
||||||
|
|
||||||
virNodeDeviceObjPtr
|
virNodeDeviceObjPtr
|
||||||
virNodeDeviceObjAssignDef(virNodeDeviceObjListPtr devs,
|
virNodeDeviceObjListAssignDef(virNodeDeviceObjListPtr devs,
|
||||||
virNodeDeviceDefPtr def);
|
virNodeDeviceDefPtr def);
|
||||||
|
|
||||||
void
|
void
|
||||||
virNodeDeviceObjRemove(virNodeDeviceObjListPtr devs,
|
virNodeDeviceObjListRemove(virNodeDeviceObjListPtr devs,
|
||||||
virNodeDeviceObjPtr dev);
|
virNodeDeviceObjPtr dev);
|
||||||
|
|
||||||
int
|
int
|
||||||
virNodeDeviceObjGetParentHost(virNodeDeviceObjListPtr devs,
|
virNodeDeviceObjListGetParentHost(virNodeDeviceObjListPtr devs,
|
||||||
virNodeDeviceDefPtr def,
|
virNodeDeviceDefPtr def,
|
||||||
int create);
|
int create);
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -85,24 +85,24 @@ typedef bool
|
|||||||
virNodeDeviceDefPtr def);
|
virNodeDeviceDefPtr def);
|
||||||
|
|
||||||
int
|
int
|
||||||
virNodeDeviceObjNumOfDevices(virNodeDeviceObjListPtr devs,
|
virNodeDeviceObjListNumOfDevices(virNodeDeviceObjListPtr devs,
|
||||||
virConnectPtr conn,
|
virConnectPtr conn,
|
||||||
const char *cap,
|
const char *cap,
|
||||||
virNodeDeviceObjListFilter aclfilter);
|
virNodeDeviceObjListFilter aclfilter);
|
||||||
|
|
||||||
int
|
int
|
||||||
virNodeDeviceObjGetNames(virNodeDeviceObjListPtr devs,
|
virNodeDeviceObjListGetNames(virNodeDeviceObjListPtr devs,
|
||||||
virConnectPtr conn,
|
virConnectPtr conn,
|
||||||
virNodeDeviceObjListFilter aclfilter,
|
virNodeDeviceObjListFilter aclfilter,
|
||||||
const char *cap,
|
const char *cap,
|
||||||
char **const names,
|
char **const names,
|
||||||
int maxnames);
|
int maxnames);
|
||||||
|
|
||||||
int
|
int
|
||||||
virNodeDeviceObjListExport(virConnectPtr conn,
|
virNodeDeviceObjListExport(virConnectPtr conn,
|
||||||
virNodeDeviceObjListPtr devobjs,
|
virNodeDeviceObjListPtr devobjs,
|
||||||
virNodeDevicePtr **devices,
|
virNodeDevicePtr **devices,
|
||||||
virNodeDeviceObjListFilter filter,
|
virNodeDeviceObjListFilter aclfilter,
|
||||||
unsigned int flags);
|
unsigned int flags);
|
||||||
|
|
||||||
#endif /* __VIRNODEDEVICEOBJ_H__ */
|
#endif /* __VIRNODEDEVICEOBJ_H__ */
|
||||||
|
@ -963,19 +963,19 @@ virNetworkObjUpdateAssignDef;
|
|||||||
|
|
||||||
|
|
||||||
# conf/virnodedeviceobj.h
|
# conf/virnodedeviceobj.h
|
||||||
virNodeDeviceObjAssignDef;
|
|
||||||
virNodeDeviceObjFindByName;
|
|
||||||
virNodeDeviceObjFindBySysfsPath;
|
|
||||||
virNodeDeviceObjFree;
|
virNodeDeviceObjFree;
|
||||||
virNodeDeviceObjGetDef;
|
virNodeDeviceObjGetDef;
|
||||||
virNodeDeviceObjGetNames;
|
virNodeDeviceObjListAssignDef;
|
||||||
virNodeDeviceObjGetParentHost;
|
|
||||||
virNodeDeviceObjListExport;
|
virNodeDeviceObjListExport;
|
||||||
|
virNodeDeviceObjListFindByName;
|
||||||
|
virNodeDeviceObjListFindBySysfsPath;
|
||||||
virNodeDeviceObjListFree;
|
virNodeDeviceObjListFree;
|
||||||
|
virNodeDeviceObjListGetNames;
|
||||||
|
virNodeDeviceObjListGetParentHost;
|
||||||
virNodeDeviceObjListNew;
|
virNodeDeviceObjListNew;
|
||||||
|
virNodeDeviceObjListNumOfDevices;
|
||||||
|
virNodeDeviceObjListRemove;
|
||||||
virNodeDeviceObjLock;
|
virNodeDeviceObjLock;
|
||||||
virNodeDeviceObjNumOfDevices;
|
|
||||||
virNodeDeviceObjRemove;
|
|
||||||
virNodeDeviceObjUnlock;
|
virNodeDeviceObjUnlock;
|
||||||
|
|
||||||
|
|
||||||
|
@ -182,8 +182,8 @@ nodeNumOfDevices(virConnectPtr conn,
|
|||||||
virCheckFlags(0, -1);
|
virCheckFlags(0, -1);
|
||||||
|
|
||||||
nodeDeviceLock();
|
nodeDeviceLock();
|
||||||
ndevs = virNodeDeviceObjNumOfDevices(driver->devs, conn, cap,
|
ndevs = virNodeDeviceObjListNumOfDevices(driver->devs, conn, cap,
|
||||||
virNodeNumOfDevicesCheckACL);
|
virNodeNumOfDevicesCheckACL);
|
||||||
nodeDeviceUnlock();
|
nodeDeviceUnlock();
|
||||||
|
|
||||||
return ndevs;
|
return ndevs;
|
||||||
@ -205,9 +205,9 @@ nodeListDevices(virConnectPtr conn,
|
|||||||
virCheckFlags(0, -1);
|
virCheckFlags(0, -1);
|
||||||
|
|
||||||
nodeDeviceLock();
|
nodeDeviceLock();
|
||||||
nnames = virNodeDeviceObjGetNames(driver->devs, conn,
|
nnames = virNodeDeviceObjListGetNames(driver->devs, conn,
|
||||||
virNodeListDevicesCheckACL,
|
virNodeListDevicesCheckACL,
|
||||||
cap, names, maxnames);
|
cap, names, maxnames);
|
||||||
nodeDeviceUnlock();
|
nodeDeviceUnlock();
|
||||||
|
|
||||||
return nnames;
|
return nnames;
|
||||||
@ -241,7 +241,7 @@ nodeDeviceObjFindByName(const char *name)
|
|||||||
virNodeDeviceObjPtr obj;
|
virNodeDeviceObjPtr obj;
|
||||||
|
|
||||||
nodeDeviceLock();
|
nodeDeviceLock();
|
||||||
obj = virNodeDeviceObjFindByName(driver->devs, name);
|
obj = virNodeDeviceObjListFindByName(driver->devs, name);
|
||||||
nodeDeviceUnlock();
|
nodeDeviceUnlock();
|
||||||
|
|
||||||
if (!obj) {
|
if (!obj) {
|
||||||
@ -587,8 +587,8 @@ nodeDeviceCreateXML(virConnectPtr conn,
|
|||||||
if (virNodeDeviceGetWWNs(def, &wwnn, &wwpn) == -1)
|
if (virNodeDeviceGetWWNs(def, &wwnn, &wwpn) == -1)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if ((parent_host = virNodeDeviceObjGetParentHost(driver->devs, def,
|
if ((parent_host = virNodeDeviceObjListGetParentHost(driver->devs, def,
|
||||||
CREATE_DEVICE)) < 0)
|
CREATE_DEVICE)) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (virVHBAManageVport(parent_host, wwpn, wwnn, VPORT_CREATE) < 0)
|
if (virVHBAManageVport(parent_host, wwpn, wwnn, VPORT_CREATE) < 0)
|
||||||
@ -639,8 +639,8 @@ nodeDeviceDestroy(virNodeDevicePtr device)
|
|||||||
* or parent_fabric_wwn) and drop the object lock. */
|
* or parent_fabric_wwn) and drop the object lock. */
|
||||||
virNodeDeviceObjUnlock(obj);
|
virNodeDeviceObjUnlock(obj);
|
||||||
obj = NULL;
|
obj = NULL;
|
||||||
if ((parent_host = virNodeDeviceObjGetParentHost(driver->devs, def,
|
if ((parent_host = virNodeDeviceObjListGetParentHost(driver->devs, def,
|
||||||
EXISTING_DEVICE)) < 0)
|
EXISTING_DEVICE)) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (virVHBAManageVport(parent_host, wwpn, wwnn, VPORT_DELETE) < 0)
|
if (virVHBAManageVport(parent_host, wwpn, wwnn, VPORT_DELETE) < 0)
|
||||||
|
@ -482,7 +482,7 @@ dev_create(const char *udi)
|
|||||||
/* Some devices don't have a path in sysfs, so ignore failure */
|
/* Some devices don't have a path in sysfs, so ignore failure */
|
||||||
(void)get_str_prop(ctx, udi, "linux.sysfs_path", &devicePath);
|
(void)get_str_prop(ctx, udi, "linux.sysfs_path", &devicePath);
|
||||||
|
|
||||||
if (!(obj = virNodeDeviceObjAssignDef(driver->devs, def))) {
|
if (!(obj = virNodeDeviceObjListAssignDef(driver->devs, def))) {
|
||||||
VIR_FREE(devicePath);
|
VIR_FREE(devicePath);
|
||||||
goto failure;
|
goto failure;
|
||||||
}
|
}
|
||||||
@ -509,11 +509,11 @@ dev_refresh(const char *udi)
|
|||||||
virNodeDeviceObjPtr obj;
|
virNodeDeviceObjPtr obj;
|
||||||
|
|
||||||
nodeDeviceLock();
|
nodeDeviceLock();
|
||||||
if ((obj = virNodeDeviceObjFindByName(driver->devs, name))) {
|
if ((obj = virNodeDeviceObjListFindByName(driver->devs, name))) {
|
||||||
/* Simply "rediscover" device -- incrementally handling changes
|
/* Simply "rediscover" device -- incrementally handling changes
|
||||||
* to sub-capabilities (like net.80203) is nasty ... so avoid it.
|
* to sub-capabilities (like net.80203) is nasty ... so avoid it.
|
||||||
*/
|
*/
|
||||||
virNodeDeviceObjRemove(driver->devs, obj);
|
virNodeDeviceObjListRemove(driver->devs, obj);
|
||||||
} else {
|
} else {
|
||||||
VIR_DEBUG("no device named %s", name);
|
VIR_DEBUG("no device named %s", name);
|
||||||
}
|
}
|
||||||
@ -542,10 +542,10 @@ device_removed(LibHalContext *ctx ATTRIBUTE_UNUSED,
|
|||||||
virNodeDeviceObjPtr obj;
|
virNodeDeviceObjPtr obj;
|
||||||
|
|
||||||
nodeDeviceLock();
|
nodeDeviceLock();
|
||||||
obj = virNodeDeviceObjFindByName(driver->devs, name);
|
obj = virNodeDeviceObjListFindByName(driver->devs, name);
|
||||||
VIR_DEBUG("%s", name);
|
VIR_DEBUG("%s", name);
|
||||||
if (obj)
|
if (obj)
|
||||||
virNodeDeviceObjRemove(driver->devs, obj);
|
virNodeDeviceObjListRemove(driver->devs, obj);
|
||||||
else
|
else
|
||||||
VIR_DEBUG("no device named %s", name);
|
VIR_DEBUG("no device named %s", name);
|
||||||
nodeDeviceUnlock();
|
nodeDeviceUnlock();
|
||||||
@ -562,7 +562,7 @@ device_cap_added(LibHalContext *ctx,
|
|||||||
virNodeDeviceDefPtr def;
|
virNodeDeviceDefPtr def;
|
||||||
|
|
||||||
nodeDeviceLock();
|
nodeDeviceLock();
|
||||||
obj = virNodeDeviceObjFindByName(driver->devs, name);
|
obj = virNodeDeviceObjListFindByName(driver->devs, name);
|
||||||
nodeDeviceUnlock();
|
nodeDeviceUnlock();
|
||||||
VIR_DEBUG("%s %s", cap, name);
|
VIR_DEBUG("%s %s", cap, name);
|
||||||
if (obj) {
|
if (obj) {
|
||||||
|
@ -1318,7 +1318,7 @@ udevRemoveOneDevice(struct udev_device *device)
|
|||||||
const char *name = NULL;
|
const char *name = NULL;
|
||||||
|
|
||||||
name = udev_device_get_syspath(device);
|
name = udev_device_get_syspath(device);
|
||||||
if (!(obj = virNodeDeviceObjFindBySysfsPath(driver->devs, name))) {
|
if (!(obj = virNodeDeviceObjListFindBySysfsPath(driver->devs, name))) {
|
||||||
VIR_DEBUG("Failed to find device to remove that has udev name '%s'",
|
VIR_DEBUG("Failed to find device to remove that has udev name '%s'",
|
||||||
name);
|
name);
|
||||||
return -1;
|
return -1;
|
||||||
@ -1331,7 +1331,7 @@ udevRemoveOneDevice(struct udev_device *device)
|
|||||||
|
|
||||||
VIR_DEBUG("Removing device '%s' with sysfs path '%s'",
|
VIR_DEBUG("Removing device '%s' with sysfs path '%s'",
|
||||||
def->name, name);
|
def->name, name);
|
||||||
virNodeDeviceObjRemove(driver->devs, obj);
|
virNodeDeviceObjListRemove(driver->devs, obj);
|
||||||
virNodeDeviceObjFree(obj);
|
virNodeDeviceObjFree(obj);
|
||||||
|
|
||||||
if (event)
|
if (event)
|
||||||
@ -1365,8 +1365,8 @@ udevSetParent(struct udev_device *device,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((obj = virNodeDeviceObjFindBySysfsPath(driver->devs,
|
if ((obj = virNodeDeviceObjListFindBySysfsPath(driver->devs,
|
||||||
parent_sysfs_path))) {
|
parent_sysfs_path))) {
|
||||||
objdef = virNodeDeviceObjGetDef(obj);
|
objdef = virNodeDeviceObjGetDef(obj);
|
||||||
if (VIR_STRDUP(def->parent, objdef->name) < 0) {
|
if (VIR_STRDUP(def->parent, objdef->name) < 0) {
|
||||||
virNodeDeviceObjUnlock(obj);
|
virNodeDeviceObjUnlock(obj);
|
||||||
@ -1424,14 +1424,14 @@ udevAddOneDevice(struct udev_device *device)
|
|||||||
if (udevSetParent(device, def) != 0)
|
if (udevSetParent(device, def) != 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if ((obj = virNodeDeviceObjFindByName(driver->devs, def->name))) {
|
if ((obj = virNodeDeviceObjListFindByName(driver->devs, def->name))) {
|
||||||
virNodeDeviceObjUnlock(obj);
|
virNodeDeviceObjUnlock(obj);
|
||||||
new_device = false;
|
new_device = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If this is a device change, the old definition will be freed
|
/* If this is a device change, the old definition will be freed
|
||||||
* and the current definition will take its place. */
|
* and the current definition will take its place. */
|
||||||
if (!(obj = virNodeDeviceObjAssignDef(driver->devs, def)))
|
if (!(obj = virNodeDeviceObjListAssignDef(driver->devs, def)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
objdef = virNodeDeviceObjGetDef(obj);
|
objdef = virNodeDeviceObjGetDef(obj);
|
||||||
|
|
||||||
@ -1721,7 +1721,7 @@ udevSetupSystemDev(void)
|
|||||||
udevGetDMIData(&def->caps->data.system);
|
udevGetDMIData(&def->caps->data.system);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!(obj = virNodeDeviceObjAssignDef(driver->devs, def)))
|
if (!(obj = virNodeDeviceObjListAssignDef(driver->devs, def)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
virNodeDeviceObjUnlock(obj);
|
virNodeDeviceObjUnlock(obj);
|
||||||
|
@ -1172,7 +1172,7 @@ testParseNodedevs(testDriverPtr privconn,
|
|||||||
if (!def)
|
if (!def)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
if (!(obj = virNodeDeviceObjAssignDef(privconn->devs, def))) {
|
if (!(obj = virNodeDeviceObjListAssignDef(privconn->devs, def))) {
|
||||||
virNodeDeviceDefFree(def);
|
virNodeDeviceDefFree(def);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
@ -4561,7 +4561,8 @@ testDestroyVport(testDriverPtr privconn,
|
|||||||
*
|
*
|
||||||
* Reaching across the boundaries of space and time into the
|
* Reaching across the boundaries of space and time into the
|
||||||
* Node Device in order to remove */
|
* Node Device in order to remove */
|
||||||
if (!(obj = virNodeDeviceObjFindByName(privconn->devs, "scsi_host12"))) {
|
if (!(obj = virNodeDeviceObjListFindByName(privconn->devs,
|
||||||
|
"scsi_host12"))) {
|
||||||
virReportError(VIR_ERR_NO_NODE_DEVICE, "%s",
|
virReportError(VIR_ERR_NO_NODE_DEVICE, "%s",
|
||||||
_("no node device with matching name 'scsi_host12'"));
|
_("no node device with matching name 'scsi_host12'"));
|
||||||
return -1;
|
return -1;
|
||||||
@ -4571,7 +4572,7 @@ testDestroyVport(testDriverPtr privconn,
|
|||||||
VIR_NODE_DEVICE_EVENT_DELETED,
|
VIR_NODE_DEVICE_EVENT_DELETED,
|
||||||
0);
|
0);
|
||||||
|
|
||||||
virNodeDeviceObjRemove(privconn->devs, obj);
|
virNodeDeviceObjListRemove(privconn->devs, obj);
|
||||||
virNodeDeviceObjFree(obj);
|
virNodeDeviceObjFree(obj);
|
||||||
|
|
||||||
testObjectEventQueue(privconn, event);
|
testObjectEventQueue(privconn, event);
|
||||||
@ -5303,7 +5304,7 @@ testNodeDeviceObjFindByName(testDriverPtr driver,
|
|||||||
virNodeDeviceObjPtr obj;
|
virNodeDeviceObjPtr obj;
|
||||||
|
|
||||||
testDriverLock(driver);
|
testDriverLock(driver);
|
||||||
obj = virNodeDeviceObjFindByName(driver->devs, name);
|
obj = virNodeDeviceObjListFindByName(driver->devs, name);
|
||||||
testDriverUnlock(driver);
|
testDriverUnlock(driver);
|
||||||
|
|
||||||
if (!obj)
|
if (!obj)
|
||||||
@ -5326,7 +5327,7 @@ testNodeNumOfDevices(virConnectPtr conn,
|
|||||||
virCheckFlags(0, -1);
|
virCheckFlags(0, -1);
|
||||||
|
|
||||||
testDriverLock(driver);
|
testDriverLock(driver);
|
||||||
ndevs = virNodeDeviceObjNumOfDevices(driver->devs, conn, cap, NULL);
|
ndevs = virNodeDeviceObjListNumOfDevices(driver->devs, conn, cap, NULL);
|
||||||
testDriverUnlock(driver);
|
testDriverUnlock(driver);
|
||||||
|
|
||||||
return ndevs;
|
return ndevs;
|
||||||
@ -5346,8 +5347,8 @@ testNodeListDevices(virConnectPtr conn,
|
|||||||
virCheckFlags(0, -1);
|
virCheckFlags(0, -1);
|
||||||
|
|
||||||
testDriverLock(driver);
|
testDriverLock(driver);
|
||||||
nnames = virNodeDeviceObjGetNames(driver->devs, conn, NULL,
|
nnames = virNodeDeviceObjListGetNames(driver->devs, conn, NULL,
|
||||||
cap, names, maxnames);
|
cap, names, maxnames);
|
||||||
testDriverUnlock(driver);
|
testDriverUnlock(driver);
|
||||||
|
|
||||||
return nnames;
|
return nnames;
|
||||||
@ -5493,7 +5494,8 @@ testNodeDeviceMockCreateVport(testDriverPtr driver,
|
|||||||
* using the scsi_host11 definition, changing the name and the
|
* using the scsi_host11 definition, changing the name and the
|
||||||
* scsi_host capability fields before calling virNodeDeviceAssignDef
|
* scsi_host capability fields before calling virNodeDeviceAssignDef
|
||||||
* to add the def to the node device objects list. */
|
* to add the def to the node device objects list. */
|
||||||
if (!(objcopy = virNodeDeviceObjFindByName(driver->devs, "scsi_host11")))
|
if (!(objcopy = virNodeDeviceObjListFindByName(driver->devs,
|
||||||
|
"scsi_host11")))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
xml = virNodeDeviceDefFormat(virNodeDeviceObjGetDef(objcopy));
|
xml = virNodeDeviceDefFormat(virNodeDeviceObjGetDef(objcopy));
|
||||||
@ -5533,7 +5535,7 @@ testNodeDeviceMockCreateVport(testDriverPtr driver,
|
|||||||
caps = caps->next;
|
caps = caps->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(obj = virNodeDeviceObjAssignDef(driver->devs, def)))
|
if (!(obj = virNodeDeviceObjListAssignDef(driver->devs, def)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
def = NULL;
|
def = NULL;
|
||||||
objdef = virNodeDeviceObjGetDef(obj);
|
objdef = virNodeDeviceObjGetDef(obj);
|
||||||
@ -5578,7 +5580,7 @@ testNodeDeviceCreateXML(virConnectPtr conn,
|
|||||||
/* Unlike the "real" code we don't need the parent_host in order to
|
/* Unlike the "real" code we don't need the parent_host in order to
|
||||||
* call virVHBAManageVport, but still let's make sure the code finds
|
* call virVHBAManageVport, but still let's make sure the code finds
|
||||||
* something valid and no one messed up the mock environment. */
|
* something valid and no one messed up the mock environment. */
|
||||||
if (virNodeDeviceObjGetParentHost(driver->devs, def, CREATE_DEVICE) < 0)
|
if (virNodeDeviceObjListGetParentHost(driver->devs, def, CREATE_DEVICE) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
/* In the real code, we'd call virVHBAManageVport followed by
|
/* In the real code, we'd call virVHBAManageVport followed by
|
||||||
@ -5639,8 +5641,8 @@ testNodeDeviceDestroy(virNodeDevicePtr dev)
|
|||||||
|
|
||||||
/* We do this just for basic validation, but also avoid finding a
|
/* We do this just for basic validation, but also avoid finding a
|
||||||
* vport capable HBA if for some reason our vHBA doesn't exist */
|
* vport capable HBA if for some reason our vHBA doesn't exist */
|
||||||
if (virNodeDeviceObjGetParentHost(driver->devs, def,
|
if (virNodeDeviceObjListGetParentHost(driver->devs, def,
|
||||||
EXISTING_DEVICE) < 0) {
|
EXISTING_DEVICE) < 0) {
|
||||||
obj = NULL;
|
obj = NULL;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
@ -5650,7 +5652,7 @@ testNodeDeviceDestroy(virNodeDevicePtr dev)
|
|||||||
0);
|
0);
|
||||||
|
|
||||||
virNodeDeviceObjLock(obj);
|
virNodeDeviceObjLock(obj);
|
||||||
virNodeDeviceObjRemove(driver->devs, obj);
|
virNodeDeviceObjListRemove(driver->devs, obj);
|
||||||
virNodeDeviceObjFree(obj);
|
virNodeDeviceObjFree(obj);
|
||||||
obj = NULL;
|
obj = NULL;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user