#include "copy.h"
#include "crypt-util.h"
#include "def.h"
-#include "device-enumerator-private.h"
#include "device-nodes.h"
+#include "device-util.h"
#include "dissect-image.h"
+#include "env-file.h"
#include "fd-util.h"
#include "fileio.h"
#include "fs-util.h"
#include "linux-3.13/dm-ioctl.h"
#include "missing.h"
#include "mount-util.h"
+#include "mountpoint-util.h"
#include "os-util.h"
#include "path-util.h"
#include "process-util.h"
#include "string-table.h"
#include "string-util.h"
#include "strv.h"
+#include "tmpfile-util.h"
#include "user-util.h"
#include "xattr-util.h"
return -ENOMEM;
}
- if (asprintf(&n, "/dev/block/%u:%u", major(st.st_rdev), minor(st.st_rdev)) < 0)
- return -ENOMEM;
+ r = device_path_make_major_minor(st.st_mode, st.st_rdev, &n);
+ if (r < 0)
+ return r;
m->partitions[PARTITION_ROOT] = (DissectedPartition) {
.found = true,
.node = TAKE_PTR(n),
};
- m->encrypted = streq(fstype, "crypto_LUKS");
+ m->encrypted = streq_ptr(fstype, "crypto_LUKS");
*ret = TAKE_PTR(m);
if (r < 0)
return r;
- r = device_enumerator_scan_devices(e);
- if (r < 0)
- return r;
-
/* Count the partitions enumerated by the kernel */
n = 0;
- FOREACH_DEVICE_AND_SUBSYSTEM(e, q) {
- dev_t qn;
-
- if (sd_device_get_devnum(q, &qn) < 0)
+ FOREACH_DEVICE(e, q) {
+ if (sd_device_get_devnum(q, NULL) < 0)
continue;
if (!device_is_block(q))
e = sd_device_enumerator_unref(e);
}
- FOREACH_DEVICE_AND_SUBSYSTEM(e, q) {
+ FOREACH_DEVICE(e, q) {
unsigned long long pflags;
blkid_partition pp;
const char *node;
}
}
- if ((flags & DISSECT_IMAGE_MOUNT_ROOT_ONLY))
+ if (flags & DISSECT_IMAGE_MOUNT_ROOT_ONLY)
return 0;
r = mount_partition(m->partitions + PARTITION_HOME, where, "/home", uid_shift, flags);
else if (r != -ENOKEY)
return log_error_errno(r, "Failed to decrypt image: %m");
- if (--n < 0) {
- log_error("Too many retries.");
- return -EKEYREJECTED;
- }
+ if (--n < 0)
+ return log_error_errno(SYNTHETIC_ERRNO(EKEYREJECTED),
+ "Too many retries.");
z = strv_free(z);
- r = ask_password_auto("Please enter image passphrase!", NULL, "dissect", "dissect", USEC_INFINITY, 0, &z);
+ r = ask_password_auto("Please enter image passphrase:", NULL, "dissect", "dissect", USEC_INFINITY, 0, &z);
if (r < 0)
return log_error_errno(r, "Failed to query for passphrase: %m");
}
case META_MACHINE_INFO:
- r = load_env_file_pairs(f, "machine-info", NULL, &machine_info);
+ r = load_env_file_pairs(f, "machine-info", &machine_info);
if (r < 0)
log_debug_errno(r, "Failed to read /etc/machine-info: %m");
break;
case META_OS_RELEASE:
- r = load_env_file_pairs(f, "os-release", NULL, &os_release);
+ r = load_env_file_pairs(f, "os-release", &os_release);
if (r < 0)
log_debug_errno(r, "Failed to read OS release file: %m");