[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH 11/19] vircgroup: introduce virCgroupV2DeviceGetKey



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: Pavel Hrdina <phrdina redhat com>
---
 src/util/vircgroupv2.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/util/vircgroupv2.c b/src/util/vircgroupv2.c
index 30f8da22ac..198d2ea03e 100644
--- a/src/util/vircgroupv2.c
+++ b/src/util/vircgroupv2.c
@@ -1993,6 +1993,14 @@ virCgroupV2DeviceGetPerms(int perms,
 }
 
 
+static __u64
+virCgroupV2DeviceGetKey(int major,
+                        int minor)
+{
+    return (__u64)major << 32 | ((__u64)minor & 0x00000000ffffffff);
+}
+
+
 virCgroupBackend virCgroupV2Backend = {
     .type = VIR_CGROUP_BACKEND_TYPE_V2,
 
-- 
2.20.1


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]