BLKGETSIZE64 (bytes or sectors?)

From: Matt Domsch (
Date: Thu Jan 17 2002 - 15:28:52 EST

Is the BLKGETSIZE64 ioctl supposed to return the size of the device in
bytes (as the comment says, and is implemented in all places *except*
blkpg.c), or in sectors (as is implemented in blkpg.c since 2.4.15)?

It would seem that blkpg.c gets it wrong, that it should be in bytes.
Assuming that's the case, here's the patch to fix it against 2.4.18-pre4.


Matt Domsch
Sr. Software Engineer
Dell Linux Solutions
#1 US Linux Server provider with 24.5% (IDC Dec 2001)
#2 Worldwide Linux Server provider with 18.2% (IDC Dec 2001)

--- linux-2.4.18-pre4/drivers/block/blkpg.c.orig Thu Jan 17 14:24:24 2002 +++ linux-2.4.18-pre4/drivers/block/blkpg.c Thu Jan 17 14:26:43 2002 @@ -247,7 +247,7 @@ int blk_ioctl(kdev_t dev, unsigned int c if (cmd == BLKGETSIZE) return put_user((unsigned long)ullval, (unsigned long *)arg); else - return put_user(ullval, (u64 *)arg); + return put_user((u64)ullval << 9 , (u64 *)arg); #if 0 case BLKRRPART: /* Re-read partition tables */ if (!capable(CAP_SYS_ADMIN))

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to More majordomo info at Please read the FAQ at

This archive was generated by hypermail 2b29 : Wed Jan 23 2002 - 21:00:22 EST