aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2008-03-02 09:26:41 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2008-10-21 07:47:46 -0400
commitef7822c2fbbb004e30e1fb6f79d6f8a1a1a144d7 (patch)
tree775acdc9ea3542e74bbd52972119ab00c878d3b8 /drivers/block
parent2b9ecd03335c7be9b8ce84f4499f4b6785a655ee (diff)
[PATCH] switch cciss
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'drivers/block')
-rw-r--r--drivers/block/cciss.c78
1 files changed, 39 insertions, 39 deletions
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
index 781b745181d2..4023885353e0 100644
--- a/drivers/block/cciss.c
+++ b/drivers/block/cciss.c
@@ -152,9 +152,9 @@ static ctlr_info_t *hba[MAX_CTLR];
152 152
153static void do_cciss_request(struct request_queue *q); 153static void do_cciss_request(struct request_queue *q);
154static irqreturn_t do_cciss_intr(int irq, void *dev_id); 154static irqreturn_t do_cciss_intr(int irq, void *dev_id);
155static int cciss_open(struct inode *inode, struct file *filep); 155static int cciss_open(struct block_device *bdev, fmode_t mode);
156static int cciss_release(struct inode *inode, struct file *filep); 156static int cciss_release(struct gendisk *disk, fmode_t mode);
157static int cciss_ioctl(struct inode *inode, struct file *filep, 157static int cciss_ioctl(struct block_device *bdev, fmode_t mode,
158 unsigned int cmd, unsigned long arg); 158 unsigned int cmd, unsigned long arg);
159static int cciss_getgeo(struct block_device *bdev, struct hd_geometry *geo); 159static int cciss_getgeo(struct block_device *bdev, struct hd_geometry *geo);
160 160
@@ -192,17 +192,18 @@ static void cciss_procinit(int i)
192#endif /* CONFIG_PROC_FS */ 192#endif /* CONFIG_PROC_FS */
193 193
194#ifdef CONFIG_COMPAT 194#ifdef CONFIG_COMPAT
195static long cciss_compat_ioctl(struct file *f, unsigned cmd, unsigned long arg); 195static int cciss_compat_ioctl(struct block_device *, fmode_t,
196 unsigned, unsigned long);
196#endif 197#endif
197 198
198static struct block_device_operations cciss_fops = { 199static struct block_device_operations cciss_fops = {
199 .owner = THIS_MODULE, 200 .owner = THIS_MODULE,
200 .__open = cciss_open, 201 .open = cciss_open,
201 .__release = cciss_release, 202 .release = cciss_release,
202 .__ioctl = cciss_ioctl, 203 .locked_ioctl = cciss_ioctl,
203 .getgeo = cciss_getgeo, 204 .getgeo = cciss_getgeo,
204#ifdef CONFIG_COMPAT 205#ifdef CONFIG_COMPAT
205 .__compat_ioctl = cciss_compat_ioctl, 206 .compat_ioctl = cciss_compat_ioctl,
206#endif 207#endif
207 .revalidate_disk = cciss_revalidate, 208 .revalidate_disk = cciss_revalidate,
208}; 209};
@@ -547,13 +548,13 @@ static inline drive_info_struct *get_drv(struct gendisk *disk)
547/* 548/*
548 * Open. Make sure the device is really there. 549 * Open. Make sure the device is really there.
549 */ 550 */
550static int cciss_open(struct inode *inode, struct file *filep) 551static int cciss_open(struct block_device *bdev, fmode_t mode)
551{ 552{
552 ctlr_info_t *host = get_host(inode->i_bdev->bd_disk); 553 ctlr_info_t *host = get_host(bdev->bd_disk);
553 drive_info_struct *drv = get_drv(inode->i_bdev->bd_disk); 554 drive_info_struct *drv = get_drv(bdev->bd_disk);
554 555
555#ifdef CCISS_DEBUG 556#ifdef CCISS_DEBUG
556 printk(KERN_DEBUG "cciss_open %s\n", inode->i_bdev->bd_disk->disk_name); 557 printk(KERN_DEBUG "cciss_open %s\n", bdev->bd_disk->disk_name);
557#endif /* CCISS_DEBUG */ 558#endif /* CCISS_DEBUG */
558 559
559 if (host->busy_initializing || drv->busy_configuring) 560 if (host->busy_initializing || drv->busy_configuring)
@@ -567,9 +568,9 @@ static int cciss_open(struct inode *inode, struct file *filep)
567 * for "raw controller". 568 * for "raw controller".
568 */ 569 */
569 if (drv->heads == 0) { 570 if (drv->heads == 0) {
570 if (iminor(inode) != 0) { /* not node 0? */ 571 if (MINOR(bdev->bd_dev) != 0) { /* not node 0? */
571 /* if not node 0 make sure it is a partition = 0 */ 572 /* if not node 0 make sure it is a partition = 0 */
572 if (iminor(inode) & 0x0f) { 573 if (MINOR(bdev->bd_dev) & 0x0f) {
573 return -ENXIO; 574 return -ENXIO;
574 /* if it is, make sure we have a LUN ID */ 575 /* if it is, make sure we have a LUN ID */
575 } else if (drv->LunID == 0) { 576 } else if (drv->LunID == 0) {
@@ -587,14 +588,13 @@ static int cciss_open(struct inode *inode, struct file *filep)
587/* 588/*
588 * Close. Sync first. 589 * Close. Sync first.
589 */ 590 */
590static int cciss_release(struct inode *inode, struct file *filep) 591static int cciss_release(struct gendisk *disk, fmode_t mode)
591{ 592{
592 ctlr_info_t *host = get_host(inode->i_bdev->bd_disk); 593 ctlr_info_t *host = get_host(disk);
593 drive_info_struct *drv = get_drv(inode->i_bdev->bd_disk); 594 drive_info_struct *drv = get_drv(disk);
594 595
595#ifdef CCISS_DEBUG 596#ifdef CCISS_DEBUG
596 printk(KERN_DEBUG "cciss_release %s\n", 597 printk(KERN_DEBUG "cciss_release %s\n", disk->disk_name);
597 inode->i_bdev->bd_disk->disk_name);
598#endif /* CCISS_DEBUG */ 598#endif /* CCISS_DEBUG */
599 599
600 drv->usage_count--; 600 drv->usage_count--;
@@ -604,21 +604,23 @@ static int cciss_release(struct inode *inode, struct file *filep)
604 604
605#ifdef CONFIG_COMPAT 605#ifdef CONFIG_COMPAT
606 606
607static int do_ioctl(struct file *f, unsigned cmd, unsigned long arg) 607static int do_ioctl(struct block_device *bdev, fmode_t mode,
608 unsigned cmd, unsigned long arg)
608{ 609{
609 int ret; 610 int ret;
610 lock_kernel(); 611 lock_kernel();
611 ret = cciss_ioctl(f->f_path.dentry->d_inode, f, cmd, arg); 612 ret = cciss_ioctl(bdev, mode, cmd, arg);
612 unlock_kernel(); 613 unlock_kernel();
613 return ret; 614 return ret;
614} 615}
615 616
616static int cciss_ioctl32_passthru(struct file *f, unsigned cmd, 617static int cciss_ioctl32_passthru(struct block_device *bdev, fmode_t mode,
617 unsigned long arg); 618 unsigned cmd, unsigned long arg);
618static int cciss_ioctl32_big_passthru(struct file *f, unsigned cmd, 619static int cciss_ioctl32_big_passthru(struct block_device *bdev, fmode_t mode,
619 unsigned long arg); 620 unsigned cmd, unsigned long arg);
620 621
621static long cciss_compat_ioctl(struct file *f, unsigned cmd, unsigned long arg) 622static int cciss_compat_ioctl(struct block_device *bdev, fmode_t mode,
623 unsigned cmd, unsigned long arg)
622{ 624{
623 switch (cmd) { 625 switch (cmd) {
624 case CCISS_GETPCIINFO: 626 case CCISS_GETPCIINFO:
@@ -636,20 +638,20 @@ static long cciss_compat_ioctl(struct file *f, unsigned cmd, unsigned long arg)
636 case CCISS_REGNEWD: 638 case CCISS_REGNEWD:
637 case CCISS_RESCANDISK: 639 case CCISS_RESCANDISK:
638 case CCISS_GETLUNINFO: 640 case CCISS_GETLUNINFO:
639 return do_ioctl(f, cmd, arg); 641 return do_ioctl(bdev, mode, cmd, arg);
640 642
641 case CCISS_PASSTHRU32: 643 case CCISS_PASSTHRU32:
642 return cciss_ioctl32_passthru(f, cmd, arg); 644 return cciss_ioctl32_passthru(bdev, mode, cmd, arg);
643 case CCISS_BIG_PASSTHRU32: 645 case CCISS_BIG_PASSTHRU32:
644 return cciss_ioctl32_big_passthru(f, cmd, arg); 646 return cciss_ioctl32_big_passthru(bdev, mode, cmd, arg);
645 647
646 default: 648 default:
647 return -ENOIOCTLCMD; 649 return -ENOIOCTLCMD;
648 } 650 }
649} 651}
650 652
651static int cciss_ioctl32_passthru(struct file *f, unsigned cmd, 653static int cciss_ioctl32_passthru(struct block_device *bdev, fmode_t mode,
652 unsigned long arg) 654 unsigned cmd, unsigned long arg)
653{ 655{
654 IOCTL32_Command_struct __user *arg32 = 656 IOCTL32_Command_struct __user *arg32 =
655 (IOCTL32_Command_struct __user *) arg; 657 (IOCTL32_Command_struct __user *) arg;
@@ -676,7 +678,7 @@ static int cciss_ioctl32_passthru(struct file *f, unsigned cmd,
676 if (err) 678 if (err)
677 return -EFAULT; 679 return -EFAULT;
678 680
679 err = do_ioctl(f, CCISS_PASSTHRU, (unsigned long)p); 681 err = do_ioctl(bdev, mode, CCISS_PASSTHRU, (unsigned long)p);
680 if (err) 682 if (err)
681 return err; 683 return err;
682 err |= 684 err |=
@@ -687,8 +689,8 @@ static int cciss_ioctl32_passthru(struct file *f, unsigned cmd,
687 return err; 689 return err;
688} 690}
689 691
690static int cciss_ioctl32_big_passthru(struct file *file, unsigned cmd, 692static int cciss_ioctl32_big_passthru(struct block_device *bdev, fmode_t mode,
691 unsigned long arg) 693 unsigned cmd, unsigned long arg)
692{ 694{
693 BIG_IOCTL32_Command_struct __user *arg32 = 695 BIG_IOCTL32_Command_struct __user *arg32 =
694 (BIG_IOCTL32_Command_struct __user *) arg; 696 (BIG_IOCTL32_Command_struct __user *) arg;
@@ -717,7 +719,7 @@ static int cciss_ioctl32_big_passthru(struct file *file, unsigned cmd,
717 if (err) 719 if (err)
718 return -EFAULT; 720 return -EFAULT;
719 721
720 err = do_ioctl(file, CCISS_BIG_PASSTHRU, (unsigned long)p); 722 err = do_ioctl(bdev, mode, CCISS_BIG_PASSTHRU, (unsigned long)p);
721 if (err) 723 if (err)
722 return err; 724 return err;
723 err |= 725 err |=
@@ -745,10 +747,9 @@ static int cciss_getgeo(struct block_device *bdev, struct hd_geometry *geo)
745/* 747/*
746 * ioctl 748 * ioctl
747 */ 749 */
748static int cciss_ioctl(struct inode *inode, struct file *filep, 750static int cciss_ioctl(struct block_device *bdev, fmode_t mode,
749 unsigned int cmd, unsigned long arg) 751 unsigned int cmd, unsigned long arg)
750{ 752{
751 struct block_device *bdev = inode->i_bdev;
752 struct gendisk *disk = bdev->bd_disk; 753 struct gendisk *disk = bdev->bd_disk;
753 ctlr_info_t *host = get_host(disk); 754 ctlr_info_t *host = get_host(disk);
754 drive_info_struct *drv = get_drv(disk); 755 drive_info_struct *drv = get_drv(disk);
@@ -1232,8 +1233,7 @@ static int cciss_ioctl(struct inode *inode, struct file *filep,
1232 case SG_EMULATED_HOST: 1233 case SG_EMULATED_HOST:
1233 case SG_IO: 1234 case SG_IO:
1234 case SCSI_IOCTL_SEND_COMMAND: 1235 case SCSI_IOCTL_SEND_COMMAND:
1235 return scsi_cmd_ioctl(disk->queue, disk, 1236 return scsi_cmd_ioctl(disk->queue, disk, mode, cmd, argp);
1236 filep ? filep->f_mode : 0, cmd, argp);
1237 1237
1238 /* scsi_cmd_ioctl would normally handle these, below, but */ 1238 /* scsi_cmd_ioctl would normally handle these, below, but */
1239 /* they aren't a good fit for cciss, as CD-ROMs are */ 1239 /* they aren't a good fit for cciss, as CD-ROMs are */