mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-26 06:25:19 +00:00
conf: nodedev: Rename virNodeDevObjHasCap to virNodeDevObjHasCapStr
We currently have 2 methods that do the capability matching. This should be condensed to a single function and all the derivates should just call into that using a proper type conversion. Signed-off-by: Erik Skultety <eskultet@redhat.com>
This commit is contained in:
parent
3f630aa0e9
commit
1cbaeda707
@ -53,6 +53,8 @@ static virClassPtr virNodeDeviceObjClass;
|
|||||||
static virClassPtr virNodeDeviceObjListClass;
|
static virClassPtr virNodeDeviceObjListClass;
|
||||||
static void virNodeDeviceObjDispose(void *opaque);
|
static void virNodeDeviceObjDispose(void *opaque);
|
||||||
static void virNodeDeviceObjListDispose(void *opaque);
|
static void virNodeDeviceObjListDispose(void *opaque);
|
||||||
|
static bool virNodeDeviceObjHasCapStr(const virNodeDeviceObj *obj,
|
||||||
|
const char *cap);
|
||||||
|
|
||||||
static int
|
static int
|
||||||
virNodeDeviceObjOnceInit(void)
|
virNodeDeviceObjOnceInit(void)
|
||||||
@ -121,8 +123,8 @@ virNodeDeviceObjGetDef(virNodeDeviceObjPtr obj)
|
|||||||
|
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
virNodeDeviceObjHasCap(const virNodeDeviceObj *obj,
|
virNodeDeviceObjHasCapStr(const virNodeDeviceObj *obj,
|
||||||
const char *cap)
|
const char *cap)
|
||||||
{
|
{
|
||||||
virNodeDevCapsDefPtr caps = obj->def->caps;
|
virNodeDevCapsDefPtr caps = obj->def->caps;
|
||||||
const char *fc_host_cap =
|
const char *fc_host_cap =
|
||||||
@ -375,7 +377,7 @@ virNodeDeviceObjListFindByCapCallback(const void *payload,
|
|||||||
int want = 0;
|
int want = 0;
|
||||||
|
|
||||||
virObjectLock(obj);
|
virObjectLock(obj);
|
||||||
if (virNodeDeviceObjHasCap(obj, matchstr))
|
if (virNodeDeviceObjHasCapStr(obj, matchstr))
|
||||||
want = 1;
|
want = 1;
|
||||||
virObjectUnlock(obj);
|
virObjectUnlock(obj);
|
||||||
return want;
|
return want;
|
||||||
@ -750,7 +752,7 @@ virNodeDeviceObjListNumOfDevicesCallback(void *payload,
|
|||||||
virObjectLock(obj);
|
virObjectLock(obj);
|
||||||
def = obj->def;
|
def = obj->def;
|
||||||
if ((!filter || filter(data->conn, def)) &&
|
if ((!filter || filter(data->conn, def)) &&
|
||||||
(!data->matchstr || virNodeDeviceObjHasCap(obj, data->matchstr)))
|
(!data->matchstr || virNodeDeviceObjHasCapStr(obj, data->matchstr)))
|
||||||
data->count++;
|
data->count++;
|
||||||
|
|
||||||
virObjectUnlock(obj);
|
virObjectUnlock(obj);
|
||||||
@ -805,7 +807,7 @@ virNodeDeviceObjListGetNamesCallback(void *payload,
|
|||||||
def = obj->def;
|
def = obj->def;
|
||||||
|
|
||||||
if ((!filter || filter(data->conn, def)) &&
|
if ((!filter || filter(data->conn, def)) &&
|
||||||
(!data->matchstr || virNodeDeviceObjHasCap(obj, data->matchstr))) {
|
(!data->matchstr || virNodeDeviceObjHasCapStr(obj, data->matchstr))) {
|
||||||
if (VIR_STRDUP(data->names[data->nnames], def->name) < 0) {
|
if (VIR_STRDUP(data->names[data->nnames], def->name) < 0) {
|
||||||
data->error = true;
|
data->error = true;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user