mirror of
https://github.com/systemd/systemd.git
synced 2026-08-13 06:32:22 +00:00
repart: fix SizeMinBytes/SizeMaxBytes rounding direction
The ltype parameter for SizeMinBytes and SizeMaxBytes in the config parsing table was reversed. SizeMinBytes should round UP (ltype > 0) to ensure the partition is at least the specified size, while SizeMaxBytes should round DOWN (ltype < 0) to ensure the partition doesn't exceed the specified size. This matches the documentation in repart.d.xml which correctly states: - SizeMinBytes: 'rounded upwards' - SizeMaxBytes: 'rounded downwards' The same fix is applied to PaddingMinBytes and PaddingMaxBytes which share the same config_parse_size4096 parser. Fixes: #42526 Co-developed-by: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Liu Zhangjian <liuzhangjian@uniontech.com> (cherry picked from commit70d341b507) (cherry picked from commitf8957920b7)
This commit is contained in:
committed by
Luca Boccassi
parent
fd91bbf60f
commit
fca3db239d
@@ -2824,10 +2824,10 @@ static int partition_read_definition(
|
||||
{ "Partition", "Priority", config_parse_int32, 0, &p->priority },
|
||||
{ "Partition", "Weight", config_parse_weight, 0, &p->weight },
|
||||
{ "Partition", "PaddingWeight", config_parse_weight, 0, &p->padding_weight },
|
||||
{ "Partition", "SizeMinBytes", config_parse_size4096, -1, &p->size_min },
|
||||
{ "Partition", "SizeMaxBytes", config_parse_size4096, 1, &p->size_max },
|
||||
{ "Partition", "PaddingMinBytes", config_parse_size4096, -1, &p->padding_min },
|
||||
{ "Partition", "PaddingMaxBytes", config_parse_size4096, 1, &p->padding_max },
|
||||
{ "Partition", "SizeMinBytes", config_parse_size4096, 1, &p->size_min },
|
||||
{ "Partition", "SizeMaxBytes", config_parse_size4096, -1, &p->size_max },
|
||||
{ "Partition", "PaddingMinBytes", config_parse_size4096, 1, &p->padding_min },
|
||||
{ "Partition", "PaddingMaxBytes", config_parse_size4096, -1, &p->padding_max },
|
||||
{ "Partition", "FactoryReset", config_parse_bool, 0, &p->factory_reset },
|
||||
{ "Partition", "CopyBlocks", config_parse_copy_blocks, 0, p },
|
||||
{ "Partition", "Format", config_parse_fstype, 0, &p->format },
|
||||
|
||||
Reference in New Issue
Block a user