lkml.org 
[lkml]   [2001]   [Nov]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subjectscsi BLKGETSIZE breakage in -pre2
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))
-
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/
\
 
 \ /
  Last update: 2005-03-22 13:13    [W:0.026 / U:9.732 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site