From: Daan De Meyer Date: Wed, 23 Aug 2023 07:54:38 +0000 (+0200) Subject: repart: Add partno to output X-Git-Tag: v255-rc1~661 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1ffa5cfb38b3d30d269259c531300fc629816ea9;p=thirdparty%2Fsystemd.git repart: Add partno to output --- diff --git a/src/partition/repart.c b/src/partition/repart.c index 198e698c794..aed17cc9224 100644 --- a/src/partition/repart.c +++ b/src/partition/repart.c @@ -2716,7 +2716,7 @@ static int context_dump_partitions(Context *context) { _cleanup_(table_unrefp) Table *t = NULL; uint64_t sum_padding = 0, sum_size = 0; int r; - const size_t roothash_col = 13, dropin_files_col = 14, split_path_col = 15; + const size_t roothash_col = 14, dropin_files_col = 15, split_path_col = 16; bool has_roothash = false, has_dropin_files = false, has_split_path = false; if ((arg_json_format_flags & JSON_FORMAT_OFF) && context->n_partitions == 0) { @@ -2727,6 +2727,7 @@ static int context_dump_partitions(Context *context) { t = table_new("type", "label", "uuid", + "partno", "file", "node", "offset", @@ -2746,12 +2747,12 @@ static int context_dump_partitions(Context *context) { if (!DEBUG_LOGGING) { if (arg_json_format_flags & JSON_FORMAT_OFF) (void) table_set_display(t, (size_t) 0, (size_t) 1, (size_t) 2, (size_t) 3, (size_t) 4, - (size_t) 8, (size_t) 11, roothash_col, dropin_files_col, + (size_t) 8, (size_t) 9, (size_t) 12, roothash_col, dropin_files_col, split_path_col); else (void) table_set_display(t, (size_t) 0, (size_t) 1, (size_t) 2, (size_t) 3, (size_t) 4, - (size_t) 5, (size_t) 6, (size_t) 7, (size_t) 9, (size_t) 10, - (size_t) 12, roothash_col, dropin_files_col, + (size_t) 5, (size_t) 6, (size_t) 7, (size_t) 8, (size_t) 10, + (size_t) 11, (size_t) 13, roothash_col, dropin_files_col, split_path_col); } @@ -2805,6 +2806,7 @@ static int context_dump_partitions(Context *context) { TABLE_STRING, gpt_partition_type_uuid_to_string_harder(p->type.uuid, uuid_buffer), TABLE_STRING, empty_to_null(label) ?: "-", TABLE_SET_COLOR, empty_to_null(label) ? NULL : ansi_grey(), TABLE_UUID, p->new_uuid_is_set ? p->new_uuid : p->current_uuid, + TABLE_UINT64, p->partno, TABLE_PATH_BASENAME, p->definition_path, TABLE_SET_COLOR, p->definition_path ? NULL : ansi_grey(), TABLE_STRING, partname ?: "-", TABLE_SET_COLOR, partname ? NULL : ansi_highlight(), TABLE_UINT64, p->offset, @@ -2842,6 +2844,7 @@ static int context_dump_partitions(Context *context) { TABLE_EMPTY, TABLE_EMPTY, TABLE_EMPTY, + TABLE_EMPTY, TABLE_STRING, a, TABLE_EMPTY, TABLE_EMPTY, diff --git a/test/units/testsuite-58.sh b/test/units/testsuite-58.sh index 7e21cdd6030..0c4e3205eb8 100755 --- a/test/units/testsuite-58.sh +++ b/test/units/testsuite-58.sh @@ -429,6 +429,7 @@ EOF "type" : "swap", "label" : "label2", "uuid" : "837c3d67-21b3-478e-be82-7e7f83bf96d3", + "partno" : 0, "file" : "$defs/root.conf", "node" : "$imgs/zzz1", "offset" : 1048576, @@ -489,6 +490,7 @@ EOF "type" : "swap", "label" : "label1", "uuid" : "7b93d1f2-595d-4ce3-b0b9-837fbd9e63b0", + "partno" : 0, "file" : "$defs/1/root1.conf", "node" : "$imgs/zzz1", "offset" : 1048576, @@ -504,6 +506,7 @@ EOF "type" : "swap", "label" : "label2", "uuid" : "837c3d67-21b3-478e-be82-7e7f83bf96d3", + "partno" : 1, "file" : "$defs/2/root2.conf", "node" : "$imgs/zzz2", "offset" : 34603008,