mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* cciss update for 2.6
@ 2004-03-25 22:46 mike.miller
  2004-03-26  3:44 ` Andrew Morton
  2004-03-26  7:15 ` Christoph Hellwig
  0 siblings, 2 replies; 4+ messages in thread
From: mike.miller @ 2004-03-25 22:46 UTC (permalink / raw)
  To: akpm, axboe; +Cc: linux-kernel

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;

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: cciss update for 2.6
  2004-03-25 22:46 cciss update for 2.6 mike.miller
@ 2004-03-26  3:44 ` Andrew Morton
  2004-03-26  7:15 ` Christoph Hellwig
  1 sibling, 0 replies; 4+ messages in thread
From: Andrew Morton @ 2004-03-26  3:44 UTC (permalink / raw)
  To: mike.miller; +Cc: axboe, linux-kernel

mike.miller@hp.com wrote:
>
> Please consider this patch for inclusion in the 2.6 kernel.
>

I think this was a 2.4 patch?

> 
>  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.

drivers/block/cciss.c: In function `cciss_ioctl':
drivers/block/cciss.c:480: `HDIO_GETGEO_BIG' undeclared (first use in this function)
drivers/block/cciss.c:480: (Each undeclared identifier is reported only once
drivers/block/cciss.c:480: for each function it appears in.)
drivers/block/cciss.c:482: storage size of `driver_geo' isn't known
drivers/block/cciss.c:483: `dsk' undeclared (first use in this function)
drivers/block/cciss.c:490: structure has no member named `hd'
drivers/block/cciss.c:492: sizeof applied to an incomplete type
drivers/block/cciss.c:482: warning: unused variable `driver_geo'


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: cciss update for 2.6
  2004-03-25 22:46 cciss update for 2.6 mike.miller
  2004-03-26  3:44 ` Andrew Morton
@ 2004-03-26  7:15 ` Christoph Hellwig
  1 sibling, 0 replies; 4+ messages in thread
From: Christoph Hellwig @ 2004-03-26  7:15 UTC (permalink / raw)
  To: mike.miller; +Cc: akpm, axboe, linux-kernel

On Thu, Mar 25, 2004 at 04:46:41PM -0600, mike.miller@hp.com wrote:
> 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.

HDIO_GETGEO_BIG was only used by some horribly patched vendor fdisks.
It's not declared in the kernel, and thus no driver should implement it.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: cciss update for 2.6
@ 2004-03-26 14:08 Miller, Mike (OS Dev)
  0 siblings, 0 replies; 4+ messages in thread
From: Miller, Mike (OS Dev) @ 2004-03-26 14:08 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: akpm, axboe, linux-kernel

I've resubmitted the patch without HDIO_GETGEO_BIG. Sorry for my confusion.

mikem

-----Original Message-----
From: Christoph Hellwig [mailto:hch@infradead.org]
Sent: Friday, March 26, 2004 1:16 AM
To: Miller, Mike (OS Dev)
Cc: akpm@osdl.org; axboe@suse.de; linux-kernel@vger.kernel.org
Subject: Re: cciss update for 2.6


On Thu, Mar 25, 2004 at 04:46:41PM -0600, mike.miller@hp.com wrote:
> 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.

HDIO_GETGEO_BIG was only used by some horribly patched vendor fdisks.
It's not declared in the kernel, and thus no driver should implement it.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2004-03-26 14:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-03-25 22:46 cciss update for 2.6 mike.miller
2004-03-26  3:44 ` Andrew Morton
2004-03-26  7:15 ` Christoph Hellwig
2004-03-26 14:08 Miller, Mike (OS Dev)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®