提交 b18b0ce6 编写于 作者: P Pavel Hrdina

vircgroup: introduce virCgroupV2DevicesGetKey

Device rules are stored in BPF map that is a hash type, this function
will create a key based on major and minor id of device.
Signed-off-by: NPavel Hrdina <phrdina@redhat.com>
Reviewed-by: NJán Tomko <jtomko@redhat.com>
上级 63cfe7b8
......@@ -1721,6 +1721,7 @@ virCgroupV2DevicesAttachProg;
virCgroupV2DevicesAvailable;
virCgroupV2DevicesCreateProg;
virCgroupV2DevicesDetectProg;
virCgroupV2DevicesGetKey;
virCgroupV2DevicesGetPerms;
virCgroupV2DevicesPrepareProg;
virCgroupV2DevicesRemoveProg;
......
......@@ -647,3 +647,11 @@ virCgroupV2DevicesGetPerms(int perms G_GNUC_UNUSED,
return 0;
}
#endif /* !HAVE_DECL_BPF_CGROUP_DEVICE */
uint64_t
virCgroupV2DevicesGetKey(int major,
int minor)
{
return (uint64_t)major << 32 | ((uint64_t)minor & 0x00000000ffffffff);
}
......@@ -45,3 +45,7 @@ virCgroupV2DevicesRemoveProg(virCgroupPtr group);
uint32_t
virCgroupV2DevicesGetPerms(int perms,
char type);
uint64_t
virCgroupV2DevicesGetKey(int major,
int minor);
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册