goto cleanup;
}
- rv = virCgroupAllowDeviceMajor(priv->cgroup, 'c', DEVICE_PTY_MAJOR,
- VIR_CGROUP_DEVICE_RW);
+ rv = virCgroupAllowDevice(priv->cgroup, 'c', DEVICE_PTY_MAJOR, -1,
+ VIR_CGROUP_DEVICE_RW);
virDomainAuditCgroupMajor(vm, priv->cgroup, "allow", DEVICE_PTY_MAJOR,
"pty", "rw", rv == 0);
if (rv < 0)
((vm->def->graphics[0]->type == VIR_DOMAIN_GRAPHICS_TYPE_VNC &&
cfg->vncAllowHostAudio) ||
(vm->def->graphics[0]->type == VIR_DOMAIN_GRAPHICS_TYPE_SDL))))) {
- rv = virCgroupAllowDeviceMajor(priv->cgroup, 'c', DEVICE_SND_MAJOR,
- VIR_CGROUP_DEVICE_RW);
+ rv = virCgroupAllowDevice(priv->cgroup, 'c', DEVICE_SND_MAJOR, -1,
+ VIR_CGROUP_DEVICE_RW);
virDomainAuditCgroupMajor(vm, priv->cgroup, "allow", DEVICE_SND_MAJOR,
"sound", "rw", rv == 0);
if (rv < 0)
}
-/**
- * virCgroupAllowDeviceMajor:
- *
- * @group: The cgroup to allow an entire device major type for
- * @type: The device type (i.e., 'c' or 'b')
- * @major: The major number of the device type
- * @perms: Bitwise or of VIR_CGROUP_DEVICE permission bits to allow
- *
- * Returns: 0 on success
- */
-int
-virCgroupAllowDeviceMajor(virCgroupPtr group, char type, int major,
- int perms)
-{
- int ret = -1;
- char *devstr = NULL;
-
- if (virAsprintf(&devstr, "%c %i:* %s", type, major,
- virCgroupGetDevicePermsString(perms)) < 0)
- goto cleanup;
-
- if (virCgroupSetValueStr(group,
- VIR_CGROUP_CONTROLLER_DEVICES,
- "devices.allow",
- devstr) < 0)
- goto cleanup;
-
- ret = 0;
-
- cleanup:
- VIR_FREE(devstr);
- return ret;
-}
-
-
/**
* virCgroupAllowDevicePath:
*
}
-/**
- * virCgroupDenyDeviceMajor:
- *
- * @group: The cgroup to deny an entire device major type for
- * @type: The device type (i.e., 'c' or 'b')
- * @major: The major number of the device type
- * @perms: Bitwise or of VIR_CGROUP_DEVICE permission bits to deny
- *
- * Returns: 0 on success
- */
-int
-virCgroupDenyDeviceMajor(virCgroupPtr group, char type, int major,
- int perms)
-{
- int ret = -1;
- char *devstr = NULL;
-
- if (virAsprintf(&devstr, "%c %i:* %s", type, major,
- virCgroupGetDevicePermsString(perms)) < 0)
- goto cleanup;
-
- if (virCgroupSetValueStr(group,
- VIR_CGROUP_CONTROLLER_DEVICES,
- "devices.deny",
- devstr) < 0)
- goto cleanup;
-
- ret = 0;
-
- cleanup:
- VIR_FREE(devstr);
- return ret;
-}
-
-
int
virCgroupDenyDevicePath(virCgroupPtr group, const char *path, int perms)
{
}
-int
-virCgroupAllowDeviceMajor(virCgroupPtr group ATTRIBUTE_UNUSED,
- char type ATTRIBUTE_UNUSED,
- int major ATTRIBUTE_UNUSED,
- int perms ATTRIBUTE_UNUSED)
-{
- virReportSystemError(ENOSYS, "%s",
- _("Control groups not supported on this platform"));
- return -1;
-}
-
-
int
virCgroupAllowDevicePath(virCgroupPtr group ATTRIBUTE_UNUSED,
const char *path ATTRIBUTE_UNUSED,
}
-int
-virCgroupDenyDeviceMajor(virCgroupPtr group ATTRIBUTE_UNUSED,
- char type ATTRIBUTE_UNUSED,
- int major ATTRIBUTE_UNUSED,
- int perms ATTRIBUTE_UNUSED)
-{
- virReportSystemError(ENOSYS, "%s",
- _("Control groups not supported on this platform"));
- return -1;
-}
-
-
int
virCgroupDenyDevicePath(virCgroupPtr group ATTRIBUTE_UNUSED,
const char *path ATTRIBUTE_UNUSED,