2002-01-04 17:40:55

by Eric Sandeen

[permalink] [raw]
Subject: [PATCH] BLKGETSIZE64 broken in 2.4.18-pre1, 2.5.2-pre7

BLKGETSIZE64 is supposed to return device size in bytes:

#define BLKGETSIZE64 _IOR(0x12,114,sizeof(u64)) /* return device size in
bytes (u64 *arg) */

but in drivers/block/blkpg.c, it's just returning device size/512 as a
u64 number.

This patch should apply to both kernels.

--- linux/drivers/block/blkpg.c.orig Fri Jan 4 11:30:37 2002
+++ linux/drivers/block/blkpg.c Fri Jan 4 11:31:15 2002
@@ -247,7 +247,7 @@
if (cmd == BLKGETSIZE)
return put_user((unsigned long)ullval, (unsigned long *)arg);
else
- return put_user(ullval, (u64 *)arg);
+ return put_user(ullval << 9, (u64 *)arg);
#if 0
case BLKRRPART: /* Re-read partition tables */
if (!capable(CAP_SYS_ADMIN))


--
Eric Sandeen XFS for Linux http://oss.sgi.com/projects/xfs
[email protected] SGI, Inc.