summaryrefslogtreecommitdiff
path: root/src/machine/machined-dbus.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/machine/machined-dbus.c')
-rw-r--r--src/machine/machined-dbus.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/src/machine/machined-dbus.c b/src/machine/machined-dbus.c
index 0d52c693e4..6e4c72e8a9 100644
--- a/src/machine/machined-dbus.c
+++ b/src/machine/machined-dbus.c
@@ -79,7 +79,7 @@ static int property_get_pool_usage(
if (fd >= 0) {
BtrfsQuotaInfo q;
- if (btrfs_subvol_get_quota_fd(fd, &q) >= 0)
+ if (btrfs_subvol_get_subtree_quota_fd(fd, 0, &q) >= 0)
usage = q.referenced;
}
@@ -115,7 +115,7 @@ static int property_get_pool_limit(
if (fd >= 0) {
BtrfsQuotaInfo q;
- if (btrfs_subvol_get_quota_fd(fd, &q) >= 0)
+ if (btrfs_subvol_get_subtree_quota_fd(fd, 0, &q) >= 0)
size = q.referenced_max;
}
@@ -810,6 +810,7 @@ static int method_set_pool_limit(sd_bus_message *message, void *userdata, sd_bus
message,
CAP_SYS_ADMIN,
"org.freedesktop.machine1.manage-machines",
+ NULL,
false,
UID_INVALID,
&m->polkit_registry,
@@ -830,7 +831,9 @@ static int method_set_pool_limit(sd_bus_message *message, void *userdata, sd_bus
if (r < 0 && r != -ENODEV) /* ignore ENODEV, as that's what is returned if the file system is not on loopback */
return sd_bus_error_set_errnof(error, r, "Failed to adjust loopback limit: %m");
- r = btrfs_quota_limit("/var/lib/machines", limit);
+ (void) btrfs_qgroup_set_limit("/var/lib/machines", 0, limit);
+
+ r = btrfs_subvol_set_subtree_quota_limit("/var/lib/machines", 0, limit);
if (r == -ENOTTY)
return sd_bus_error_setf(error, SD_BUS_ERROR_NOT_SUPPORTED, "Quota is only supported on btrfs.");
if (r < 0)
@@ -875,7 +878,7 @@ static int method_map_from_machine_user(sd_bus_message *message, void *userdata,
if (r < 0)
return r;
- if (UID_IS_INVALID(uid))
+ if (!uid_is_valid(uid))
return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid user ID " UID_FMT, uid);
machine = hashmap_get(m->machines, name);
@@ -909,7 +912,7 @@ static int method_map_from_machine_user(sd_bus_message *message, void *userdata,
continue;
converted = uid - uid_base + uid_shift;
- if (UID_IS_INVALID(converted))
+ if (!uid_is_valid(converted))
return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid user ID " UID_FMT, uid);
return sd_bus_reply_method_return(message, "u", (uint32_t) converted);
@@ -928,7 +931,7 @@ static int method_map_to_machine_user(sd_bus_message *message, void *userdata, s
r = sd_bus_message_read(message, "u", &uid);
if (r < 0)
return r;
- if (UID_IS_INVALID(uid))
+ if (!uid_is_valid(uid))
return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid user ID " UID_FMT, uid);
if (uid < 0x10000)
return sd_bus_error_setf(error, BUS_ERROR_NO_SUCH_USER_MAPPING, "User " UID_FMT " belongs to host UID range", uid);
@@ -967,7 +970,7 @@ static int method_map_to_machine_user(sd_bus_message *message, void *userdata, s
continue;
converted = (uid - uid_shift + uid_base);
- if (UID_IS_INVALID(converted))
+ if (!uid_is_valid(converted))
return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid user ID " UID_FMT, uid);
o = machine_bus_path(machine);
@@ -993,7 +996,7 @@ static int method_map_from_machine_group(sd_bus_message *message, void *groupdat
if (r < 0)
return r;
- if (GID_IS_INVALID(gid))
+ if (!gid_is_valid(gid))
return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid group ID " GID_FMT, gid);
machine = hashmap_get(m->machines, name);
@@ -1027,7 +1030,7 @@ static int method_map_from_machine_group(sd_bus_message *message, void *groupdat
continue;
converted = gid - gid_base + gid_shift;
- if (GID_IS_INVALID(converted))
+ if (!gid_is_valid(converted))
return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid group ID " GID_FMT, gid);
return sd_bus_reply_method_return(message, "u", (uint32_t) converted);
@@ -1046,7 +1049,7 @@ static int method_map_to_machine_group(sd_bus_message *message, void *groupdata,
r = sd_bus_message_read(message, "u", &gid);
if (r < 0)
return r;
- if (GID_IS_INVALID(gid))
+ if (!gid_is_valid(gid))
return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid group ID " GID_FMT, gid);
if (gid < 0x10000)
return sd_bus_error_setf(error, BUS_ERROR_NO_SUCH_GROUP_MAPPING, "Group " GID_FMT " belongs to host GID range", gid);
@@ -1085,7 +1088,7 @@ static int method_map_to_machine_group(sd_bus_message *message, void *groupdata,
continue;
converted = (gid - gid_shift + gid_base);
- if (GID_IS_INVALID(converted))
+ if (!gid_is_valid(converted))
return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid group ID " GID_FMT, gid);
o = machine_bus_path(machine);