***/
#include <sys/prctl.h>
-#include <sys/vfs.h>
#include "sd-bus.h"
#include "util.h"
#include "mkdir.h"
#include "def.h"
#include "missing.h"
+#include "machine-pool.h"
+#include "path-util.h"
#include "import-util.h"
typedef struct Transfer Transfer;
return NULL;
}
-static int check_btrfs(sd_bus_error *error) {
- struct statfs sfs;
-
- if (statfs("/var/lib/machines", &sfs) < 0) {
- if (errno != ENOENT)
- return -errno;
-
- if (statfs("/var/lib", &sfs) < 0)
- return -errno;
- }
-
- if (!F_TYPE_EQUAL(sfs.f_type, BTRFS_SUPER_MAGIC))
- return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "/var/lib/machines is not a btrfs file system. Operation is not supported on legacy file systems.");
-
- return 0;
-}
-
static int method_pull_tar_or_raw(sd_bus *bus, sd_bus_message *msg, void *userdata, sd_bus_error *error) {
_cleanup_(transfer_unrefp) Transfer *t = NULL;
const char *remote, *local, *verify, *object;
if (v < 0)
return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Unknown verification mode %s", verify);
- r = check_btrfs(error);
+ r = setup_machine_directory((uint64_t) -1, error);
if (r < 0)
return r;
if (v != IMPORT_VERIFY_NO)
return sd_bus_error_setf(error, SD_BUS_ERROR_NOT_SUPPORTED, "DKR does not support verification.");
- r = check_btrfs(error);
+ r = setup_machine_directory((uint64_t) -1, error);
if (r < 0)
return r;