mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-27 19:11:16 +00:00
vircgroup: drop @parent from virCgroupNew
Now it is always NULL. Signed-off-by: Pavel Hrdina <phrdina@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
bcfa563707
commit
2eb83e270d
@ -446,28 +446,19 @@ static int
|
|||||||
virCgroupDetect(virCgroupPtr group,
|
virCgroupDetect(virCgroupPtr group,
|
||||||
pid_t pid,
|
pid_t pid,
|
||||||
int controllers,
|
int controllers,
|
||||||
const char *path,
|
const char *path)
|
||||||
virCgroupPtr parent)
|
|
||||||
{
|
{
|
||||||
VIR_DEBUG("group=%p controllers=%d path=%s parent=%p",
|
VIR_DEBUG("group=%p controllers=%d path=%s",
|
||||||
group, controllers, path, parent);
|
group, controllers, path);
|
||||||
|
|
||||||
if (virCgroupSetBackends(group) < 0)
|
if (virCgroupSetBackends(group) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (parent) {
|
if (virCgroupDetectMounts(group) < 0)
|
||||||
if (virCgroupCopyMounts(group, parent) < 0)
|
return -1;
|
||||||
return -1;
|
|
||||||
} else {
|
|
||||||
if (virCgroupDetectMounts(group) < 0)
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* In some cases we can copy part of the placement info
|
if (path[0] == '/') {
|
||||||
* based on the parent cgroup...
|
if (virCgroupCopyPlacement(group, path, NULL) < 0)
|
||||||
*/
|
|
||||||
if (parent || path[0] == '/') {
|
|
||||||
if (virCgroupCopyPlacement(group, path, parent) < 0)
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -479,7 +470,7 @@ virCgroupDetect(virCgroupPtr group,
|
|||||||
if (virCgroupValidatePlacement(group, pid) < 0)
|
if (virCgroupValidatePlacement(group, pid) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (virCgroupDetectControllers(group, controllers, parent) < 0)
|
if (virCgroupDetectControllers(group, controllers, NULL) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -708,15 +699,12 @@ virCgroupMakeGroup(virCgroupPtr parent,
|
|||||||
/**
|
/**
|
||||||
* virCgroupNew:
|
* virCgroupNew:
|
||||||
* @path: path for the new group
|
* @path: path for the new group
|
||||||
* @parent: parent group, or NULL
|
|
||||||
* @controllers: bitmask of controllers to activate
|
* @controllers: bitmask of controllers to activate
|
||||||
*
|
*
|
||||||
* Create a new cgroup storing it in @group.
|
* Create a new cgroup storing it in @group.
|
||||||
*
|
*
|
||||||
* If @path starts with a '/' it is treated as an
|
* If @path starts with a '/' it is treated as an
|
||||||
* absolute path, and @parent is ignored. Otherwise
|
* absolute path. Otherwise then the placement of the current
|
||||||
* it is treated as being relative to @parent. If
|
|
||||||
* @parent is NULL, then the placement of the current
|
|
||||||
* process is used.
|
* process is used.
|
||||||
*
|
*
|
||||||
* Returns 0 on success, -1 on error
|
* Returns 0 on success, -1 on error
|
||||||
@ -724,19 +712,18 @@ virCgroupMakeGroup(virCgroupPtr parent,
|
|||||||
int
|
int
|
||||||
virCgroupNew(pid_t pid,
|
virCgroupNew(pid_t pid,
|
||||||
const char *path,
|
const char *path,
|
||||||
virCgroupPtr parent,
|
|
||||||
int controllers,
|
int controllers,
|
||||||
virCgroupPtr *group)
|
virCgroupPtr *group)
|
||||||
{
|
{
|
||||||
g_autoptr(virCgroup) newGroup = NULL;
|
g_autoptr(virCgroup) newGroup = NULL;
|
||||||
|
|
||||||
VIR_DEBUG("pid=%lld path=%s parent=%p controllers=%d group=%p",
|
VIR_DEBUG("pid=%lld path=%s controllers=%d group=%p",
|
||||||
(long long) pid, path, parent, controllers, group);
|
(long long) pid, path, controllers, group);
|
||||||
|
|
||||||
*group = NULL;
|
*group = NULL;
|
||||||
newGroup = g_new0(virCgroup, 1);
|
newGroup = g_new0(virCgroup, 1);
|
||||||
|
|
||||||
if (virCgroupDetect(newGroup, pid, controllers, path, parent) < 0)
|
if (virCgroupDetect(newGroup, pid, controllers, path) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
*group = g_steal_pointer(&newGroup);
|
*group = g_steal_pointer(&newGroup);
|
||||||
@ -940,7 +927,7 @@ virCgroupNewPartition(const char *path,
|
|||||||
tmp++;
|
tmp++;
|
||||||
*tmp = '\0';
|
*tmp = '\0';
|
||||||
|
|
||||||
if (virCgroupNew(-1, parentPath, NULL, controllers, &parent) < 0)
|
if (virCgroupNew(-1, parentPath, controllers, &parent) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1156,7 +1143,6 @@ virCgroupEnableMissingControllers(char *path,
|
|||||||
|
|
||||||
if (virCgroupNew(pidleader,
|
if (virCgroupNew(pidleader,
|
||||||
"/",
|
"/",
|
||||||
NULL,
|
|
||||||
controllers,
|
controllers,
|
||||||
&parent) < 0)
|
&parent) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -112,7 +112,6 @@ int virCgroupGetValueForBlkDev(const char *str,
|
|||||||
|
|
||||||
int virCgroupNew(pid_t pid,
|
int virCgroupNew(pid_t pid,
|
||||||
const char *path,
|
const char *path,
|
||||||
virCgroupPtr parent,
|
|
||||||
int controllers,
|
int controllers,
|
||||||
virCgroupPtr *group);
|
virCgroupPtr *group);
|
||||||
|
|
||||||
|
@ -1468,7 +1468,7 @@ virCgroupV1MemoryOnceInit(void)
|
|||||||
g_autoptr(virCgroup) group = NULL;
|
g_autoptr(virCgroup) group = NULL;
|
||||||
unsigned long long int mem_unlimited = 0ULL;
|
unsigned long long int mem_unlimited = 0ULL;
|
||||||
|
|
||||||
if (virCgroupNew(-1, "/", NULL, -1, &group) < 0)
|
if (virCgroupNew(-1, "/", -1, &group) < 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!virCgroupV1HasController(group, VIR_CGROUP_CONTROLLER_MEMORY))
|
if (!virCgroupV1HasController(group, VIR_CGROUP_CONTROLLER_MEMORY))
|
||||||
|
Loading…
Reference in New Issue
Block a user