]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
dissect-tool: hide device column if it's a short-lived loopback device 30467/head
authorLennart Poettering <lennart@poettering.net>
Mon, 4 Dec 2023 17:27:19 +0000 (18:27 +0100)
committerLennart Poettering <lennart@poettering.net>
Wed, 13 Dec 2023 16:41:18 +0000 (17:41 +0100)
It's pointless showing info that isn#t going to survive the current
invocation, hence hide it.

The "partition number" column is more useful since it kinda shows the
same information, but without the device node name prefixed that is
local to the currentl invocation.

src/dissect/dissect.c

index aea3d6234ec3c5f0539c67f2833eeead6c394ac2..f9f47cf7aacf670070486d6642d31d83f7863512 100644 (file)
@@ -961,6 +961,11 @@ static int action_dissect(DissectedImage *m, LoopDevice *d) {
         table_set_ersatz_string(t, TABLE_ERSATZ_DASH);
         (void) table_set_align_percent(t, table_get_cell(t, 0, 9), 100);
 
+        /* Hide the device path if this is a loopback device that is not relinquished, since that means the
+         * device node is not going to be useful the instant our command exits */
+        if ((!d || d->created) && (arg_json_format_flags & JSON_FORMAT_OFF))
+                table_hide_column_from_display(t, 8);
+
         for (PartitionDesignator i = 0; i < _PARTITION_DESIGNATOR_MAX; i++) {
                 DissectedPartition *p = m->partitions + i;