[libvirt PATCH 19/25] vircgroup: drop @pid argument from virCgroupNew

Pavel Hrdina phrdina at redhat.com
Tue Nov 3 12:41:31 UTC 2020


Now it is always -1.

Signed-off-by: Pavel Hrdina <phrdina at redhat.com>
---
 src/util/vircgroup.c     | 16 +++++++---------
 src/util/vircgrouppriv.h |  3 +--
 src/util/vircgroupv1.c   |  2 +-
 3 files changed, 9 insertions(+), 12 deletions(-)

diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c
index 2c1d6f9f01..6a34eb4037 100644
--- a/src/util/vircgroup.c
+++ b/src/util/vircgroup.c
@@ -671,15 +671,14 @@ virCgroupMakeGroup(virCgroupPtr parent,
  * Returns 0 on success, -1 on error
  */
 int
-virCgroupNew(pid_t pid,
-             const char *path,
+virCgroupNew(const char *path,
              int controllers,
              virCgroupPtr *group)
 {
     g_autoptr(virCgroup) newGroup = NULL;
 
-    VIR_DEBUG("pid=%lld path=%s controllers=%d group=%p",
-              (long long) pid, path, controllers, group);
+    VIR_DEBUG("path=%s controllers=%d group=%p",
+              path, controllers, group);
 
     *group = NULL;
     newGroup = g_new0(virCgroup, 1);
@@ -694,11 +693,11 @@ virCgroupNew(pid_t pid,
         return -1;
 
     /* ... but use /proc/cgroups to fill in the rest */
-    if (virCgroupDetectPlacement(newGroup, pid, path) < 0)
+    if (virCgroupDetectPlacement(newGroup, -1, path) < 0)
         return -1;
 
     /* Check that for every mounted controller, we found our placement */
-    if (virCgroupValidatePlacement(newGroup, pid) < 0)
+    if (virCgroupValidatePlacement(newGroup, -1) < 0)
         return -1;
 
     if (virCgroupDetectControllers(newGroup, controllers, NULL) < 0)
@@ -905,7 +904,7 @@ virCgroupNewPartition(const char *path,
         tmp++;
         *tmp = '\0';
 
-        if (virCgroupNew(-1, parentPath, controllers, &parent) < 0)
+        if (virCgroupNew(parentPath, controllers, &parent) < 0)
             return -1;
     }
 
@@ -1118,8 +1117,7 @@ virCgroupEnableMissingControllers(char *path,
     g_autoptr(virCgroup) parent = NULL;
     char *offset = path;
 
-    if (virCgroupNew(-1,
-                     "/",
+    if (virCgroupNew("/",
                      controllers,
                      &parent) < 0)
         return -1;
diff --git a/src/util/vircgrouppriv.h b/src/util/vircgrouppriv.h
index 0ac62882a5..7248bc1d35 100644
--- a/src/util/vircgrouppriv.h
+++ b/src/util/vircgrouppriv.h
@@ -110,8 +110,7 @@ int virCgroupGetValueForBlkDev(const char *str,
                                const char *devPath,
                                char **value);
 
-int virCgroupNew(pid_t pid,
-                 const char *path,
+int virCgroupNew(const char *path,
                  int controllers,
                  virCgroupPtr *group);
 
diff --git a/src/util/vircgroupv1.c b/src/util/vircgroupv1.c
index b3e0f733b9..98b5aa047d 100644
--- a/src/util/vircgroupv1.c
+++ b/src/util/vircgroupv1.c
@@ -1468,7 +1468,7 @@ virCgroupV1MemoryOnceInit(void)
     g_autoptr(virCgroup) group = NULL;
     unsigned long long int mem_unlimited = 0ULL;
 
-    if (virCgroupNew(-1, "/", -1, &group) < 0)
+    if (virCgroupNew("/", -1, &group) < 0)
         return;
 
     if (!virCgroupV1HasController(group, VIR_CGROUP_CONTROLLER_MEMORY))
-- 
2.26.2




More information about the libvir-list mailing list