summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorKarel Zak <kzak@redhat.com>2009-10-22 14:52:39 +0200
committerKarel Zak <kzak@redhat.com>2009-10-22 14:52:39 +0200
commit2a1dfbad1c3da1c98fa35e3175e84229253af387 (patch)
tree26c4c81930dfee9069bf0e49eb4a815419aefa95 /lib
parentd13fe35ca15acff029aafec56052a0b40edcaa63 (diff)
downloadutil-linux-old-2a1dfbad1c3da1c98fa35e3175e84229253af387.tar.gz
libblkid: use BLKSSZGET for GPT sectors
The current implementation uses fixed sector size (512 bytes), that's wrong. UEFI standard requires real logical sector size -- it means BLKSSZGET for Linux. The size of GPT header is not static, but whole sector is allocated for the header. In theory the HeaderSize field could be greater than sizeof(struct gpt_header). It means we have to read whole sector with the header, because the header crc32 checksum is counted according to HeaderSize. Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/blkdev.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/blkdev.c b/lib/blkdev.c
index 7c6c7bab..1ca4548b 100644
--- a/lib/blkdev.c
+++ b/lib/blkdev.c
@@ -85,7 +85,11 @@ blkdev_get_sectors(int fd, unsigned long long *sectors)
return -1;
}
-/* get hardware sector size */
+/* get logical sector size (default is 512)
+ *
+ * This is the smallest unit the storage device can
+ * address. It is typically 512 bytes.
+ */
int
blkdev_get_sector_size(int fd, int *sector_size)
{