]> git.ipfire.org Git - thirdparty/systemd.git/commit
repart: fix sector size handling
authorLennart Poettering <lennart@poettering.net>
Fri, 4 Feb 2022 16:39:44 +0000 (17:39 +0100)
committerLennart Poettering <lennart@poettering.net>
Tue, 8 Feb 2022 09:47:48 +0000 (10:47 +0100)
commit994b303123ebe6a140bf3e56c66aa66119ae7d95
tree24ce838e108269aa612fc05bd8dec8dd7e4b9668
parentec82f867eea000921fa0f93a9adf1f8fd7bfe2c5
repart: fix sector size handling

This queries the sector size from libfdisk instead of assuming 512, and
uses that when converting from bytes to the offset/size values libfdisk
expects.

This is an alternative to Tom Yan's #21823, but prefers using libfdisk's
own ideas of the sector size instead of going directly to the backing
device via ioctls. (libfdisk can after all also operate on regular
files, where the sector size concept doesn't necessarily apply the same
way.)

This also makes the "grain" variable, i.e. how we'll align the
partitions. Previously this was hardcoded to 4K, and that still will be
the minimum grain we use, but should the sector size be larger than that
we'll use the next multiple of the sector size instead.
src/partition/repart.c