]>
git.ipfire.org Git - thirdparty/systemd.git/blob - src/shared/machine-pool.c
1 /* SPDX-License-Identifier: LGPL-2.1+ */
5 #include "btrfs-util.h"
7 #include "machine-pool.h"
8 #include "missing_magic.h"
11 static int check_btrfs(void) {
14 if (statfs("/var/lib/machines", &sfs
) < 0) {
18 if (statfs("/var/lib", &sfs
) < 0)
22 return F_TYPE_EQUAL(sfs
.f_type
, BTRFS_SUPER_MAGIC
);
25 int setup_machine_directory(sd_bus_error
*error
) {
30 return sd_bus_error_set_errnof(error
, r
, "Failed to determine whether /var/lib/machines is located on btrfs: %m");
34 (void) btrfs_subvol_make_label("/var/lib/machines");
36 r
= btrfs_quota_enable("/var/lib/machines", true);
38 log_warning_errno(r
, "Failed to enable quota for /var/lib/machines, ignoring: %m");
40 r
= btrfs_subvol_auto_qgroup("/var/lib/machines", 0, true);
42 log_warning_errno(r
, "Failed to set up default quota hierarchy for /var/lib/machines, ignoring: %m");