mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
util: cgroup: Fix build on non-cgroup platforms
Commit a48f445100
introduced a helper
function to convert cgroup device mode to string. The function was only
conditionally compiled on platforms that support cgroup. This broke the
build when attempting to export the symbol:
CCLD libvirt.la
Cannot export virCgroupGetDevicePermsString: symbol not defined
Move the function out of the ifdef, as it doesn't really depend on the
cgroup code being present.
This commit is contained in:
parent
2d49518a53
commit
464f7678d9
@ -83,6 +83,44 @@ typedef enum {
|
||||
} virCgroupFlags;
|
||||
|
||||
|
||||
/**
|
||||
* virCgroupGetDevicePermsString:
|
||||
*
|
||||
* @perms: Bitwise or of VIR_CGROUP_DEVICE permission bits
|
||||
*
|
||||
* Returns string corresponding to the appropriate bits set.
|
||||
*/
|
||||
const char *
|
||||
virCgroupGetDevicePermsString(int perms)
|
||||
{
|
||||
if (perms & VIR_CGROUP_DEVICE_READ) {
|
||||
if (perms & VIR_CGROUP_DEVICE_WRITE) {
|
||||
if (perms & VIR_CGROUP_DEVICE_MKNOD)
|
||||
return "rwm";
|
||||
else
|
||||
return "rw";
|
||||
} else {
|
||||
if (perms & VIR_CGROUP_DEVICE_MKNOD)
|
||||
return "rm";
|
||||
else
|
||||
return "r";
|
||||
}
|
||||
} else {
|
||||
if (perms & VIR_CGROUP_DEVICE_WRITE) {
|
||||
if (perms & VIR_CGROUP_DEVICE_MKNOD)
|
||||
return "wm";
|
||||
else
|
||||
return "w";
|
||||
} else {
|
||||
if (perms & VIR_CGROUP_DEVICE_MKNOD)
|
||||
return "m";
|
||||
else
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#ifdef VIR_CGROUP_SUPPORTED
|
||||
bool
|
||||
virCgroupAvailable(void)
|
||||
@ -2623,44 +2661,6 @@ virCgroupDenyAllDevices(virCgroupPtr group)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* virCgroupGetDevicePermsString:
|
||||
*
|
||||
* @perms: Bitwise or of VIR_CGROUP_DEVICE permission bits
|
||||
*
|
||||
* Returns string corresponding to the appropriate bits set.
|
||||
*/
|
||||
const char *
|
||||
virCgroupGetDevicePermsString(int perms)
|
||||
{
|
||||
if (perms & VIR_CGROUP_DEVICE_READ) {
|
||||
if (perms & VIR_CGROUP_DEVICE_WRITE) {
|
||||
if (perms & VIR_CGROUP_DEVICE_MKNOD)
|
||||
return "rwm";
|
||||
else
|
||||
return "rw";
|
||||
} else {
|
||||
if (perms & VIR_CGROUP_DEVICE_MKNOD)
|
||||
return "rm";
|
||||
else
|
||||
return "r";
|
||||
}
|
||||
} else {
|
||||
if (perms & VIR_CGROUP_DEVICE_WRITE) {
|
||||
if (perms & VIR_CGROUP_DEVICE_MKNOD)
|
||||
return "wm";
|
||||
else
|
||||
return "w";
|
||||
} else {
|
||||
if (perms & VIR_CGROUP_DEVICE_MKNOD)
|
||||
return "m";
|
||||
else
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* virCgroupAllowDevice:
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user