[libvirt] [PATCH v2 5/5] cgroup macros refactoring

Roman Bogorodskiy bogorodskiy at gmail.com
Sun Aug 11 12:04:29 UTC 2013


Complete the refactoring by adding missing stubs so it compiles on
platform without cgroup support.
---
 src/util/vircgroup.c | 311 ++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 306 insertions(+), 5 deletions(-)

diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c
index e5625f8..2e7cbfa 100644
--- a/src/util/vircgroup.c
+++ b/src/util/vircgroup.c
@@ -2981,6 +2981,42 @@ int virCgroupPathOfController(virCgroupPtr group ATTRIBUTE_UNUSED,
 }
 
 
+int virCgroupRemove(virCgroupPtr group ATTRIBUTE_UNUSED)
+{
+    virReportSystemError(ENXIO, "%s",
+                         _("Control groups not supported on this platform"));
+    return -1;
+}
+
+
+int virCgroupAddTask(virCgroupPtr group ATTRIBUTE_UNUSED,
+                     pid_t pid ATTRIBUTE_UNUSED)
+{
+    virReportSystemError(ENXIO, "%s",
+                         _("Control groups not supported on this platform"));
+    return -1;
+}
+
+
+int virCgroupAddTaskController(virCgroupPtr group ATTRIBUTE_UNUSED,
+                               pid_t pid ATTRIBUTE_UNUSED,
+                               int controller ATTRIBUTE_UNUSED)
+{
+    virReportSystemError(ENXIO, "%s",
+                         _("Control groups not supported on this platform"));
+    return -1;
+}
+
+
+int virCgroupMoveTask(virCgroupPtr src_group ATTRIBUTE_UNUSED,
+                      virCgroupPtr dest_group ATTRIBUTE_UNUSED)
+{
+    virReportSystemError(ENXIO, "%s",
+                         _("Control groups not supported on this platform"));
+    return -1;
+}
+
+
 int virCgroupNewPartition(const char *path ATTRIBUTE_UNUSED,
                           bool create ATTRIBUTE_UNUSED,
                           int controllers ATTRIBUTE_UNUSED,
@@ -3032,6 +3068,7 @@ int virCgroupNewEmulator(virCgroupPtr domain ATTRIBUTE_UNUSED,
     return -1;
 }
 
+
 int virCgroupNewDetect(pid_t pid ATTRIBUTE_UNUSED,
                        int controllers ATTRIBUTE_UNUSED,
                        virCgroupPtr *group ATTRIBUTE_UNUSED)
@@ -3042,6 +3079,49 @@ int virCgroupNewDetect(pid_t pid ATTRIBUTE_UNUSED,
 }
 
 
+int virCgroupNewMachine(const char *name ATTRIBUTE_UNUSED,
+                        const char *drivername ATTRIBUTE_UNUSED,
+                        bool privileged ATTRIBUTE_UNUSED,
+                        const unsigned char *uuid ATTRIBUTE_UNUSED,
+                        const char *rootdir ATTRIBUTE_UNUSED,
+                        pid_t pidleader ATTRIBUTE_UNUSED,
+                        bool isContainer ATTRIBUTE_UNUSED,
+                        const char *partition ATTRIBUTE_UNUSED,
+                        int controllers ATTRIBUTE_UNUSED,
+                        virCgroupPtr *group ATTRIBUTE_UNUSED)
+{
+    virReportSystemError(ENXIO, "%s",
+                         _("Control groups not supported on this platform"));
+    return -1;
+}
+
+
+bool virCgroupNewIgnoreError(void)
+{
+    virReportSystemError(ENXIO, "%s",
+                         _("Control groups not supported on this platform"));
+    return false;
+}
+
+
+int virCgroupSetBlkioWeight(virCgroupPtr group ATTRIBUTE_UNUSED,
+                            unsigned int weight ATTRIBUTE_UNUSED)
+{
+    virReportSystemError(ENXIO, "%s",
+                         _("Control groups not supported on this platform"));
+    return -1;
+}
+
+
+int virCgroupGetBlkioWeight(virCgroupPtr group ATTRIBUTE_UNUSED,
+                            unsigned int *weight ATTRIBUTE_UNUSED)
+{
+    virReportSystemError(ENXIO, "%s",
+                         _("Control groups not supported on this platform"));
+    return -1;
+}
+
+
 int
 virCgroupSetBlkioDeviceWeight(virCgroupPtr group ATTRIBUTE_UNUSED,
                               const char *path ATTRIBUTE_UNUSED,
@@ -3053,6 +3133,154 @@ virCgroupSetBlkioDeviceWeight(virCgroupPtr group ATTRIBUTE_UNUSED,
 }
 
 
+int virCgroupSetMemory(virCgroupPtr group ATTRIBUTE_UNUSED,
+                       unsigned long long kb ATTRIBUTE_UNUSED)
+{
+    virReportSystemError(ENOSYS, "%s",
+                         _("Control groups not supported on this platform"));
+    return -1;
+}
+
+
+int virCgroupGetMemoryUsage(virCgroupPtr group ATTRIBUTE_UNUSED,
+                            unsigned long *kb ATTRIBUTE_UNUSED)
+{
+    virReportSystemError(ENOSYS, "%s",
+                         _("Control groups not supported on this platform"));
+    return -1;
+}
+
+
+int virCgroupSetMemoryHardLimit(virCgroupPtr group ATTRIBUTE_UNUSED,
+                                unsigned long long kb ATTRIBUTE_UNUSED)
+{
+    virReportSystemError(ENOSYS, "%s",
+                         _("Control groups not supported on this platform"));
+    return -1;
+}
+
+
+int virCgroupGetMemoryHardLimit(virCgroupPtr group ATTRIBUTE_UNUSED,
+                                unsigned long long *kb ATTRIBUTE_UNUSED)
+{
+    virReportSystemError(ENOSYS, "%s",
+                         _("Control groups not supported on this platform"));
+    return -1;
+}
+
+
+int virCgroupSetMemorySoftLimit(virCgroupPtr group ATTRIBUTE_UNUSED,
+                                unsigned long long kb ATTRIBUTE_UNUSED)
+{
+    virReportSystemError(ENOSYS, "%s",
+                         _("Control groups not supported on this platform"));
+    return -1;
+}
+
+
+int virCgroupGetMemorySoftLimit(virCgroupPtr group ATTRIBUTE_UNUSED,
+                                unsigned long long *kb ATTRIBUTE_UNUSED)
+{
+    virReportSystemError(ENOSYS, "%s",
+                         _("Control groups not supported on this platform"));
+    return -1;
+}
+
+
+int virCgroupSetMemSwapHardLimit(virCgroupPtr group ATTRIBUTE_UNUSED,
+                                 unsigned long long kb ATTRIBUTE_UNUSED)
+{
+    virReportSystemError(ENOSYS, "%s",
+                         _("Control groups not supported on this platform"));
+    return -1;
+}
+
+
+int virCgroupGetMemSwapHardLimit(virCgroupPtr group ATTRIBUTE_UNUSED,
+                                 unsigned long long *kb ATTRIBUTE_UNUSED)
+{
+    virReportSystemError(ENOSYS, "%s",
+                         _("Control groups not supported on this platform"));
+    return -1;
+}
+
+
+int virCgroupGetMemSwapUsage(virCgroupPtr group ATTRIBUTE_UNUSED,
+                             unsigned long long *kb ATTRIBUTE_UNUSED)
+{
+    virReportSystemError(ENOSYS, "%s",
+                         _("Control groups not supported on this platform"));
+    return -1;
+}
+
+
+int virCgroupSetCpusetMems(virCgroupPtr group ATTRIBUTE_UNUSED,
+                           const char *mems ATTRIBUTE_UNUSED)
+{
+    virReportSystemError(ENOSYS, "%s",
+                         _("Control groups not supported on this platform"));
+    return -1;
+}
+
+
+int virCgroupGetCpusetMems(virCgroupPtr group ATTRIBUTE_UNUSED,
+                           char **mems ATTRIBUTE_UNUSED)
+{
+    virReportSystemError(ENOSYS, "%s",
+                         _("Control groups not supported on this platform"));
+    return -1;
+}
+
+
+int virCgroupSetCpusetCpus(virCgroupPtr group ATTRIBUTE_UNUSED,
+                           const char *cpus ATTRIBUTE_UNUSED)
+{
+    virReportSystemError(ENOSYS, "%s",
+                         _("Control groups not supported on this platform"));
+    return -1;
+}
+
+
+int virCgroupGetCpusetCpus(virCgroupPtr group ATTRIBUTE_UNUSED,
+                           char **cpus ATTRIBUTE_UNUSED)
+{
+    virReportSystemError(ENOSYS, "%s",
+                         _("Control groups not supported on this platform"));
+    return -1;
+}
+
+
+int virCgroupDenyAllDevices(virCgroupPtr group ATTRIBUTE_UNUSED)
+{
+    virReportSystemError(ENOSYS, "%s",
+                         _("Control groups not supported on this platform"));
+    return -1;
+}
+
+
+int virCgroupAllowDevice(virCgroupPtr group ATTRIBUTE_UNUSED,
+                         char type ATTRIBUTE_UNUSED,
+                         int major ATTRIBUTE_UNUSED,
+                         int minor ATTRIBUTE_UNUSED,
+                         int perms ATTRIBUTE_UNUSED)
+{
+    virReportSystemError(ENOSYS, "%s",
+                         _("Control groups not supported on this platform"));
+    return -1;
+}
+
+
+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 perms ATTRIBUTE_UNUSED)
@@ -3063,6 +3291,29 @@ int virCgroupAllowDevicePath(virCgroupPtr group ATTRIBUTE_UNUSED,
 }
 
 
+int virCgroupDenyDevice(virCgroupPtr group ATTRIBUTE_UNUSED,
+                        char type ATTRIBUTE_UNUSED,
+                        int major ATTRIBUTE_UNUSED,
+                        int minor ATTRIBUTE_UNUSED,
+                        int perms ATTRIBUTE_UNUSED)
+{
+    virReportSystemError(ENOSYS, "%s",
+                         _("Control groups not supported on this platform"));
+    return -1;
+}
+
+
+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,
                             int perms ATTRIBUTE_UNUSED)
@@ -3073,6 +3324,51 @@ int virCgroupDenyDevicePath(virCgroupPtr group ATTRIBUTE_UNUSED,
 }
 
 
+int virCgroupSetCpuShares(virCgroupPtr group ATTRIBUTE_UNUSED,
+                          unsigned long long shares ATTRIBUTE_UNUSED)
+{
+    virReportSystemError(ENOSYS, "%s",
+                         _("Control groups not supported on this platform"));
+    return -1;
+}
+
+
+int virCgroupGetCpuShares(virCgroupPtr group ATTRIBUTE_UNUSED,
+                          unsigned long long *shares ATTRIBUTE_UNUSED)
+{
+    virReportSystemError(ENOSYS, "%s",
+                         _("Control groups not supported on this platform"));
+    return -1;
+}
+
+
+int virCgroupSetCpuCfsPeriod(virCgroupPtr group ATTRIBUTE_UNUSED,
+                             unsigned long long cfs_period ATTRIBUTE_UNUSED)
+{
+    virReportSystemError(ENOSYS, "%s",
+                         _("Control groups not supported on this platform"));
+    return -1;
+}
+
+
+int virCgroupGetCpuCfsPeriod(virCgroupPtr group ATTRIBUTE_UNUSED,
+                             unsigned long long *cfs_period ATTRIBUTE_UNUSED)
+{
+    virReportSystemError(ENOSYS, "%s",
+                         _("Control groups not supported on this platform"));
+    return -1;
+}
+
+
+int virCgroupSetCpuCfsQuota(virCgroupPtr group ATTRIBUTE_UNUSED,
+                            long long cfs_quota ATTRIBUTE_UNUSED)
+{
+    virReportSystemError(ENOSYS, "%s",
+                         _("Control groups not supported on this platform"));
+    return -1;
+}
+
+
 void virCgroupFree(virCgroupPtr *group ATTRIBUTE_UNUSED)
 {
     virReportSystemError(ENXIO, "%s",
@@ -3123,7 +3419,8 @@ int virCgroupKillPainfully(virCgroupPtr group ATTRIBUTE_UNUSED)
 }
 
 
-int virCgroupGetCpuCfsQuota(virCgroupPtr group, long long *cfs_quota)
+int virCgroupGetCpuCfsQuota(virCgroupPtr group ATTRIBUTE_UNUSED,
+                            long long *cfs_quota ATTRIBUTE_UNUSED)
 {
     virReportSystemError(ENOSYS, "%s",
                          _("Control groups not supported on this platform"));
@@ -3131,7 +3428,8 @@ int virCgroupGetCpuCfsQuota(virCgroupPtr group, long long *cfs_quota)
 }
 
 
-int virCgroupGetCpuacctUsage(virCgroupPtr group, unsigned long long *usage)
+int virCgroupGetCpuacctUsage(virCgroupPtr group ATTRIBUTE_UNUSED,
+                             unsigned long long *usage ATTRIBUTE_UNUSED)
 {
     virReportSystemError(ENOSYS, "%s",
                          _("Control groups not supported on this platform"));
@@ -3139,7 +3437,8 @@ int virCgroupGetCpuacctUsage(virCgroupPtr group, unsigned long long *usage)
 }
 
 
-int virCgroupGetCpuacctPercpuUsage(virCgroupPtr group, char **usage)
+int virCgroupGetCpuacctPercpuUsage(virCgroupPtr group ATTRIBUTE_UNUSED,
+                                   char **usage ATTRIBUTE_UNUSED)
 {
     virReportSystemError(ENOSYS, "%s",
                          _("Control groups not supported on this platform"));
@@ -3157,14 +3456,16 @@ int virCgroupGetCpuacctStat(virCgroupPtr group ATTRIBUTE_UNUSED,
 }
 
 
-int virCgroupSetFreezerState(virCgroupPtr group, const char *state)
+int virCgroupSetFreezerState(virCgroupPtr group ATTRIBUTE_UNUSED,
+                             const char *state ATTRIBUTE_UNUSED)
 {
     virReportSystemError(ENOSYS, "%s",
                          _("Control groups not supported on this platform"));
     return -1;
 }
 
-int virCgroupGetFreezerState(virCgroupPtr group, char **state)
+int virCgroupGetFreezerState(virCgroupPtr group ATTRIBUTE_UNUSED,
+                             char **state ATTRIBUTE_UNUSED)
 {
     virReportSystemError(ENOSYS, "%s",
                          _("Control groups not supported on this platform"));
-- 
1.8.2.3




More information about the libvir-list mailing list