[libvirt] [PATCH] util: cgroup: Fix build on non-cgroup platforms

Commit 48f44510098cead629ede9a49ea4e840a28ccca introduced a helper fucntion to convert cgroup device mode to string. The function was only conditionally compliled 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. --- src/util/vircgroup.c | 76 ++++++++++++++++++++++++++-------------------------- 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c index 2eaf265..1ec12ac 100644 --- a/src/util/vircgroup.c +++ b/src/util/vircgroup.c @@ -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) @@ -2624,44 +2662,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: * * @group: The cgroup to allow a device for -- 2.0.0

On 07/08/2014 09:40 AM, Peter Krempa wrote:
Commit 48f44510098cead629ede9a49ea4e840a28ccca introduced a helper fucntion to convert cgroup device mode to string. The function was only
s/fucntion/function/
conditionally compliled on platforms that support cgroup. This broke the
s/compliled/compiled/
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. --- src/util/vircgroup.c | 76 ++++++++++++++++++++++++++-------------------------- 1 file changed, 38 insertions(+), 38 deletions(-)
ACK. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

On 07/09/14 07:11, Martin Kletzander wrote:
On Tue, Jul 08, 2014 at 05:40:40PM +0200, Peter Krempa wrote:
Commit 48f44510098cead629ede9a49ea4e840a28ccca introduced a helper
You probably meant a48f44510098cead629ede9a49ea4e840a28ccca.
I've fixed the typos pointed by Eric and also returned the "a" at the beginning of the commit. Thanks; Pushed. Peter
participants (3)
-
Eric Blake
-
Martin Kletzander
-
Peter Krempa