From: Lennart Poettering Date: Tue, 28 Jul 2020 21:49:35 +0000 (+0200) Subject: dissect: show more information in output X-Git-Tag: v247-rc1~431^2~13 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=16b7459280e193e39ade76696a1194a298ab575d;p=thirdparty%2Fsystemd.git dissect: show more information in output Let's show size and image filename. --- diff --git a/src/dissect/dissect.c b/src/dissect/dissect.c index 0ccb603b5d3..f1f323b1317 100644 --- a/src/dissect/dissect.c +++ b/src/dissect/dissect.c @@ -4,11 +4,14 @@ #include #include #include +#include +#include #include "architecture.h" #include "copy.h" #include "dissect-image.h" #include "fd-util.h" +#include "format-util.h" #include "fs-util.h" #include "hexdecoct.h" #include "log.h" @@ -342,6 +345,7 @@ static int run(int argc, char *argv[]) { switch (arg_action) { case ACTION_DISSECT: { + uint64_t size; unsigned i; for (i = 0; i < _PARTITION_DESIGNATOR_MAX; i++) { @@ -375,6 +379,15 @@ static int run(int argc, char *argv[]) { putchar('\n'); } + printf(" Name: %s\n", basename(arg_image)); + + if (ioctl(d->fd, BLKGETSIZE64, &size) < 0) + log_debug_errno(errno, "Failed to query size of loopback device: %m"); + else { + char t[FORMAT_BYTES_MAX]; + printf(" Size: %s\n", format_bytes(t, sizeof(t), size)); + } + r = dissected_image_acquire_metadata(m); if (r < 0) return log_error_errno(r, "Failed to acquire image metadata: %m");