mirror of
https://github.com/systemd/systemd.git
synced 2025-03-10 16:58:28 +03:00
dissect-image: use loop backing file or device node as name of the image
Note, currently, for each call of dissect_loop_device_and_warn(), the specified name is equivalent to the path passed to loop_device_make_by_path(). Hence, this should not change the current behavios.
This commit is contained in:
parent
55a065cd30
commit
64dd3a245f
@ -946,7 +946,6 @@ static int run(int argc, char *argv[]) {
|
||||
return log_error_errno(r, "Failed to set up loopback device for %s: %m", arg_image);
|
||||
|
||||
r = dissect_loop_device_and_warn(
|
||||
arg_image,
|
||||
d,
|
||||
&arg_verity_settings,
|
||||
NULL,
|
||||
|
@ -5754,7 +5754,6 @@ static int run(int argc, char *argv[]) {
|
||||
}
|
||||
|
||||
r = dissect_loop_device_and_warn(
|
||||
arg_image,
|
||||
loop,
|
||||
&arg_verity_settings,
|
||||
NULL,
|
||||
|
@ -2806,20 +2806,19 @@ finish:
|
||||
}
|
||||
|
||||
int dissect_loop_device_and_warn(
|
||||
const char *name,
|
||||
const LoopDevice *loop,
|
||||
const VeritySettings *verity,
|
||||
const MountOptions *mount_options,
|
||||
DissectImageFlags flags,
|
||||
DissectedImage **ret) {
|
||||
|
||||
const char *name;
|
||||
int r;
|
||||
|
||||
assert(loop);
|
||||
assert(loop->fd >= 0);
|
||||
|
||||
if (!name)
|
||||
name = ASSERT_PTR(loop->node);
|
||||
name = ASSERT_PTR(loop->backing_file ?: loop->node);
|
||||
|
||||
r = dissect_loop_device(loop, verity, mount_options, flags, ret);
|
||||
switch (r) {
|
||||
@ -2974,7 +2973,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_loop_device_and_warn(image, d, &verity, NULL, flags, &dissected_image);
|
||||
r = dissect_loop_device_and_warn(d, &verity, NULL, flags, &dissected_image);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
|
@ -265,9 +265,9 @@ int dissect_image(
|
||||
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, verity, mount_options, loop->diskseq, loop->uevent_seqnum_not_before, loop->timestamp_not_before, flags, ret);
|
||||
return dissect_image(loop->fd, loop->backing_file ?: loop->node, verity, mount_options, loop->diskseq, loop->uevent_seqnum_not_before, loop->timestamp_not_before, flags, ret);
|
||||
}
|
||||
int dissect_loop_device_and_warn(const char *name, const LoopDevice *loop, const VeritySettings *verity, const MountOptions *mount_options, DissectImageFlags flags, DissectedImage **ret);
|
||||
int dissect_loop_device_and_warn(const LoopDevice *loop, const VeritySettings *verity, const MountOptions *mount_options, DissectImageFlags flags, DissectedImage **ret);
|
||||
|
||||
DissectedImage* dissected_image_unref(DissectedImage *m);
|
||||
DEFINE_TRIVIAL_CLEANUP_FUNC(DissectedImage*, dissected_image_unref);
|
||||
|
@ -540,7 +540,6 @@ static int merge_subprocess(Hashmap *images, const char *workspace) {
|
||||
return log_error_errno(r, "Failed to set up loopback device for %s: %m", img->path);
|
||||
|
||||
r = dissect_loop_device_and_warn(
|
||||
img->path,
|
||||
d,
|
||||
&verity_settings,
|
||||
NULL,
|
||||
|
Loading…
x
Reference in New Issue
Block a user