diff options
Diffstat (limited to 'src/shared/dissect-image.c')
-rw-r--r-- | src/shared/dissect-image.c | 36 |
1 files changed, 12 insertions, 24 deletions
diff --git a/src/shared/dissect-image.c b/src/shared/dissect-image.c index 6b3a18c011..ba0bdbbfb6 100644 --- a/src/shared/dissect-image.c +++ b/src/shared/dissect-image.c @@ -2796,29 +2796,23 @@ finish: return r; } -int dissect_image_and_warn( - int fd, +int dissect_loop_device_and_warn( const char *name, + const LoopDevice *loop, const VeritySettings *verity, const MountOptions *mount_options, - uint64_t diskseq, - uint64_t uevent_seqnum_not_before, - usec_t timestamp_not_before, DissectImageFlags flags, DissectedImage **ret) { - _cleanup_free_ char *buffer = NULL; int r; - if (!name) { - r = fd_get_path(fd, &buffer); - if (r < 0) - return r; + assert(loop); + assert(loop->fd >= 0); - name = buffer; - } + if (!name) + name = ASSERT_PTR(loop->node); - r = dissect_image(fd, verity, mount_options, diskseq, uevent_seqnum_not_before, timestamp_not_before, flags, ret); + r = dissect_loop_device(loop, verity, mount_options, flags, ret); switch (r) { case -EOPNOTSUPP: @@ -2971,7 +2965,7 @@ int mount_image_privately_interactively( if (r < 0) return log_error_errno(r, "Failed to set up loopback device for %s: %m", image); - r = dissect_image_and_warn(d->fd, image, &verity, NULL, d->diskseq, d->uevent_seqnum_not_before, d->timestamp_not_before, flags, &dissected_image); + r = dissect_loop_device_and_warn(image, d, &verity, NULL, flags, &dissected_image); if (r < 0) return r; @@ -3082,24 +3076,18 @@ int verity_dissect_and_mount( if (r < 0) return log_debug_errno(r, "Failed to create loop device for image: %m"); - r = dissect_image( - loop_device->fd, + r = dissect_loop_device( + loop_device, &verity, options, - loop_device->diskseq, - loop_device->uevent_seqnum_not_before, - loop_device->timestamp_not_before, dissect_image_flags, &dissected_image); /* No partition table? Might be a single-filesystem image, try again */ if (!verity.data_path && r == -ENOPKG) - r = dissect_image( - loop_device->fd, + r = dissect_loop_device( + loop_device, &verity, options, - loop_device->diskseq, - loop_device->uevent_seqnum_not_before, - loop_device->timestamp_not_before, dissect_image_flags | DISSECT_IMAGE_NO_PARTITION_TABLE, &dissected_image); if (r < 0) |