]> git.ipfire.org Git - thirdparty/systemd.git/commit - src/shared/dissect-image.c
dissect-image: add probe_sector_size() helper for detecting sector size of a GPT...
authorLennart Poettering <lennart@poettering.net>
Tue, 17 Jan 2023 17:06:05 +0000 (18:06 +0100)
committerLennart Poettering <lennart@poettering.net>
Wed, 18 Jan 2023 09:10:57 +0000 (10:10 +0100)
commit05c4c59ff127668ddaa85f0a9fd67cee3c41ce00
tree3677cd001fef9c9e524d98f2a8667a843a7807ba
parent1163ddb386ef46f63942171e6eab0ca64eb818e4
dissect-image: add probe_sector_size() helper for detecting sector size of a GPT disk image

When we operate with DDIs with sector sizes != 512 we need to configure
the loopback device to match it, otherwise the image and the kernel
block device will disagree what things are.

Let's add a prober that tries to determine the sector size of a GPT DDI.
It does this by looking for the GPT partition table header at the
various byte offsets they must be located on, given a specific sector
size. It will try sector size 512, 1024, 2048 and 4096. Of these only
the 512 and 4096 really make sense IRL I guess, but let's be thorough.
src/shared/dissect-image.c
src/shared/dissect-image.h