]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
repart: Add partno to output
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Wed, 23 Aug 2023 07:54:38 +0000 (09:54 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Wed, 23 Aug 2023 13:12:23 +0000 (15:12 +0200)
src/partition/repart.c
test/units/testsuite-58.sh

index 198e698c794efdd59fcb894a176c0cb500562d8c..aed17cc922426d1b46ad9e164cb6b6ac4152d510 100644 (file)
@@ -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,
index 7e21cdd603059e76bc9da2fcc87aefb58260ad11..0c4e3205eb87a6112f848760b8f152b7574905ee 100755 (executable)
@@ -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,