mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 14:15:28 +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;
|
||||
if (controller < 0 || controller >= VIR_CGROUP_CONTROLLER_LAST)
|
||||
return false;
|
||||
return cgroup->controllers[controller].mountPoint != NULL;
|
||||
|
||||
return cgroup->backend->hasController(cgroup, controller);
|
||||
}
|
||||
|
||||
|
||||
|
@ -73,6 +73,10 @@ typedef int
|
||||
(*virCgroupDetectControllersCB)(virCgroupPtr group,
|
||||
int controllers);
|
||||
|
||||
typedef bool
|
||||
(*virCgroupHasControllerCB)(virCgroupPtr cgroup,
|
||||
int controller);
|
||||
|
||||
struct _virCgroupBackend {
|
||||
virCgroupBackendType type;
|
||||
|
||||
@ -86,6 +90,7 @@ struct _virCgroupBackend {
|
||||
virCgroupValidatePlacementCB validatePlacement;
|
||||
virCgroupStealPlacementCB stealPlacement;
|
||||
virCgroupDetectControllersCB detectControllers;
|
||||
virCgroupHasControllerCB hasController;
|
||||
};
|
||||
typedef struct _virCgroupBackend virCgroupBackend;
|
||||
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 = {
|
||||
.type = VIR_CGROUP_BACKEND_TYPE_V1,
|
||||
|
||||
@ -489,6 +497,7 @@ virCgroupBackend virCgroupV1Backend = {
|
||||
.validatePlacement = virCgroupV1ValidatePlacement,
|
||||
.stealPlacement = virCgroupV1StealPlacement,
|
||||
.detectControllers = virCgroupV1DetectControllers,
|
||||
.hasController = virCgroupV1HasController,
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user