Format all functions with two blank lines between, and return type
on separate line from function name. Also break some lines longer
than 80 columns. This makes the subsequent macro refactoring
less noisy.
* src/util/vircgroup.c: Match prevailing style.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
src/util/vircgroup.c | 585 +++++++++++++++++++++++++++++++++------------------
1 file changed, 379 insertions(+), 206 deletions(-)
diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c
index cfb4b3f..0925078 100644
--- a/src/util/vircgroup.c
+++ b/src/util/vircgroup.c
@@ -69,7 +69,9 @@ typedef enum {
*/
} virCgroupFlags;
-bool virCgroupAvailable(void)
+
+bool
+virCgroupAvailable(void)
{
bool ret = false;
#ifdef HAVE_GETMNTENT_R
@@ -156,8 +158,10 @@ virCgroupValidateMachineGroup(virCgroupPtr group,
if (STRNEQ(tmp, name) &&
STRNEQ(tmp, partname) &&
STRNEQ(tmp, scopename)) {
- VIR_DEBUG("Name '%s' for controller '%s' does not match
'%s', '%s' or '%s'",
- tmp, virCgroupControllerTypeToString(i), name, partname,
scopename);
+ VIR_DEBUG("Name '%s' for controller '%s' does not match
"
+ "'%s', '%s' or '%s'",
+ tmp, virCgroupControllerTypeToString(i),
+ name, partname, scopename);
goto cleanup;
}
}
@@ -180,12 +184,14 @@ virCgroupValidateMachineGroup(virCgroupPtr group ATTRIBUTE_UNUSED,
}
#endif
+
/**
* virCgroupFree:
*
* @group: The group structure to free
*/
-void virCgroupFree(virCgroupPtr *group)
+void
+virCgroupFree(virCgroupPtr *group)
{
size_t i;
@@ -202,6 +208,7 @@ void virCgroupFree(virCgroupPtr *group)
VIR_FREE(*group);
}
+
/**
* virCgroupHasController: query whether a cgroup controller is present
*
@@ -211,7 +218,8 @@ void virCgroupFree(virCgroupPtr *group)
* Returns true if a cgroup controller is mounted and is associated
* with this cgroup object.
*/
-bool virCgroupHasController(virCgroupPtr cgroup, int controller)
+bool
+virCgroupHasController(virCgroupPtr cgroup, int controller)
{
if (!cgroup)
return false;
@@ -221,8 +229,9 @@ bool virCgroupHasController(virCgroupPtr cgroup, int controller)
}
#if defined HAVE_MNTENT_H && defined HAVE_GETMNTENT_R
-static int virCgroupCopyMounts(virCgroupPtr group,
- virCgroupPtr parent)
+static int
+virCgroupCopyMounts(virCgroupPtr group,
+ virCgroupPtr parent)
{
size_t i;
for (i = 0; i < VIR_CGROUP_CONTROLLER_LAST; i++) {
@@ -240,11 +249,13 @@ static int virCgroupCopyMounts(virCgroupPtr group,
return 0;
}
+
/*
* Process /proc/mounts figuring out what controllers are
* mounted and where
*/
-static int virCgroupDetectMounts(virCgroupPtr group)
+static int
+virCgroupDetectMounts(virCgroupPtr group)
{
size_t i;
FILE *mounts = NULL;
@@ -312,7 +323,8 @@ static int virCgroupDetectMounts(virCgroupPtr group)
VIR_FREE(linksrc);
} else {
virReportSystemError(errno,
- _("Cannot stat %s"),
linksrc);
+ _("Cannot stat %s"),
+ linksrc);
goto error;
}
} else {
@@ -340,9 +352,10 @@ error:
}
-static int virCgroupCopyPlacement(virCgroupPtr group,
- const char *path,
- virCgroupPtr parent)
+static int
+virCgroupCopyPlacement(virCgroupPtr group,
+ const char *path,
+ virCgroupPtr parent)
{
size_t i;
for (i = 0; i < VIR_CGROUP_CONTROLLER_LAST; i++) {
@@ -397,9 +410,10 @@ static int virCgroupCopyPlacement(virCgroupPtr group,
*
* It then appends @path to each detected path.
*/
-static int virCgroupDetectPlacement(virCgroupPtr group,
- pid_t pid,
- const char *path)
+static int
+virCgroupDetectPlacement(virCgroupPtr group,
+ pid_t pid,
+ const char *path)
{
size_t i;
FILE *mapping = NULL;
@@ -492,11 +506,13 @@ cleanup:
return ret;
}
-static int virCgroupDetect(virCgroupPtr group,
- pid_t pid,
- int controllers,
- const char *path,
- virCgroupPtr parent)
+
+static int
+virCgroupDetect(virCgroupPtr group,
+ pid_t pid,
+ int controllers,
+ const char *path,
+ virCgroupPtr parent)
{
size_t i;
size_t j;
@@ -602,10 +618,11 @@ static int virCgroupDetect(virCgroupPtr group,
#endif
-int virCgroupPathOfController(virCgroupPtr group,
- int controller,
- const char *key,
- char **path)
+int
+virCgroupPathOfController(virCgroupPtr group,
+ int controller,
+ const char *key,
+ char **path)
{
if (controller == -1) {
size_t i;
@@ -652,10 +669,11 @@ int virCgroupPathOfController(virCgroupPtr group,
}
-static int virCgroupSetValueStr(virCgroupPtr group,
- int controller,
- const char *key,
- const char *value)
+static int
+virCgroupSetValueStr(virCgroupPtr group,
+ int controller,
+ const char *key,
+ const char *value)
{
int ret = -1;
char *keypath = NULL;
@@ -677,10 +695,12 @@ cleanup:
return ret;
}
-static int virCgroupGetValueStr(virCgroupPtr group,
- int controller,
- const char *key,
- char **value)
+
+static int
+virCgroupGetValueStr(virCgroupPtr group,
+ int controller,
+ const char *key,
+ char **value)
{
char *keypath = NULL;
int ret = -1, rc;
@@ -709,10 +729,12 @@ cleanup:
return ret;
}
-static int virCgroupSetValueU64(virCgroupPtr group,
- int controller,
- const char *key,
- unsigned long long int value)
+
+static int
+virCgroupSetValueU64(virCgroupPtr group,
+ int controller,
+ const char *key,
+ unsigned long long int value)
{
char *strval = NULL;
int ret;
@@ -728,11 +750,11 @@ static int virCgroupSetValueU64(virCgroupPtr group,
}
-
-static int virCgroupSetValueI64(virCgroupPtr group,
- int controller,
- const char *key,
- long long int value)
+static int
+virCgroupSetValueI64(virCgroupPtr group,
+ int controller,
+ const char *key,
+ long long int value)
{
char *strval = NULL;
int ret;
@@ -747,10 +769,12 @@ static int virCgroupSetValueI64(virCgroupPtr group,
return ret;
}
-static int virCgroupGetValueI64(virCgroupPtr group,
- int controller,
- const char *key,
- long long int *value)
+
+static int
+virCgroupGetValueI64(virCgroupPtr group,
+ int controller,
+ const char *key,
+ long long int *value)
{
char *strval = NULL;
int ret = -1;
@@ -772,10 +796,12 @@ cleanup:
return ret;
}
-static int virCgroupGetValueU64(virCgroupPtr group,
- int controller,
- const char *key,
- unsigned long long int *value)
+
+static int
+virCgroupGetValueU64(virCgroupPtr group,
+ int controller,
+ const char *key,
+ unsigned long long int *value)
{
char *strval = NULL;
int ret = -1;
@@ -799,7 +825,8 @@ cleanup:
#if defined HAVE_MNTENT_H && defined HAVE_GETMNTENT_R
-static int virCgroupCpuSetInherit(virCgroupPtr parent, virCgroupPtr group)
+static int
+virCgroupCpuSetInherit(virCgroupPtr parent, virCgroupPtr group)
{
size_t i;
const char *inherit_values[] = {
@@ -832,7 +859,9 @@ static int virCgroupCpuSetInherit(virCgroupPtr parent, virCgroupPtr
group)
return 0;
}
-static int virCgroupSetMemoryUseHierarchy(virCgroupPtr group)
+
+static int
+virCgroupSetMemoryUseHierarchy(virCgroupPtr group)
{
unsigned long long value;
const char *filename = "memory.use_hierarchy";
@@ -855,10 +884,12 @@ static int virCgroupSetMemoryUseHierarchy(virCgroupPtr group)
return 0;
}
-static int virCgroupMakeGroup(virCgroupPtr parent,
- virCgroupPtr group,
- bool create,
- unsigned int flags)
+
+static int
+virCgroupMakeGroup(virCgroupPtr parent,
+ virCgroupPtr group,
+ bool create,
+ unsigned int flags)
{
size_t i;
int ret = -1;
@@ -910,7 +941,8 @@ static int virCgroupMakeGroup(virCgroupPtr parent,
}
if (group->controllers[VIR_CGROUP_CONTROLLER_CPUSET].mountPoint != NULL
&&
(i == VIR_CGROUP_CONTROLLER_CPUSET ||
- STREQ(group->controllers[i].mountPoint,
group->controllers[VIR_CGROUP_CONTROLLER_CPUSET].mountPoint))) {
+ STREQ(group->controllers[i].mountPoint,
+ group->controllers[VIR_CGROUP_CONTROLLER_CPUSET].mountPoint)))
{
if (virCgroupCpuSetInherit(parent, group) < 0) {
VIR_FREE(path);
goto cleanup;
@@ -923,7 +955,8 @@ static int virCgroupMakeGroup(virCgroupPtr parent,
if ((flags & VIR_CGROUP_MEM_HIERACHY) &&
(group->controllers[VIR_CGROUP_CONTROLLER_MEMORY].mountPoint != NULL)
&&
(i == VIR_CGROUP_CONTROLLER_MEMORY ||
- STREQ(group->controllers[i].mountPoint,
group->controllers[VIR_CGROUP_CONTROLLER_MEMORY].mountPoint))) {
+ STREQ(group->controllers[i].mountPoint,
+ group->controllers[VIR_CGROUP_CONTROLLER_MEMORY].mountPoint)))
{
if (virCgroupSetMemoryUseHierarchy(group) < 0) {
VIR_FREE(path);
goto cleanup;
@@ -958,11 +991,12 @@ cleanup:
*
* Returns 0 on success, -1 on error
*/
-static int virCgroupNew(pid_t pid,
- const char *path,
- virCgroupPtr parent,
- int controllers,
- virCgroupPtr *group)
+static int
+virCgroupNew(pid_t pid,
+ const char *path,
+ virCgroupPtr parent,
+ int controllers,
+ virCgroupPtr *group)
{
VIR_DEBUG("parent=%p path=%s controllers=%d",
parent, path, controllers);
@@ -996,7 +1030,8 @@ error:
#endif
#if defined _DIRENT_HAVE_D_TYPE
-int virCgroupRemoveRecursively(char *grppath)
+int
+virCgroupRemoveRecursively(char *grppath)
{
DIR *grpdir;
struct dirent *ent;
@@ -1045,7 +1080,8 @@ int virCgroupRemoveRecursively(char *grppath)
return rc;
}
#else
-int virCgroupRemoveRecursively(char *grppath ATTRIBUTE_UNUSED)
+int
+virCgroupRemoveRecursively(char *grppath ATTRIBUTE_UNUSED)
{
virReportSystemError(ENXIO, "%s",
_("Control groups not supported on this platform"));
@@ -1053,6 +1089,7 @@ int virCgroupRemoveRecursively(char *grppath ATTRIBUTE_UNUSED)
}
#endif
+
/**
* virCgroupRemove:
*
@@ -1065,7 +1102,8 @@ int virCgroupRemoveRecursively(char *grppath ATTRIBUTE_UNUSED)
*
* Returns: 0 on success
*/
-int virCgroupRemove(virCgroupPtr group)
+int
+virCgroupRemove(virCgroupPtr group)
{
int rc = 0;
size_t i;
@@ -1110,7 +1148,8 @@ int virCgroupRemove(virCgroupPtr group)
*
* Returns: 0 on success, -1 on error
*/
-int virCgroupAddTask(virCgroupPtr group, pid_t pid)
+int
+virCgroupAddTask(virCgroupPtr group, pid_t pid)
{
int ret = -1;
size_t i;
@@ -1124,7 +1163,7 @@ int virCgroupAddTask(virCgroupPtr group, pid_t pid)
if (i == VIR_CGROUP_CONTROLLER_SYSTEMD)
continue;
- if (virCgroupSetValueU64(group, i, "tasks", (unsigned long long)pid)
< 0)
+ if (virCgroupSetValueU64(group, i, "tasks", pid) < 0)
goto cleanup;
}
@@ -1133,6 +1172,7 @@ cleanup:
return ret;
}
+
/**
* virCgroupAddTaskController:
*
@@ -1142,7 +1182,8 @@ cleanup:
*
* Returns: 0 on success or -1 on error
*/
-int virCgroupAddTaskController(virCgroupPtr group, pid_t pid, int controller)
+int
+virCgroupAddTaskController(virCgroupPtr group, pid_t pid, int controller)
{
if (controller < 0 || controller >= VIR_CGROUP_CONTROLLER_LAST) {
virReportError(VIR_ERR_INTERNAL_ERROR,
@@ -1162,9 +1203,10 @@ int virCgroupAddTaskController(virCgroupPtr group, pid_t pid, int
controller)
}
-static int virCgroupAddTaskStrController(virCgroupPtr group,
- const char *pidstr,
- int controller)
+static int
+virCgroupAddTaskStrController(virCgroupPtr group,
+ const char *pidstr,
+ int controller)
{
char *str = NULL, *cur = NULL, *next = NULL;
unsigned long long p = 0;
@@ -1205,6 +1247,7 @@ cleanup:
return rc;
}
+
/**
* virCgroupMoveTask:
*
@@ -1214,7 +1257,8 @@ cleanup:
*
* Returns: 0 on success or -1 on failure
*/
-int virCgroupMoveTask(virCgroupPtr src_group, virCgroupPtr dest_group)
+int
+virCgroupMoveTask(virCgroupPtr src_group, virCgroupPtr dest_group)
{
int ret = -1;
char *content = NULL;
@@ -1254,7 +1298,8 @@ cleanup:
#if defined HAVE_MNTENT_H && defined HAVE_GETMNTENT_R
-static int virCgroupPartitionNeedsEscaping(const char *path)
+static int
+virCgroupPartitionNeedsEscaping(const char *path)
{
FILE *fp = NULL;
int ret = 0;
@@ -1323,7 +1368,9 @@ cleanup:
return ret;
}
-static int virCgroupPartitionEscape(char **path)
+
+static int
+virCgroupPartitionEscape(char **path)
{
size_t len = strlen(*path) + 1;
int rc;
@@ -1338,7 +1385,9 @@ static int virCgroupPartitionEscape(char **path)
return 0;
}
-static int virCgroupSetPartitionSuffix(const char *path, char **res)
+
+static int
+virCgroupSetPartitionSuffix(const char *path, char **res)
{
char **tokens;
size_t i;
@@ -1382,6 +1431,7 @@ cleanup:
return ret;
}
+
/**
* virCgroupNewPartition:
* @path: path for the partition
@@ -1393,10 +1443,11 @@ cleanup:
*
* Returns 0 on success, -1 on failure
*/
-int virCgroupNewPartition(const char *path,
- bool create,
- int controllers,
- virCgroupPtr *group)
+int
+virCgroupNewPartition(const char *path,
+ bool create,
+ int controllers,
+ virCgroupPtr *group)
{
int ret = -1;
char *parentPath = NULL;
@@ -1446,10 +1497,11 @@ cleanup:
return ret;
}
#else
-int virCgroupNewPartition(const char *path ATTRIBUTE_UNUSED,
- bool create ATTRIBUTE_UNUSED,
- int controllers ATTRIBUTE_UNUSED,
- virCgroupPtr *group ATTRIBUTE_UNUSED)
+int
+virCgroupNewPartition(const char *path ATTRIBUTE_UNUSED,
+ bool create ATTRIBUTE_UNUSED,
+ int controllers ATTRIBUTE_UNUSED,
+ virCgroupPtr *group ATTRIBUTE_UNUSED)
{
virReportSystemError(ENXIO, "%s",
_("Control groups not supported on this platform"));
@@ -1468,7 +1520,8 @@ int virCgroupNewPartition(const char *path ATTRIBUTE_UNUSED,
*
* Returns 0 on success, or -1 on error
*/
-int virCgroupNewSelf(virCgroupPtr *group)
+int
+virCgroupNewSelf(virCgroupPtr *group)
{
return virCgroupNewDetect(-1, -1, group);
}
@@ -1485,11 +1538,12 @@ int virCgroupNewSelf(virCgroupPtr *group)
* Returns 0 on success, or -1 on error
*/
#if defined HAVE_MNTENT_H && defined HAVE_GETMNTENT_R
-int virCgroupNewDomainPartition(virCgroupPtr partition,
- const char *driver,
- const char *name,
- bool create,
- virCgroupPtr *group)
+int
+virCgroupNewDomainPartition(virCgroupPtr partition,
+ const char *driver,
+ const char *name,
+ bool create,
+ virCgroupPtr *group)
{
int ret = -1;
char *grpname = NULL;
@@ -1514,7 +1568,8 @@ int virCgroupNewDomainPartition(virCgroupPtr partition,
* a group for driver, is to avoid overhead to track
* cumulative usage that we don't need.
*/
- if (virCgroupMakeGroup(partition, *group, create, VIR_CGROUP_MEM_HIERACHY) < 0) {
+ if (virCgroupMakeGroup(partition, *group, create,
+ VIR_CGROUP_MEM_HIERACHY) < 0) {
virCgroupRemove(*group);
virCgroupFree(group);
goto cleanup;
@@ -1527,11 +1582,12 @@ cleanup:
return ret;
}
#else
-int virCgroupNewDomainPartition(virCgroupPtr partition ATTRIBUTE_UNUSED,
- const char *driver ATTRIBUTE_UNUSED,
- const char *name ATTRIBUTE_UNUSED,
- bool create ATTRIBUTE_UNUSED,
- virCgroupPtr *group ATTRIBUTE_UNUSED)
+int
+virCgroupNewDomainPartition(virCgroupPtr partition ATTRIBUTE_UNUSED,
+ const char *driver ATTRIBUTE_UNUSED,
+ const char *name ATTRIBUTE_UNUSED,
+ bool create ATTRIBUTE_UNUSED,
+ virCgroupPtr *group ATTRIBUTE_UNUSED)
{
virReportSystemError(ENXIO, "%s",
_("Control groups not supported on this platform"));
@@ -1539,6 +1595,7 @@ int virCgroupNewDomainPartition(virCgroupPtr partition
ATTRIBUTE_UNUSED,
}
#endif
+
/**
* virCgroupNewVcpu:
*
@@ -1550,10 +1607,11 @@ int virCgroupNewDomainPartition(virCgroupPtr partition
ATTRIBUTE_UNUSED,
* Returns 0 on success, or -1 on error
*/
#if defined HAVE_MNTENT_H && defined HAVE_GETMNTENT_R
-int virCgroupNewVcpu(virCgroupPtr domain,
- int vcpuid,
- bool create,
- virCgroupPtr *group)
+int
+virCgroupNewVcpu(virCgroupPtr domain,
+ int vcpuid,
+ bool create,
+ virCgroupPtr *group)
{
int ret = -1;
char *name = NULL;
@@ -1581,10 +1639,11 @@ cleanup:
return ret;
}
#else
-int virCgroupNewVcpu(virCgroupPtr domain ATTRIBUTE_UNUSED,
- int vcpuid ATTRIBUTE_UNUSED,
- bool create ATTRIBUTE_UNUSED,
- virCgroupPtr *group ATTRIBUTE_UNUSED)
+int
+virCgroupNewVcpu(virCgroupPtr domain ATTRIBUTE_UNUSED,
+ int vcpuid ATTRIBUTE_UNUSED,
+ bool create ATTRIBUTE_UNUSED,
+ virCgroupPtr *group ATTRIBUTE_UNUSED)
{
virReportSystemError(ENXIO, "%s",
_("Control groups not supported on this platform"));
@@ -1592,6 +1651,7 @@ int virCgroupNewVcpu(virCgroupPtr domain ATTRIBUTE_UNUSED,
}
#endif
+
/**
* virCgroupNewEmulator:
*
@@ -1602,9 +1662,10 @@ int virCgroupNewVcpu(virCgroupPtr domain ATTRIBUTE_UNUSED,
* Returns: 0 on success or -1 on error
*/
#if defined HAVE_MNTENT_H && defined HAVE_GETMNTENT_R
-int virCgroupNewEmulator(virCgroupPtr domain,
- bool create,
- virCgroupPtr *group)
+int
+virCgroupNewEmulator(virCgroupPtr domain,
+ bool create,
+ virCgroupPtr *group)
{
int ret = -1;
int controllers;
@@ -1627,9 +1688,10 @@ cleanup:
return ret;
}
#else
-int virCgroupNewEmulator(virCgroupPtr domain ATTRIBUTE_UNUSED,
- bool create ATTRIBUTE_UNUSED,
- virCgroupPtr *group ATTRIBUTE_UNUSED)
+int
+virCgroupNewEmulator(virCgroupPtr domain ATTRIBUTE_UNUSED,
+ bool create ATTRIBUTE_UNUSED,
+ virCgroupPtr *group ATTRIBUTE_UNUSED)
{
virReportSystemError(ENXIO, "%s",
_("Control groups not supported on this platform"));
@@ -1640,16 +1702,18 @@ int virCgroupNewEmulator(virCgroupPtr domain ATTRIBUTE_UNUSED,
#if defined HAVE_MNTENT_H && defined HAVE_GETMNTENT_R
-int virCgroupNewDetect(pid_t pid,
- int controllers,
- virCgroupPtr *group)
+int
+virCgroupNewDetect(pid_t pid,
+ int controllers,
+ virCgroupPtr *group)
{
return virCgroupNew(pid, "", NULL, controllers, group);
}
#else
-int virCgroupNewDetect(pid_t pid ATTRIBUTE_UNUSED,
- int controllers ATTRIBUTE_UNUSED,
- virCgroupPtr *group ATTRIBUTE_UNUSED)
+int
+virCgroupNewDetect(pid_t pid ATTRIBUTE_UNUSED,
+ int controllers ATTRIBUTE_UNUSED,
+ virCgroupPtr *group ATTRIBUTE_UNUSED)
{
virReportSystemError(ENXIO, "%s",
_("Control groups not supported on this platform"));
@@ -1657,15 +1721,17 @@ int virCgroupNewDetect(pid_t pid ATTRIBUTE_UNUSED,
}
#endif
+
/*
* Returns 0 on success (but @group may be NULL), -1 on fatal error
*/
-int virCgroupNewDetectMachine(const char *name,
- const char *drivername,
- pid_t pid,
- const char *partition,
- int controllers,
- virCgroupPtr *group)
+int
+virCgroupNewDetectMachine(const char *name,
+ const char *drivername,
+ pid_t pid,
+ const char *partition,
+ int controllers,
+ virCgroupPtr *group)
{
if (virCgroupNewDetect(pid, controllers, group) < 0) {
if (virCgroupNewIgnoreError())
@@ -1673,7 +1739,8 @@ int virCgroupNewDetectMachine(const char *name,
return -1;
}
- if (!virCgroupValidateMachineGroup(*group, name, drivername, partition, true)) {
+ if (!virCgroupValidateMachineGroup(*group, name, drivername, partition,
+ true)) {
VIR_DEBUG("Failed to validate machine name for '%s' driver
'%s'",
name, drivername);
virCgroupFree(group);
@@ -1683,6 +1750,7 @@ int virCgroupNewDetectMachine(const char *name,
return 0;
}
+
/*
* Returns 0 on success, -1 on fatal error, -2 on systemd not available
*/
@@ -1789,6 +1857,7 @@ virCgroupNewMachineSystemd(const char *name,
return ret;
}
+
static int
virCgroupNewMachineManual(const char *name,
const char *drivername,
@@ -1836,16 +1905,18 @@ cleanup:
return ret;
}
-int virCgroupNewMachine(const char *name,
- const char *drivername,
- bool privileged,
- const unsigned char *uuid,
- const char *rootdir,
- pid_t pidleader,
- bool isContainer,
- const char *partition,
- int controllers,
- virCgroupPtr *group)
+
+int
+virCgroupNewMachine(const char *name,
+ const char *drivername,
+ bool privileged,
+ const unsigned char *uuid,
+ const char *rootdir,
+ pid_t pidleader,
+ bool isContainer,
+ const char *partition,
+ int controllers,
+ virCgroupPtr *group)
{
int rv;
@@ -1874,7 +1945,9 @@ int virCgroupNewMachine(const char *name,
group);
}
-bool virCgroupNewIgnoreError(void)
+
+bool
+virCgroupNewIgnoreError(void)
{
if (virLastErrorIsSystemErrno(ENXIO) ||
virLastErrorIsSystemErrno(EPERM) ||
@@ -1886,6 +1959,7 @@ bool virCgroupNewIgnoreError(void)
return false;
}
+
/**
* virCgroupSetBlkioWeight:
*
@@ -1894,7 +1968,8 @@ bool virCgroupNewIgnoreError(void)
*
* Returns: 0 on success, -1 on error
*/
-int virCgroupSetBlkioWeight(virCgroupPtr group, unsigned int weight)
+int
+virCgroupSetBlkioWeight(virCgroupPtr group, unsigned int weight)
{
if (weight > 1000 || weight < 100) {
virReportError(VIR_ERR_INVALID_ARG,
@@ -1909,6 +1984,7 @@ int virCgroupSetBlkioWeight(virCgroupPtr group, unsigned int
weight)
weight);
}
+
/**
* virCgroupGetBlkioWeight:
*
@@ -1917,7 +1993,8 @@ int virCgroupSetBlkioWeight(virCgroupPtr group, unsigned int
weight)
*
* Returns: 0 on success, -1 on error
*/
-int virCgroupGetBlkioWeight(virCgroupPtr group, unsigned int *weight)
+int
+virCgroupGetBlkioWeight(virCgroupPtr group, unsigned int *weight)
{
unsigned long long tmp;
int ret;
@@ -1929,6 +2006,7 @@ int virCgroupGetBlkioWeight(virCgroupPtr group, unsigned int
*weight)
return ret;
}
+
/**
* virCgroupSetBlkioDeviceWeight:
*
@@ -1942,9 +2020,10 @@ int virCgroupGetBlkioWeight(virCgroupPtr group, unsigned int
*weight)
* Returns: 0 on success, -1 on error
*/
#if defined(major) && defined(minor)
-int virCgroupSetBlkioDeviceWeight(virCgroupPtr group,
- const char *path,
- unsigned int weight)
+int
+virCgroupSetBlkioDeviceWeight(virCgroupPtr group,
+ const char *path,
+ unsigned int weight)
{
char *str;
struct stat sb;
@@ -1994,6 +2073,7 @@ virCgroupSetBlkioDeviceWeight(virCgroupPtr group ATTRIBUTE_UNUSED,
}
#endif
+
/**
* virCgroupSetMemory:
*
@@ -2002,7 +2082,8 @@ virCgroupSetBlkioDeviceWeight(virCgroupPtr group ATTRIBUTE_UNUSED,
*
* Returns: 0 on success
*/
-int virCgroupSetMemory(virCgroupPtr group, unsigned long long kb)
+int
+virCgroupSetMemory(virCgroupPtr group, unsigned long long kb)
{
unsigned long long maxkb = VIR_DOMAIN_MEMORY_PARAM_UNLIMITED;
@@ -2025,6 +2106,7 @@ int virCgroupSetMemory(virCgroupPtr group, unsigned long long kb)
kb << 10);
}
+
/**
* virCgroupGetMemoryUsage:
*
@@ -2033,7 +2115,8 @@ int virCgroupSetMemory(virCgroupPtr group, unsigned long long kb)
*
* Returns: 0 on success
*/
-int virCgroupGetMemoryUsage(virCgroupPtr group, unsigned long *kb)
+int
+virCgroupGetMemoryUsage(virCgroupPtr group, unsigned long *kb)
{
long long unsigned int usage_in_bytes;
int ret;
@@ -2045,6 +2128,7 @@ int virCgroupGetMemoryUsage(virCgroupPtr group, unsigned long *kb)
return ret;
}
+
/**
* virCgroupSetMemoryHardLimit:
*
@@ -2053,11 +2137,13 @@ int virCgroupGetMemoryUsage(virCgroupPtr group, unsigned long
*kb)
*
* Returns: 0 on success
*/
-int virCgroupSetMemoryHardLimit(virCgroupPtr group, unsigned long long kb)
+int
+virCgroupSetMemoryHardLimit(virCgroupPtr group, unsigned long long kb)
{
return virCgroupSetMemory(group, kb);
}
+
/**
* virCgroupGetMemoryHardLimit:
*
@@ -2066,7 +2152,8 @@ int virCgroupSetMemoryHardLimit(virCgroupPtr group, unsigned long
long kb)
*
* Returns: 0 on success
*/
-int virCgroupGetMemoryHardLimit(virCgroupPtr group, unsigned long long *kb)
+int
+virCgroupGetMemoryHardLimit(virCgroupPtr group, unsigned long long *kb)
{
long long unsigned int limit_in_bytes;
int ret;
@@ -2078,6 +2165,7 @@ int virCgroupGetMemoryHardLimit(virCgroupPtr group, unsigned long
long *kb)
return ret;
}
+
/**
* virCgroupSetMemorySoftLimit:
*
@@ -2086,7 +2174,8 @@ int virCgroupGetMemoryHardLimit(virCgroupPtr group, unsigned long
long *kb)
*
* Returns: 0 on success
*/
-int virCgroupSetMemorySoftLimit(virCgroupPtr group, unsigned long long kb)
+int
+virCgroupSetMemorySoftLimit(virCgroupPtr group, unsigned long long kb)
{
unsigned long long maxkb = VIR_DOMAIN_MEMORY_PARAM_UNLIMITED;
@@ -2118,7 +2207,8 @@ int virCgroupSetMemorySoftLimit(virCgroupPtr group, unsigned long
long kb)
*
* Returns: 0 on success
*/
-int virCgroupGetMemorySoftLimit(virCgroupPtr group, unsigned long long *kb)
+int
+virCgroupGetMemorySoftLimit(virCgroupPtr group, unsigned long long *kb)
{
long long unsigned int limit_in_bytes;
int ret;
@@ -2130,6 +2220,7 @@ int virCgroupGetMemorySoftLimit(virCgroupPtr group, unsigned long
long *kb)
return ret;
}
+
/**
* virCgroupSetMemSwapHardLimit:
*
@@ -2138,7 +2229,8 @@ int virCgroupGetMemorySoftLimit(virCgroupPtr group, unsigned long
long *kb)
*
* Returns: 0 on success
*/
-int virCgroupSetMemSwapHardLimit(virCgroupPtr group, unsigned long long kb)
+int
+virCgroupSetMemSwapHardLimit(virCgroupPtr group, unsigned long long kb)
{
unsigned long long maxkb = VIR_DOMAIN_MEMORY_PARAM_UNLIMITED;
@@ -2161,6 +2253,7 @@ int virCgroupSetMemSwapHardLimit(virCgroupPtr group, unsigned long
long kb)
kb << 10);
}
+
/**
* virCgroupGetMemSwapHardLimit:
*
@@ -2169,7 +2262,8 @@ int virCgroupSetMemSwapHardLimit(virCgroupPtr group, unsigned long
long kb)
*
* Returns: 0 on success
*/
-int virCgroupGetMemSwapHardLimit(virCgroupPtr group, unsigned long long *kb)
+int
+virCgroupGetMemSwapHardLimit(virCgroupPtr group, unsigned long long *kb)
{
long long unsigned int limit_in_bytes;
int ret;
@@ -2181,6 +2275,7 @@ int virCgroupGetMemSwapHardLimit(virCgroupPtr group, unsigned long
long *kb)
return ret;
}
+
/**
* virCgroupGetMemSwapUsage:
*
@@ -2189,7 +2284,8 @@ int virCgroupGetMemSwapHardLimit(virCgroupPtr group, unsigned long
long *kb)
*
* Returns: 0 on success
*/
-int virCgroupGetMemSwapUsage(virCgroupPtr group, unsigned long long *kb)
+int
+virCgroupGetMemSwapUsage(virCgroupPtr group, unsigned long long *kb)
{
long long unsigned int usage_in_bytes;
int ret;
@@ -2201,6 +2297,7 @@ int virCgroupGetMemSwapUsage(virCgroupPtr group, unsigned long long
*kb)
return ret;
}
+
/**
* virCgroupSetCpusetMems:
*
@@ -2209,7 +2306,8 @@ int virCgroupGetMemSwapUsage(virCgroupPtr group, unsigned long long
*kb)
*
* Returns: 0 on success
*/
-int virCgroupSetCpusetMems(virCgroupPtr group, const char *mems)
+int
+virCgroupSetCpusetMems(virCgroupPtr group, const char *mems)
{
return virCgroupSetValueStr(group,
VIR_CGROUP_CONTROLLER_CPUSET,
@@ -2217,6 +2315,7 @@ int virCgroupSetCpusetMems(virCgroupPtr group, const char *mems)
mems);
}
+
/**
* virCgroupGetCpusetMems:
*
@@ -2225,7 +2324,8 @@ int virCgroupSetCpusetMems(virCgroupPtr group, const char *mems)
*
* Returns: 0 on success
*/
-int virCgroupGetCpusetMems(virCgroupPtr group, char **mems)
+int
+virCgroupGetCpusetMems(virCgroupPtr group, char **mems)
{
return virCgroupGetValueStr(group,
VIR_CGROUP_CONTROLLER_CPUSET,
@@ -2233,6 +2333,7 @@ int virCgroupGetCpusetMems(virCgroupPtr group, char **mems)
mems);
}
+
/**
* virCgroupSetCpusetCpus:
*
@@ -2241,7 +2342,8 @@ int virCgroupGetCpusetMems(virCgroupPtr group, char **mems)
*
* Retuens: 0 on success
*/
-int virCgroupSetCpusetCpus(virCgroupPtr group, const char *cpus)
+int
+virCgroupSetCpusetCpus(virCgroupPtr group, const char *cpus)
{
return virCgroupSetValueStr(group,
VIR_CGROUP_CONTROLLER_CPUSET,
@@ -2249,6 +2351,7 @@ int virCgroupSetCpusetCpus(virCgroupPtr group, const char *cpus)
cpus);
}
+
/**
* virCgroupGetCpusetCpus:
*
@@ -2257,7 +2360,8 @@ int virCgroupSetCpusetCpus(virCgroupPtr group, const char *cpus)
*
* Retuens: 0 on success
*/
-int virCgroupGetCpusetCpus(virCgroupPtr group, char **cpus)
+int
+virCgroupGetCpusetCpus(virCgroupPtr group, char **cpus)
{
return virCgroupGetValueStr(group,
VIR_CGROUP_CONTROLLER_CPUSET,
@@ -2265,6 +2369,7 @@ int virCgroupGetCpusetCpus(virCgroupPtr group, char **cpus)
cpus);
}
+
/**
* virCgroupDenyAllDevices:
*
@@ -2272,7 +2377,8 @@ int virCgroupGetCpusetCpus(virCgroupPtr group, char **cpus)
*
* Returns: 0 on success
*/
-int virCgroupDenyAllDevices(virCgroupPtr group)
+int
+virCgroupDenyAllDevices(virCgroupPtr group)
{
return virCgroupSetValueStr(group,
VIR_CGROUP_CONTROLLER_DEVICES,
@@ -2280,6 +2386,7 @@ int virCgroupDenyAllDevices(virCgroupPtr group)
"a");
}
+
/**
* virCgroupAllowDevice:
*
@@ -2291,8 +2398,9 @@ int virCgroupDenyAllDevices(virCgroupPtr group)
*
* Returns: 0 on success
*/
-int virCgroupAllowDevice(virCgroupPtr group, char type, int major, int minor,
- int perms)
+int
+virCgroupAllowDevice(virCgroupPtr group, char type, int major, int minor,
+ int perms)
{
int ret = -1;
char *devstr = NULL;
@@ -2316,6 +2424,7 @@ cleanup:
return ret;
}
+
/**
* virCgroupAllowDeviceMajor:
*
@@ -2326,8 +2435,9 @@ cleanup:
*
* Returns: 0 on success
*/
-int virCgroupAllowDeviceMajor(virCgroupPtr group, char type, int major,
- int perms)
+int
+virCgroupAllowDeviceMajor(virCgroupPtr group, char type, int major,
+ int perms)
{
int ret = -1;
char *devstr = NULL;
@@ -2351,6 +2461,7 @@ cleanup:
return ret;
}
+
/**
* virCgroupAllowDevicePath:
*
@@ -2365,7 +2476,8 @@ cleanup:
* -1 on error
*/
#if defined(major) && defined(minor)
-int virCgroupAllowDevicePath(virCgroupPtr group, const char *path, int perms)
+int
+virCgroupAllowDevicePath(virCgroupPtr group, const char *path, int perms)
{
struct stat sb;
@@ -2386,9 +2498,10 @@ int virCgroupAllowDevicePath(virCgroupPtr group, const char *path,
int perms)
perms);
}
#else
-int virCgroupAllowDevicePath(virCgroupPtr group ATTRIBUTE_UNUSED,
- const char *path ATTRIBUTE_UNUSED,
- int perms ATTRIBUTE_UNUSED)
+int
+virCgroupAllowDevicePath(virCgroupPtr group ATTRIBUTE_UNUSED,
+ const char *path ATTRIBUTE_UNUSED,
+ int perms ATTRIBUTE_UNUSED)
{
virReportSystemError(ENOSYS, "%s",
_("Control groups not supported on this platform"));
@@ -2408,8 +2521,9 @@ int virCgroupAllowDevicePath(virCgroupPtr group ATTRIBUTE_UNUSED,
*
* Returns: 0 on success
*/
-int virCgroupDenyDevice(virCgroupPtr group, char type, int major, int minor,
- int perms)
+int
+virCgroupDenyDevice(virCgroupPtr group, char type, int major, int minor,
+ int perms)
{
int ret = -1;
char *devstr = NULL;
@@ -2433,6 +2547,7 @@ cleanup:
return ret;
}
+
/**
* virCgroupDenyDeviceMajor:
*
@@ -2443,8 +2558,9 @@ cleanup:
*
* Returns: 0 on success
*/
-int virCgroupDenyDeviceMajor(virCgroupPtr group, char type, int major,
- int perms)
+int
+virCgroupDenyDeviceMajor(virCgroupPtr group, char type, int major,
+ int perms)
{
int ret = -1;
char *devstr = NULL;
@@ -2468,8 +2584,10 @@ cleanup:
return ret;
}
+
#if defined(major) && defined(minor)
-int virCgroupDenyDevicePath(virCgroupPtr group, const char *path, int perms)
+int
+virCgroupDenyDevicePath(virCgroupPtr group, const char *path, int perms)
{
struct stat sb;
@@ -2490,9 +2608,10 @@ int virCgroupDenyDevicePath(virCgroupPtr group, const char *path,
int perms)
perms);
}
#else
-int virCgroupDenyDevicePath(virCgroupPtr group ATTRIBUTE_UNUSED,
- const char *path ATTRIBUTE_UNUSED,
- int perms ATTRIBUTE_UNUSED)
+int
+virCgroupDenyDevicePath(virCgroupPtr group ATTRIBUTE_UNUSED,
+ const char *path ATTRIBUTE_UNUSED,
+ int perms ATTRIBUTE_UNUSED)
{
virReportSystemError(ENOSYS, "%s",
_("Control groups not supported on this platform"));
@@ -2500,20 +2619,25 @@ int virCgroupDenyDevicePath(virCgroupPtr group ATTRIBUTE_UNUSED,
}
#endif
-int virCgroupSetCpuShares(virCgroupPtr group, unsigned long long shares)
+
+int
+virCgroupSetCpuShares(virCgroupPtr group, unsigned long long shares)
{
return virCgroupSetValueU64(group,
VIR_CGROUP_CONTROLLER_CPU,
"cpu.shares", shares);
}
-int virCgroupGetCpuShares(virCgroupPtr group, unsigned long long *shares)
+
+int
+virCgroupGetCpuShares(virCgroupPtr group, unsigned long long *shares)
{
return virCgroupGetValueU64(group,
VIR_CGROUP_CONTROLLER_CPU,
"cpu.shares", shares);
}
+
/**
* virCgroupSetCpuCfsPeriod:
*
@@ -2522,7 +2646,8 @@ int virCgroupGetCpuShares(virCgroupPtr group, unsigned long long
*shares)
*
* Returns: 0 on success
*/
-int virCgroupSetCpuCfsPeriod(virCgroupPtr group, unsigned long long cfs_period)
+int
+virCgroupSetCpuCfsPeriod(virCgroupPtr group, unsigned long long cfs_period)
{
/* The cfs_period shoule be greater or equal than 1ms, and less or equal
* than 1s.
@@ -2539,6 +2664,7 @@ int virCgroupSetCpuCfsPeriod(virCgroupPtr group, unsigned long long
cfs_period)
"cpu.cfs_period_us", cfs_period);
}
+
/**
* virCgroupGetCpuCfsPeriod:
*
@@ -2547,13 +2673,15 @@ int virCgroupSetCpuCfsPeriod(virCgroupPtr group, unsigned long
long cfs_period)
*
* Returns: 0 on success
*/
-int virCgroupGetCpuCfsPeriod(virCgroupPtr group, unsigned long long *cfs_period)
+int
+virCgroupGetCpuCfsPeriod(virCgroupPtr group, unsigned long long *cfs_period)
{
return virCgroupGetValueU64(group,
VIR_CGROUP_CONTROLLER_CPU,
"cpu.cfs_period_us", cfs_period);
}
+
/**
* virCgroupSetCpuCfsQuota:
*
@@ -2563,7 +2691,8 @@ int virCgroupGetCpuCfsPeriod(virCgroupPtr group, unsigned long long
*cfs_period)
*
* Returns: 0 on success
*/
-int virCgroupSetCpuCfsQuota(virCgroupPtr group, long long cfs_quota)
+int
+virCgroupSetCpuCfsQuota(virCgroupPtr group, long long cfs_quota)
{
/* The cfs_quota should be greater or equal than 1ms */
if (cfs_quota >= 0 &&
@@ -2580,6 +2709,7 @@ int virCgroupSetCpuCfsQuota(virCgroupPtr group, long long
cfs_quota)
"cpu.cfs_quota_us", cfs_quota);
}
+
/**
* virCgroupGetCpuCfsQuota:
*
@@ -2589,29 +2719,36 @@ int virCgroupSetCpuCfsQuota(virCgroupPtr group, long long
cfs_quota)
*
* Returns: 0 on success
*/
-int virCgroupGetCpuCfsQuota(virCgroupPtr group, long long *cfs_quota)
+int
+virCgroupGetCpuCfsQuota(virCgroupPtr group, long long *cfs_quota)
{
return virCgroupGetValueI64(group,
VIR_CGROUP_CONTROLLER_CPU,
"cpu.cfs_quota_us", cfs_quota);
}
-int virCgroupGetCpuacctUsage(virCgroupPtr group, unsigned long long *usage)
+
+int
+virCgroupGetCpuacctUsage(virCgroupPtr group, unsigned long long *usage)
{
return virCgroupGetValueU64(group,
VIR_CGROUP_CONTROLLER_CPUACCT,
"cpuacct.usage", usage);
}
-int virCgroupGetCpuacctPercpuUsage(virCgroupPtr group, char **usage)
+
+int
+virCgroupGetCpuacctPercpuUsage(virCgroupPtr group, char **usage)
{
return virCgroupGetValueStr(group, VIR_CGROUP_CONTROLLER_CPUACCT,
"cpuacct.usage_percpu", usage);
}
+
#ifdef _SC_CLK_TCK
-int virCgroupGetCpuacctStat(virCgroupPtr group, unsigned long long *user,
- unsigned long long *sys)
+int
+virCgroupGetCpuacctStat(virCgroupPtr group, unsigned long long *user,
+ unsigned long long *sys)
{
char *str;
char *p;
@@ -2657,9 +2794,10 @@ cleanup:
return ret;
}
#else
-int virCgroupGetCpuacctStat(virCgroupPtr group ATTRIBUTE_UNUSED,
- unsigned long long *user ATTRIBUTE_UNUSED,
- unsigned long long *sys ATTRIBUTE_UNUSED)
+int
+virCgroupGetCpuacctStat(virCgroupPtr group ATTRIBUTE_UNUSED,
+ unsigned long long *user ATTRIBUTE_UNUSED,
+ unsigned long long *sys ATTRIBUTE_UNUSED)
{
virReportSystemError(ENOSYS, "%s",
_("Control groups not supported on this platform"));
@@ -2667,14 +2805,18 @@ int virCgroupGetCpuacctStat(virCgroupPtr group ATTRIBUTE_UNUSED,
}
#endif
-int virCgroupSetFreezerState(virCgroupPtr group, const char *state)
+
+int
+virCgroupSetFreezerState(virCgroupPtr group, const char *state)
{
return virCgroupSetValueStr(group,
VIR_CGROUP_CONTROLLER_FREEZER,
"freezer.state", state);
}
-int virCgroupGetFreezerState(virCgroupPtr group, char **state)
+
+int
+virCgroupGetFreezerState(virCgroupPtr group, char **state)
{
return virCgroupGetValueStr(group,
VIR_CGROUP_CONTROLLER_FREEZER,
@@ -2686,7 +2828,8 @@ int virCgroupGetFreezerState(virCgroupPtr group, char **state)
/*
* Returns 1 if some PIDs are killed, 0 if none are killed, or -1 on error
*/
-static int virCgroupKillInternal(virCgroupPtr group, int signum, virHashTablePtr pids)
+static int
+virCgroupKillInternal(virCgroupPtr group, int signum, virHashTablePtr pids)
{
int ret = -1;
bool killedAny = false;
@@ -2761,24 +2904,33 @@ cleanup:
}
-static uint32_t virCgroupPidCode(const void *name, uint32_t seed)
+static uint32_t
+virCgroupPidCode(const void *name, uint32_t seed)
{
unsigned long pid_value = (unsigned long)(intptr_t)name;
return virHashCodeGen(&pid_value, sizeof(pid_value), seed);
}
-static bool virCgroupPidEqual(const void *namea, const void *nameb)
+
+
+static bool
+virCgroupPidEqual(const void *namea, const void *nameb)
{
return namea == nameb;
}
-static void *virCgroupPidCopy(const void *name)
+
+
+static void *
+virCgroupPidCopy(const void *name)
{
return (void*)name;
}
+
/*
* Returns 1 if some PIDs are killed, 0 if none are killed, or -1 on error
*/
-int virCgroupKill(virCgroupPtr group, int signum)
+int
+virCgroupKill(virCgroupPtr group, int signum)
{
VIR_DEBUG("group=%p path=%s signum=%d", group, group->path, signum);
int ret;
@@ -2801,7 +2953,11 @@ int virCgroupKill(virCgroupPtr group, int signum)
}
-static int virCgroupKillRecursiveInternal(virCgroupPtr group, int signum, virHashTablePtr
pids, bool dormdir)
+static int
+virCgroupKillRecursiveInternal(virCgroupPtr group,
+ int signum,
+ virHashTablePtr pids,
+ bool dormdir)
{
int ret = -1;
int rc;
@@ -2810,7 +2966,8 @@ static int virCgroupKillRecursiveInternal(virCgroupPtr group, int
signum, virHas
DIR *dp;
virCgroupPtr subgroup = NULL;
struct dirent *ent;
- VIR_DEBUG("group=%p path=%s signum=%d pids=%p", group, group->path,
signum, pids);
+ VIR_DEBUG("group=%p path=%s signum=%d pids=%p",
+ group, group->path, signum, pids);
if (virCgroupPathOfController(group, -1, "", &keypath) < 0)
return -1;
@@ -2845,7 +3002,8 @@ static int virCgroupKillRecursiveInternal(virCgroupPtr group, int
signum, virHas
if (virCgroupNew(-1, ent->d_name, group, -1, &subgroup) < 0)
goto cleanup;
- if ((rc = virCgroupKillRecursiveInternal(subgroup, signum, pids, true)) < 0)
+ if ((rc = virCgroupKillRecursiveInternal(subgroup, signum, pids,
+ true)) < 0)
goto cleanup;
if (rc == 1)
killedAny = true;
@@ -2866,7 +3024,9 @@ cleanup:
return ret;
}
-int virCgroupKillRecursive(virCgroupPtr group, int signum)
+
+int
+virCgroupKillRecursive(virCgroupPtr group, int signum)
{
int ret;
VIR_DEBUG("group=%p path=%s signum=%d", group, group->path, signum);
@@ -2885,7 +3045,8 @@ int virCgroupKillRecursive(virCgroupPtr group, int signum)
}
-int virCgroupKillPainfully(virCgroupPtr group)
+int
+virCgroupKillPainfully(virCgroupPtr group)
{
size_t i;
int ret;
@@ -2912,22 +3073,28 @@ int virCgroupKillPainfully(virCgroupPtr group)
}
#else /* !(HAVE_KILL, HAVE_MNTENT_H, HAVE_GETMNTENT_R) */
-int virCgroupKill(virCgroupPtr group ATTRIBUTE_UNUSED,
- int signum ATTRIBUTE_UNUSED)
+int
+virCgroupKill(virCgroupPtr group ATTRIBUTE_UNUSED,
+ int signum ATTRIBUTE_UNUSED)
{
virReportSystemError(ENOSYS, "%s",
_("Control groups not supported on this platform"));
return -1;
}
-int virCgroupKillRecursive(virCgroupPtr group ATTRIBUTE_UNUSED,
- int signum ATTRIBUTE_UNUSED)
+
+
+int
+virCgroupKillRecursive(virCgroupPtr group ATTRIBUTE_UNUSED,
+ int signum ATTRIBUTE_UNUSED)
{
virReportSystemError(ENOSYS, "%s",
_("Control groups not supported on this platform"));
return -1;
}
-int virCgroupKillPainfully(virCgroupPtr group ATTRIBUTE_UNUSED)
+
+int
+virCgroupKillPainfully(virCgroupPtr group ATTRIBUTE_UNUSED)
{
virReportSystemError(ENOSYS, "%s",
_("Control groups not supported on this platform"));
@@ -2935,8 +3102,10 @@ int virCgroupKillPainfully(virCgroupPtr group ATTRIBUTE_UNUSED)
}
#endif /* HAVE_KILL, HAVE_MNTENT_H, HAVE_GETMNTENT_R */
+
#ifdef __linux__
-static char *virCgroupIdentifyRoot(virCgroupPtr group)
+static char *
+virCgroupIdentifyRoot(virCgroupPtr group)
{
char *ret = NULL;
size_t i;
@@ -2964,8 +3133,9 @@ static char *virCgroupIdentifyRoot(virCgroupPtr group)
}
-int virCgroupIsolateMount(virCgroupPtr group, const char *oldroot,
- const char *mountopts)
+int
+virCgroupIsolateMount(virCgroupPtr group, const char *oldroot,
+ const char *mountopts)
{
int ret = -1;
size_t i;
@@ -3007,7 +3177,8 @@ int virCgroupIsolateMount(virCgroupPtr group, const char *oldroot,
group->controllers[i].placement) < 0)
goto cleanup;
- VIR_DEBUG("Create mount point '%s'",
group->controllers[i].mountPoint);
+ VIR_DEBUG("Create mount point '%s'",
+ group->controllers[i].mountPoint);
if (virFileMakePath(group->controllers[i].mountPoint) < 0) {
virReportSystemError(errno,
_("Unable to create directory %s"),
@@ -3016,7 +3187,8 @@ int virCgroupIsolateMount(virCgroupPtr group, const char *oldroot,
goto cleanup;
}
- if (mount(src, group->controllers[i].mountPoint, NULL, MS_BIND, NULL) <
0) {
+ if (mount(src, group->controllers[i].mountPoint, NULL, MS_BIND,
+ NULL) < 0) {
virReportSystemError(errno,
_("Failed to bind cgroup '%s' on
'%s'"),
src, group->controllers[i].mountPoint);
@@ -3049,9 +3221,10 @@ cleanup:
return ret;
}
#else /* __linux__ */
-int virCgroupIsolateMount(virCgroupPtr group ATTRIBUTE_UNUSED,
- const char *oldroot ATTRIBUTE_UNUSED,
- const char *mountopts ATTRIBUTE_UNUSED)
+int
+virCgroupIsolateMount(virCgroupPtr group ATTRIBUTE_UNUSED,
+ const char *oldroot ATTRIBUTE_UNUSED,
+ const char *mountopts ATTRIBUTE_UNUSED)
{
virReportSystemError(ENOSYS, "%s",
_("Control groups not supported on this platform"));
--
1.8.3.1