[PATCH] BLKGETSIZE64 broken in 2.4.18-pre1, 2.5.2-pre7

From: Eric Sandeen (sandeen@sgi.com)
Date: Fri Jan 04 2002 - 12:40:30 EST


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
sandeen@sgi.com   SGI, Inc.

- 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/



This archive was generated by hypermail 2b29 : Mon Jan 07 2002 - 21:00:25 EST