int dissect_image(
int fd,
+ const char *devname,
const char *image_path,
const VeritySettings *verity,
const MountOptions *mount_options,
bool is_gpt, is_mbr, multiple_generic = false,
generic_rw = false, /* initialize to appease gcc */
generic_growfs = false;
- _cleanup_(sd_device_unrefp) sd_device *d = NULL;
_cleanup_(dissected_image_unrefp) DissectedImage *m = NULL;
_cleanup_(blkid_free_probep) blkid_probe b = NULL;
_cleanup_free_ char *generic_node = NULL;
sd_id128_t generic_uuid = SD_ID128_NULL;
- const char *pttype = NULL, *devname = NULL;
+ const char *pttype = NULL;
blkid_partlist pl;
int r, generic_nr = -1, n_partitions;
- struct stat st;
assert(fd >= 0);
+ assert(devname);
assert(ret);
assert(!verity || verity->designator < 0 || IN_SET(verity->designator, PARTITION_ROOT, PARTITION_USR));
assert(!verity || verity->root_hash || verity->root_hash_size == 0);
}
}
- if (fstat(fd, &st) < 0)
- return -errno;
-
- if (!S_ISBLK(st.st_mode))
- return -ENOTBLK;
-
- r = sd_device_new_from_stat_rdev(&d, &st);
- if (r < 0)
- return r;
-
b = blkid_new_probe();
if (!b)
return -ENOMEM;
m->image_name = TAKE_PTR(name_stripped);
}
- r = sd_device_get_devname(d, &devname);
- if (r < 0)
- return log_debug_errno(r, "Failed to get device devname: %m");
-
if ((!(flags & DISSECT_IMAGE_GPT_ONLY) &&
(flags & DISSECT_IMAGE_GENERIC_ROOT)) ||
(flags & DISSECT_IMAGE_NO_PARTITION_TABLE)) {
int probe_filesystem(const char *node, char **ret_fstype);
int dissect_image(
int fd,
+ const char *devname,
const char *image_path,
const VeritySettings *verity,
const MountOptions *mount_options,
DissectedImage **ret);
static inline int dissect_loop_device(const LoopDevice *loop, const VeritySettings *verity, const MountOptions *mount_options, DissectImageFlags flags, DissectedImage **ret) {
assert(loop);
- return dissect_image(loop->fd, loop->backing_file ?: loop->node, verity, mount_options, flags, ret);
+ return dissect_image(loop->fd, loop->node, loop->backing_file ?: loop->node, verity, mount_options, flags, ret);
}
int dissect_loop_device_and_warn(const LoopDevice *loop, const VeritySettings *verity, const MountOptions *mount_options, DissectImageFlags flags, DissectedImage **ret);