]>
git.ipfire.org Git - thirdparty/systemd.git/blob - src/shared/machine-pool.c
1 /* SPDX-License-Identifier: LGPL-2.1+ */
4 #include <sys/statfs.h>
6 #include "btrfs-util.h"
8 #include "machine-pool.h"
10 #include "stat-util.h"
12 static int check_btrfs(void) {
15 if (statfs("/var/lib/machines", &sfs
) < 0) {
19 if (statfs("/var/lib", &sfs
) < 0)
23 return F_TYPE_EQUAL(sfs
.f_type
, BTRFS_SUPER_MAGIC
);
26 int setup_machine_directory(sd_bus_error
*error
) {
31 return sd_bus_error_set_errnof(error
, r
, "Failed to determine whether /var/lib/machines is located on btrfs: %m");
35 (void) btrfs_subvol_make_label("/var/lib/machines");
37 r
= btrfs_quota_enable("/var/lib/machines", true);
39 log_warning_errno(r
, "Failed to enable quota for /var/lib/machines, ignoring: %m");
41 r
= btrfs_subvol_auto_qgroup("/var/lib/machines", 0, true);
43 log_warning_errno(r
, "Failed to set up default quota hierarchy for /var/lib/machines, ignoring: %m");