From: Matthias Andree Date: Tue, 30 May 2006 02:26:13 +0000 (+0200) Subject: Enable sys/disklabel.h and DIOCGDINFO based getsize code. X-Git-Tag: E2FSPROGS-1_40-WIP-1114~94 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5beaabb0f88e3fb2a4b3617fed9ac76f7a60f440;p=thirdparty%2Fe2fsprogs.git Enable sys/disklabel.h and DIOCGDINFO based getsize code. Tested on FreeBSD 4.11-RELEASE i386. Signed-off-by: Matthias Andree --- diff --git a/lib/blkid/getsize.c b/lib/blkid/getsize.c index 5525d19bd..6639246c0 100644 --- a/lib/blkid/getsize.c +++ b/lib/blkid/getsize.c @@ -133,13 +133,13 @@ blkid_loff_t blkid_get_dev_size(int fd) return (blkid_loff_t)this_floppy.size << 9; #endif #ifdef HAVE_SYS_DISKLABEL_H -#if 0 +#if 1 /* * This should work in theory but I haven't tested it. Anyone * on a BSD system want to test this for me? In the meantime, * binary search mechanism should work just fine. */ - if ((fstat(fd, &st) >= 0) && S_ISBLK(st.st_mode)) + if ((fstat(fd, &st) >= 0) && (S_ISBLK(st.st_mode) || S_ISCHR(st.st_mode))) part = st.st_rdev & 7; if (part >= 0 && (ioctl(fd, DIOCGDINFO, (char *)&lab) >= 0)) { pp = &lab.d_partitions[part];