1
0
mirror of https://github.com/systemd/systemd.git synced 2025-08-25 13:49:55 +03:00

repart: Add partno to output

This commit is contained in:
Daan De Meyer
2023-08-23 09:54:38 +02:00
parent 9f643be929
commit 1ffa5cfb38
2 changed files with 10 additions and 4 deletions

View 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,

View File

@ -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,