mirror of https://github.com/vitalif/e2fsprogs
Implement DIOCGMEDIASIZE for FreeBSD's GEOM.
Try DIOCGMEDIASIZE ioctl() if defined, to obtain the media size on FreeBSD 5.0 and newer. The binary search fallback doesn't work, as FreeBSD block devices are unbuffered and refuse reads below the block size. Signed-off-by: Matthias Andree <matthias.andree@gmx.de>bitmap-optimize
parent
604f1a91e5
commit
f72b8ff098
|
@ -122,6 +122,12 @@ blkid_loff_t blkid_get_dev_size(int fd)
|
||||||
return (blkid_loff_t)size << 9;
|
return (blkid_loff_t)size << 9;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* tested on FreeBSD 6.1-RELEASE i386 */
|
||||||
|
#ifdef DIOCGMEDIASIZE
|
||||||
|
if (ioctl(fd, DIOCGMEDIASIZE, &size64) >= 0)
|
||||||
|
return (off_t)size64;
|
||||||
|
#endif /* DIOCGMEDIASIZE */
|
||||||
|
|
||||||
#ifdef FDGETPRM
|
#ifdef FDGETPRM
|
||||||
if (ioctl(fd, FDGETPRM, &this_floppy) >= 0)
|
if (ioctl(fd, FDGETPRM, &this_floppy) >= 0)
|
||||||
return (blkid_loff_t)this_floppy.size << 9;
|
return (blkid_loff_t)this_floppy.size << 9;
|
||||||
|
|
Loading…
Reference in New Issue