int
virCgroupDenyAllDevices(virCgroupPtr group)
{
- return virCgroupSetValueStr(group,
- VIR_CGROUP_CONTROLLER_DEVICES,
- "devices.deny",
- "a");
+ VIR_CGROUP_BACKEND_CALL(group, denyAllDevices, -1);
}
/**
int
virCgroupAllowAllDevices(virCgroupPtr group, int perms)
{
- int ret = -1;
-
- if (virCgroupAllowDevice(group, 'b', -1, -1, perms) < 0)
- goto cleanup;
-
- if (virCgroupAllowDevice(group, 'c', -1, -1, perms) < 0)
- goto cleanup;
-
- ret = 0;
-
- cleanup:
- return ret;
+ VIR_CGROUP_BACKEND_CALL(group, allowAllDevices, -1, perms);
}
int minor,
int perms);
+typedef int
+(*virCgroupAllowAllDevicesCB)(virCgroupPtr group,
+ int perms);
+
+typedef int
+(*virCgroupDenyAllDevicesCB)(virCgroupPtr group);
+
struct _virCgroupBackend {
virCgroupBackendType type;
virCgroupAllowDeviceCB allowDevice;
virCgroupDenyDeviceCB denyDevice;
+ virCgroupAllowAllDevicesCB allowAllDevices;
+ virCgroupDenyAllDevicesCB denyAllDevices;
};
typedef struct _virCgroupBackend virCgroupBackend;
typedef virCgroupBackend *virCgroupBackendPtr;
}
+static int
+virCgroupV1AllowAllDevices(virCgroupPtr group,
+ int perms)
+{
+ int ret = -1;
+
+ if (virCgroupV1AllowDevice(group, 'b', -1, -1, perms) < 0)
+ goto cleanup;
+
+ if (virCgroupV1AllowDevice(group, 'c', -1, -1, perms) < 0)
+ goto cleanup;
+
+ ret = 0;
+
+ cleanup:
+ return ret;
+}
+
+
+static int
+virCgroupV1DenyAllDevices(virCgroupPtr group)
+{
+ return virCgroupSetValueStr(group,
+ VIR_CGROUP_CONTROLLER_DEVICES,
+ "devices.deny",
+ "a");
+}
+
+
virCgroupBackend virCgroupV1Backend = {
.type = VIR_CGROUP_BACKEND_TYPE_V1,
.allowDevice = virCgroupV1AllowDevice,
.denyDevice = virCgroupV1DenyDevice,
+ .allowAllDevices = virCgroupV1AllowAllDevices,
+ .denyAllDevices = virCgroupV1DenyAllDevices,
};