diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 88b0a3869672d9c5a58f8193b156c9cc4908e731..76de9e8d3e9e20dd4002078e376b29ab39a26e7e 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -1721,6 +1721,7 @@ virCgroupV2DevicesAttachProg; virCgroupV2DevicesAvailable; virCgroupV2DevicesCreateProg; virCgroupV2DevicesDetectProg; +virCgroupV2DevicesGetKey; virCgroupV2DevicesGetPerms; virCgroupV2DevicesPrepareProg; virCgroupV2DevicesRemoveProg; diff --git a/src/util/vircgroupv2devices.c b/src/util/vircgroupv2devices.c index 43ae14d2a516ab6ad4056caa2a7a5b7479bfa018..6b4ea3142f087aafd5317b6328eb615b5f94e834 100644 --- a/src/util/vircgroupv2devices.c +++ b/src/util/vircgroupv2devices.c @@ -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); +} diff --git a/src/util/vircgroupv2devices.h b/src/util/vircgroupv2devices.h index e00da25c1e3b03c5ae3873731528e4ba502ee57f..593ed35203cdb849bf7a5dfd0805a5e03fc5c882 100644 --- a/src/util/vircgroupv2devices.h +++ b/src/util/vircgroupv2devices.h @@ -45,3 +45,7 @@ virCgroupV2DevicesRemoveProg(virCgroupPtr group); uint32_t virCgroupV2DevicesGetPerms(int perms, char type); + +uint64_t +virCgroupV2DevicesGetKey(int major, + int minor);