lkml.org 
[lkml]   [2004]   [Mar]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subjectcciss update for 2.6
Please consider this patch for inclusion in the 2.6 kernel.

If no device is attached we now return -ENXIO instead of some bogus numbers.
Prevents applications from trying to access non-existent disks.
Also adds HDIO_GETGEO_BIG IOCTL that fdisk uses.

cciss.c | 24 ++++++++++++++++++------
1 files changed, 18 insertions(+), 6 deletions(-)
------------------------------------------------------------------------------
diff -burpN lx265-rc2.orig/drivers/block/cciss.c lx265-rc2-test2/drivers/block/cciss.c
--- lx265-rc2.orig/drivers/block/cciss.c 2004-03-12 10:10:47.000000000 -0600
+++ lx265-rc2-test2/drivers/block/cciss.c 2004-03-25 16:28:40.000000000 -0600
@@ -469,18 +469,30 @@ static int cciss_ioctl(struct inode *ino
driver_geo.heads = drv->heads;
driver_geo.sectors = drv->sectors;
driver_geo.cylinders = drv->cylinders;
- } else {
- driver_geo.heads = 0xff;
- driver_geo.sectors = 0x3f;
- driver_geo.cylinders = (int)drv->nr_blocks / (0xff*0x3f);
- }
+ } else
+ return -ENXIO;
driver_geo.start= get_start_sect(inode->i_bdev);
if (copy_to_user((void *) arg, &driver_geo,
sizeof( struct hd_geometry)))
return -EFAULT;
return(0);
}
-
+ case HDIO_GETGEO_BIG:
+ {
+ struct hd_big_geometry driver_geo;
+ if (hba[ctlr]->drv[dsk].cylinders) {
+ driver_geo.heads = hba[ctlr]->drv[dsk].heads;
+ driver_geo.sectors = hba[ctlr]->drv[dsk].sectors;
+ driver_geo.cylinders = hba[ctlr]->drv[dsk].cylinders;
+ } else
+ return -ENXIO;
+ driver_geo.start=
+ hba[ctlr]->hd[MINOR(inode->i_rdev)].start_sect;
+ if (copy_to_user((void *) arg, &driver_geo,
+ sizeof( struct hd_big_geometry)))
+ return -EFAULT;
+ return 0;
+ }
case CCISS_GETPCIINFO:
{
cciss_pci_info_struct pciinfo;
-
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 14:01    [W:0.047 / U:0.100 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site