BLKGETSIZE64 (bytes or sectors?)

Matt Domsch (Matt_Domsch@Dell.com)
Thu, 17 Jan 2002 14:28:52 -0600 (CST)


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.

Thanks,
Matt

-- 
Matt Domsch
Sr. Software Engineer
Dell Linux Solutions www.dell.com/linux
#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 majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/