[PATCH 11/19] vircgroup: introduce virCgroupV2DeviceGetKey

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

 



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@xxxxxxxxxx>
---
 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

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux