From: Zbigniew Jędrzejewski-Szmek Date: Fri, 24 Oct 2025 08:34:17 +0000 (+0200) Subject: repart: adjust "partno" column X-Git-Tag: v259-rc1~22 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=cfb6c543245be0a1908c270941b7881ac7395d1b;p=thirdparty%2Fsystemd.git repart: adjust "partno" column In a typical output from systemd-repart, the output is very wide any any wasted space is bad because it pushes the interesting information even further to the right. We usually need at most one or two digits to express the partition numbers, so let's shorten the title of the column to effectively remove two columns in the output. In JSON output, the old field name is retained. This follows the pattern already used for field "drop-in_files". Also right-align the columns with numbers always to the right. I doesn't make sense to align the columns which are only used for JSON output, so stop setting alignment for those. --- diff --git a/src/repart/repart.c b/src/repart/repart.c index 698bbfab62c..d0087771d49 100644 --- a/src/repart/repart.c +++ b/src/repart/repart.c @@ -3988,17 +3988,17 @@ static int context_dump_partitions(Context *context) { return 0; } - t = table_new("type", + t = table_new("type", /* 0 */ "label", "uuid", - "partno", + "part", "file", "node", "offset", "old size", "raw size", "size", - "old padding", + "old padding", /* 10 */ "raw padding", "padding", "activity", @@ -4008,6 +4008,9 @@ static int context_dump_partitions(Context *context) { if (!t) return log_oom(); + /* For compatiblity, use the original longer name for JSON output. */ + table_set_json_field_name(t, 3, "partno"); + /* Starting in v257, these fields would be automatically formatted with underscores. This would have * been a breaking change, so to avoid that let's hard-code their original names. */ table_set_json_field_name(t, 15, "drop-in_files"); @@ -4024,13 +4027,13 @@ static int context_dump_partitions(Context *context) { split_path_col); } - (void) table_set_align_percent(t, table_get_cell(t, 0, 5), 100); + (void) table_set_align_percent(t, table_get_cell(t, 0, 3), 100); (void) table_set_align_percent(t, table_get_cell(t, 0, 6), 100); (void) table_set_align_percent(t, table_get_cell(t, 0, 7), 100); (void) table_set_align_percent(t, table_get_cell(t, 0, 8), 100); (void) table_set_align_percent(t, table_get_cell(t, 0, 9), 100); - (void) table_set_align_percent(t, table_get_cell(t, 0, 10), 100); (void) table_set_align_percent(t, table_get_cell(t, 0, 11), 100); + (void) table_set_align_percent(t, table_get_cell(t, 0, 12), 100); LIST_FOREACH(partitions, p, context->partitions) { _cleanup_free_ char *size_change = NULL, *padding_change = NULL, *partname = NULL, *rh = NULL;