tree-wide: port various parts of the code over to the new device_major_minor_path() calls

This commit is contained in:
Lennart Poettering
2018-11-29 20:21:39 +01:00
parent 846b3bd61e
commit 54b22b2643
4 changed files with 71 additions and 51 deletions
+5 -3
View File
@@ -405,7 +405,7 @@ static int verify_esp(
sd_id128_t *ret_uuid) {
#if HAVE_BLKID
_cleanup_(blkid_free_probep) blkid_probe b = NULL;
char t[DEV_NUM_PATH_MAX];
_cleanup_free_ char *node = NULL;
const char *v;
#endif
uint64_t pstart = 0, psize = 0;
@@ -469,9 +469,11 @@ static int verify_esp(
goto finish;
#if HAVE_BLKID
xsprintf_dev_num_path(t, "block", st.st_dev);
r = device_path_make_major_minor(S_IFBLK, st.st_dev, &node);
if (r < 0)
return log_error_errno(r, "Failed to format major/minor device path: %m");
errno = 0;
b = blkid_new_probe_from_filename(t);
b = blkid_new_probe_from_filename(node);
if (!b)
return log_error_errno(errno ?: ENOMEM, "Failed to open file system \"%s\": %m", p);
+3 -2
View File
@@ -219,8 +219,9 @@ int dissect_image(
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,