* scsi BLKGETSIZE breakage in -pre2
@ 2001-11-10 7:34 Andrew Morton
2001-11-10 13:57 ` Alan Cox
2001-11-10 14:05 ` Anton Altaparmakov
0 siblings, 2 replies; 3+ messages in thread
From: Andrew Morton @ 2001-11-10 7:34 UTC (permalink / raw)
To: lkml, Alan Cox
sd_ioctl() was changed to pass BLKGETSIZE off to blk_ioctl(),
but blk_ioctl() doesn't implement it.
So `cfdisk /dev/sda' is failing.
Simply copying the -ac version of blkpg.c across fixes
it for me.
--- linux-2.4.15-pre2/drivers/block/blkpg.c Mon Oct 15 13:27:42 2001
+++ linux-akpm/drivers/block/blkpg.c Fri Nov 9 23:14:23 2001
@@ -195,8 +195,13 @@ int blkpg_ioctl(kdev_t dev, struct blkpg
int blk_ioctl(kdev_t dev, unsigned int cmd, unsigned long arg)
{
+ struct gendisk *g;
+ u64 ullval = 0;
int intval;
+ if (!dev)
+ return -EINVAL;
+
switch (cmd) {
case BLKROSET:
if (!capable(CAP_SYS_ADMIN))
@@ -212,7 +217,7 @@ int blk_ioctl(kdev_t dev, unsigned int c
case BLKRASET:
if(!capable(CAP_SYS_ADMIN))
return -EACCES;
- if(!dev || arg > 0xff)
+ if(arg > 0xff)
return -EINVAL;
read_ahead[MAJOR(dev)] = arg;
return 0;
@@ -224,8 +229,6 @@ int blk_ioctl(kdev_t dev, unsigned int c
case BLKFLSBUF:
if(!capable(CAP_SYS_ADMIN))
return -EACCES;
- if (!dev)
- return -EINVAL;
fsync_dev(dev);
invalidate_buffers(dev);
return 0;
@@ -235,18 +238,16 @@ int blk_ioctl(kdev_t dev, unsigned int c
intval = get_hardsect_size(dev);
return put_user(intval, (int *) arg);
-#if 0
case BLKGETSIZE:
- /* Today get_gendisk() requires a linear scan;
- add this when dev has pointer type. */
- /* add BLKGETSIZE64 too */
+ case BLKGETSIZE64:
g = get_gendisk(dev);
- if (!g)
- ulongval = 0;
+ if (g)
+ ullval = g->part[MINOR(dev)].nr_sects;
+
+ if (cmd == BLKGETSIZE)
+ return put_user((unsigned long)ullval, (unsigned long *)arg);
else
- ulongval = g->part[MINOR(dev)].nr_sects;
- return put_user(ulongval, (unsigned long *) arg);
-#endif
+ return put_user(ullval, (u64 *)arg);
#if 0
case BLKRRPART: /* Re-read partition tables */
if (!capable(CAP_SYS_ADMIN))
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: scsi BLKGETSIZE breakage in -pre2
2001-11-10 7:34 scsi BLKGETSIZE breakage in -pre2 Andrew Morton
@ 2001-11-10 13:57 ` Alan Cox
2001-11-10 14:05 ` Anton Altaparmakov
1 sibling, 0 replies; 3+ messages in thread
From: Alan Cox @ 2001-11-10 13:57 UTC (permalink / raw)
To: Andrew Morton; +Cc: lkml, Alan Cox
> sd_ioctl() was changed to pass BLKGETSIZE off to blk_ioctl(),
> but blk_ioctl() doesn't implement it.
>
> So `cfdisk /dev/sda' is failing.
>
> Simply copying the -ac version of blkpg.c across fixes
> it for me.
I'm feeding Linus stuff bit by bit - I managed to misorder that one.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: scsi BLKGETSIZE breakage in -pre2
2001-11-10 7:34 scsi BLKGETSIZE breakage in -pre2 Andrew Morton
2001-11-10 13:57 ` Alan Cox
@ 2001-11-10 14:05 ` Anton Altaparmakov
1 sibling, 0 replies; 3+ messages in thread
From: Anton Altaparmakov @ 2001-11-10 14:05 UTC (permalink / raw)
To: Alan Cox; +Cc: Andrew Morton, lkml, Alan Cox
At 13:57 10/11/01, Alan Cox wrote:
> > sd_ioctl() was changed to pass BLKGETSIZE off to blk_ioctl(),
> > but blk_ioctl() doesn't implement it.
> >
> > So `cfdisk /dev/sda' is failing.
> >
> > Simply copying the -ac version of blkpg.c across fixes
> > it for me.
>
>I'm feeding Linus stuff bit by bit - I managed to misorder that one.
It has one positive side: mkntfs failed so I finally got round to
implementing device size determination via binary lseek search (a la
e2fsutils library) and I can test it without having to modify the mkntfs
source by booting into -pre2. (-:
Anton
--
"I've not lost my mind. It's backed up on tape somewhere." - Unknown
--
Anton Altaparmakov <aia21 at cam.ac.uk> (replace at with @)
Linux NTFS Maintainer / WWW: http://linux-ntfs.sf.net/
ICQ: 8561279 / WWW: http://www-stu.christs.cam.ac.uk/~aia21/
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2001-11-10 14:06 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-11-10 7:34 scsi BLKGETSIZE breakage in -pre2 Andrew Morton
2001-11-10 13:57 ` Alan Cox
2001-11-10 14:05 ` Anton Altaparmakov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox