mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 22:25:25 +00:00
vircgroup: extract virCgroupV1HasController
Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com> Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
parent
d7f77dd6d5
commit
5e2df3d07f
@ -1439,7 +1439,8 @@ virCgroupHasController(virCgroupPtr cgroup, int controller)
|
|||||||
return false;
|
return false;
|
||||||
if (controller < 0 || controller >= VIR_CGROUP_CONTROLLER_LAST)
|
if (controller < 0 || controller >= VIR_CGROUP_CONTROLLER_LAST)
|
||||||
return false;
|
return false;
|
||||||
return cgroup->controllers[controller].mountPoint != NULL;
|
|
||||||
|
return cgroup->backend->hasController(cgroup, controller);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -73,6 +73,10 @@ typedef int
|
|||||||
(*virCgroupDetectControllersCB)(virCgroupPtr group,
|
(*virCgroupDetectControllersCB)(virCgroupPtr group,
|
||||||
int controllers);
|
int controllers);
|
||||||
|
|
||||||
|
typedef bool
|
||||||
|
(*virCgroupHasControllerCB)(virCgroupPtr cgroup,
|
||||||
|
int controller);
|
||||||
|
|
||||||
struct _virCgroupBackend {
|
struct _virCgroupBackend {
|
||||||
virCgroupBackendType type;
|
virCgroupBackendType type;
|
||||||
|
|
||||||
@ -86,6 +90,7 @@ struct _virCgroupBackend {
|
|||||||
virCgroupValidatePlacementCB validatePlacement;
|
virCgroupValidatePlacementCB validatePlacement;
|
||||||
virCgroupStealPlacementCB stealPlacement;
|
virCgroupStealPlacementCB stealPlacement;
|
||||||
virCgroupDetectControllersCB detectControllers;
|
virCgroupDetectControllersCB detectControllers;
|
||||||
|
virCgroupHasControllerCB hasController;
|
||||||
};
|
};
|
||||||
typedef struct _virCgroupBackend virCgroupBackend;
|
typedef struct _virCgroupBackend virCgroupBackend;
|
||||||
typedef virCgroupBackend *virCgroupBackendPtr;
|
typedef virCgroupBackend *virCgroupBackendPtr;
|
||||||
|
@ -477,6 +477,14 @@ virCgroupV1DetectControllers(virCgroupPtr group,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static bool
|
||||||
|
virCgroupV1HasController(virCgroupPtr group,
|
||||||
|
int controller)
|
||||||
|
{
|
||||||
|
return group->controllers[controller].mountPoint != NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
virCgroupBackend virCgroupV1Backend = {
|
virCgroupBackend virCgroupV1Backend = {
|
||||||
.type = VIR_CGROUP_BACKEND_TYPE_V1,
|
.type = VIR_CGROUP_BACKEND_TYPE_V1,
|
||||||
|
|
||||||
@ -489,6 +497,7 @@ virCgroupBackend virCgroupV1Backend = {
|
|||||||
.validatePlacement = virCgroupV1ValidatePlacement,
|
.validatePlacement = virCgroupV1ValidatePlacement,
|
||||||
.stealPlacement = virCgroupV1StealPlacement,
|
.stealPlacement = virCgroupV1StealPlacement,
|
||||||
.detectControllers = virCgroupV1DetectControllers,
|
.detectControllers = virCgroupV1DetectControllers,
|
||||||
|
.hasController = virCgroupV1HasController,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user