All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Tim Pepper" <tpepper@vato.org>
To: Matt Domsch <Matt_Domsch@Dell.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: BLKGETSIZE64 (bytes or sectors?)
Date: Thu, 17 Jan 2002 13:12:45 -0800	[thread overview]
Message-ID: <20020117131245.A11241@vato.org> (raw)
In-Reply-To: <Pine.LNX.4.33.0201171420100.2747-100000@localhost.localdomain>
In-Reply-To: <Pine.LNX.4.33.0201171420100.2747-100000@localhost.localdomain>; from Matt_Domsch@Dell.com on Thu, Jan 17, 2002 at 02:28:52PM -0600

On Thu 17 Jan at 14:28:52 -0600 Matt_Domsch@Dell.com done said:
> 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.

I was just in the process of writing a post for the same thing.  Wouldn't it
be better to do the following (against 2.4.17).

Tim

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


--- linux-2.4.17-orig/blkpg.c	Thu Jan 17 13:02:19 2002
+++ linux-2.4.17/blkpg.c	Thu Jan 17 13:06:33 2002
@@ -246,8 +246,14 @@
 
 			if (cmd == BLKGETSIZE)
 				return put_user((unsigned long)ullval, (unsigned long *)arg);
-			else
+			else {
+				if (hardsect_size[MAJOR(dev)][MINOR(dev)]) {
+					ullval *= hardsect_size[MAJOR(dev)][MINOR(dev)];
+				} else {
+					ullval *= 512;
+				}
 				return put_user(ullval, (u64 *)arg);
+			}
 #if 0
 		case BLKRRPART: /* Re-read partition tables */
 			if (!capable(CAP_SYS_ADMIN)) 

  reply	other threads:[~2002-01-17 21:13 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-01-17 20:28 BLKGETSIZE64 (bytes or sectors?) Matt Domsch
2002-01-17 21:12 ` Tim Pepper [this message]
2002-01-17 22:47 ` Benjamin LaHaise
  -- strict thread matches above, loose matches on Subject: below --
2002-01-17 22:34 Matt_Domsch
2002-01-17 22:46 ` Tim Pepper
2002-01-17 23:48 Andries.Brouwer
2002-01-18  0:21 ` Tim Pepper

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20020117131245.A11241@vato.org \
    --to=tpepper@vato.org \
    --cc=Matt_Domsch@Dell.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.