Skip to contentSkip to conversation

BLKGETSIZE64 (bytes not sectors)

PATCH RESEND In review Tim Pepper 2 participants 2 messages Jan 25, 2002 – Jan 26, 2002

lore
Share & tools
lore

Tim Pepper

author
#0 lore raw

PATCH RESEND 1/1 BLKGETSIZE64 (bytes not sectors)

Marcelo,

Myself and Matt and previously others (searching the archive shows Eric Sandeen complaining for quite a while) have noticed the following bug in blkpg.c. You can see the most recent thread at:

	http://groups.google.com/groups?hl=en&threadm=fa.fo6abnv.1shuppi%40ifi.uio.no&rnum=5&prev=/groups%3Fhl%3Den%26q%3DBLKGETSIZE64%26btnG%3DGoogle%2BSearch%26meta%3Dgroup%253Dfa.linux.kernel

Has this patch just missed inclusion or do you have a reason to leave it out?

Tim

----- Forwarded message from Matt Domsch <[email protected]> -----

From: Matt Domsch <[email protected]>
To: <[email protected]>
Subject: BLKGETSIZE64 (bytes or sectors?)
Date: Thu, 17 Jan 2002 14:28:52 -0600 (CST)
X-Mailing-List: [email protected]

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

Signature · 32 lines
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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

----- End forwarded message -----

-- 
*********************************************************
*  tpepper@vato dot org             * Venimus, Vidimus, *
*  http://www.vato.org/~tpepper     * Dolavimus         *
*********************************************************