mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: mike.miller@hp.com
To: akpm@osdl.org, axboe@suse.de
Cc: linux-kernel@vger.kernel.org
Subject: cciss update for 2.6
Date: Thu, 25 Mar 2004 16:46:41 -0600	[thread overview]
Message-ID: <20040325224641.GE4456@beardog.cca.cpqcorp.net> (raw)

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;

             reply	other threads:[~2004-03-25 22:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-25 22:46 mike.miller [this message]
2004-03-26  3:44 ` Andrew Morton
2004-03-26  7:15 ` Christoph Hellwig
2004-03-26 14:08 Miller, Mike (OS Dev)

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=20040325224641.GE4456@beardog.cca.cpqcorp.net \
    --to=mike.miller@hp.com \
    --cc=akpm@osdl.org \
    --cc=axboe@suse.de \
    --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 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®