mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-22 11:22:23 +00:00
vircgroup: drop condition for absolute path from copyPlacement callbacks
Now that every caller to copyPlacement doesn't pass absolute path there is no need to have a condition to handle that case. Signed-off-by: Pavel Hrdina <phrdina@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
6f0aa96f41
commit
457877eae4
@ -190,26 +190,24 @@ virCgroupV1CopyPlacement(virCgroupPtr group,
|
||||
{
|
||||
size_t i;
|
||||
for (i = 0; i < VIR_CGROUP_CONTROLLER_LAST; i++) {
|
||||
bool delim;
|
||||
|
||||
if (!group->legacy[i].mountPoint)
|
||||
continue;
|
||||
|
||||
if (i == VIR_CGROUP_CONTROLLER_SYSTEMD)
|
||||
continue;
|
||||
|
||||
if (path[0] == '/') {
|
||||
group->legacy[i].placement = g_strdup(path);
|
||||
} else {
|
||||
bool delim = STREQ(parent->legacy[i].placement, "/") || STREQ(path, "");
|
||||
/*
|
||||
* parent == "/" + path="" => "/"
|
||||
* parent == "/libvirt.service" + path == "" => "/libvirt.service"
|
||||
* parent == "/libvirt.service" + path == "foo" => "/libvirt.service/foo"
|
||||
*/
|
||||
group->legacy[i].placement = g_strdup_printf("%s%s%s",
|
||||
parent->legacy[i].placement,
|
||||
delim ? "" : "/",
|
||||
path);
|
||||
}
|
||||
delim = STREQ(parent->legacy[i].placement, "/") || STREQ(path, "");
|
||||
/*
|
||||
* parent == "/" + path="" => "/"
|
||||
* parent == "/libvirt.service" + path == "" => "/libvirt.service"
|
||||
* parent == "/libvirt.service" + path == "foo" => "/libvirt.service/foo"
|
||||
*/
|
||||
group->legacy[i].placement = g_strdup_printf("%s%s%s",
|
||||
parent->legacy[i].placement,
|
||||
delim ? "" : "/",
|
||||
path);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -149,22 +149,19 @@ virCgroupV2CopyPlacement(virCgroupPtr group,
|
||||
const char *path,
|
||||
virCgroupPtr parent)
|
||||
{
|
||||
bool delim = STREQ(parent->unified.placement, "/") || STREQ(path, "");
|
||||
|
||||
VIR_DEBUG("group=%p path=%s parent=%p", group, path, parent);
|
||||
|
||||
if (path[0] == '/') {
|
||||
group->unified.placement = g_strdup(path);
|
||||
} else {
|
||||
bool delim = STREQ(parent->unified.placement, "/") || STREQ(path, "");
|
||||
/*
|
||||
* parent == "/" + path="" => "/"
|
||||
* parent == "/libvirt.service" + path == "" => "/libvirt.service"
|
||||
* parent == "/libvirt.service" + path == "foo" => "/libvirt.service/foo"
|
||||
*/
|
||||
group->unified.placement = g_strdup_printf("%s%s%s",
|
||||
parent->unified.placement,
|
||||
delim ? "" : "/",
|
||||
path);
|
||||
}
|
||||
/*
|
||||
* parent == "/" + path="" => "/"
|
||||
* parent == "/libvirt.service" + path == "" => "/libvirt.service"
|
||||
* parent == "/libvirt.service" + path == "foo" => "/libvirt.service/foo"
|
||||
*/
|
||||
group->unified.placement = g_strdup_printf("%s%s%s",
|
||||
parent->unified.placement,
|
||||
delim ? "" : "/",
|
||||
path);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user