aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2008-03-02 10:41:28 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2008-10-21 07:48:50 -0400
commit40cc51be699e37b78102ce7b2196ec9c32fe1908 (patch)
tree60fb9a102699713a7bb15f7d927cc8ddb969f703 /drivers/scsi
parent0338e29178795f0df0e1f3705b5d3effe9c95ff7 (diff)
[PATCH] switch sr
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/sr.c40
1 files changed, 18 insertions, 22 deletions
diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c
index 9446cbf4de84..62b6633e3a97 100644
--- a/drivers/scsi/sr.c
+++ b/drivers/scsi/sr.c
@@ -471,34 +471,31 @@ static int sr_prep_fn(struct request_queue *q, struct request *rq)
471 return scsi_prep_return(q, rq, ret); 471 return scsi_prep_return(q, rq, ret);
472} 472}
473 473
474static int sr_block_open(struct inode *inode, struct file *file) 474static int sr_block_open(struct block_device *bdev, fmode_t mode)
475{ 475{
476 struct gendisk *disk = inode->i_bdev->bd_disk; 476 struct scsi_cd *cd = scsi_cd_get(bdev->bd_disk);
477 struct scsi_cd *cd; 477 int ret = -ENXIO;
478 int ret = 0;
479
480 if(!(cd = scsi_cd_get(disk)))
481 return -ENXIO;
482
483 if((ret = cdrom_open(&cd->cdi, inode->i_bdev, file->f_mode)) != 0)
484 scsi_cd_put(cd);
485 478
479 if (cd) {
480 ret = cdrom_open(&cd->cdi, bdev, mode);
481 if (ret)
482 scsi_cd_put(cd);
483 }
486 return ret; 484 return ret;
487} 485}
488 486
489static int sr_block_release(struct inode *inode, struct file *file) 487static int sr_block_release(struct gendisk *disk, fmode_t mode)
490{ 488{
491 struct scsi_cd *cd = scsi_cd(inode->i_bdev->bd_disk); 489 struct scsi_cd *cd = scsi_cd(disk);
492 cdrom_release(&cd->cdi, file ? file->f_mode : 0); 490 cdrom_release(&cd->cdi, mode);
493 scsi_cd_put(cd); 491 scsi_cd_put(cd);
494
495 return 0; 492 return 0;
496} 493}
497 494
498static int sr_block_ioctl(struct inode *inode, struct file *file, unsigned cmd, 495static int sr_block_ioctl(struct block_device *bdev, fmode_t mode, unsigned cmd,
499 unsigned long arg) 496 unsigned long arg)
500{ 497{
501 struct scsi_cd *cd = scsi_cd(inode->i_bdev->bd_disk); 498 struct scsi_cd *cd = scsi_cd(bdev->bd_disk);
502 struct scsi_device *sdev = cd->device; 499 struct scsi_device *sdev = cd->device;
503 void __user *argp = (void __user *)arg; 500 void __user *argp = (void __user *)arg;
504 int ret; 501 int ret;
@@ -513,8 +510,7 @@ static int sr_block_ioctl(struct inode *inode, struct file *file, unsigned cmd,
513 return scsi_ioctl(sdev, cmd, argp); 510 return scsi_ioctl(sdev, cmd, argp);
514 } 511 }
515 512
516 ret = cdrom_ioctl(&cd->cdi, inode->i_bdev, 513 ret = cdrom_ioctl(&cd->cdi, bdev, mode, cmd, arg);
517 file ? file->f_mode : 0, cmd, arg);
518 if (ret != -ENOSYS) 514 if (ret != -ENOSYS)
519 return ret; 515 return ret;
520 516
@@ -525,7 +521,7 @@ static int sr_block_ioctl(struct inode *inode, struct file *file, unsigned cmd,
525 * if it doesn't recognise the ioctl 521 * if it doesn't recognise the ioctl
526 */ 522 */
527 ret = scsi_nonblockable_ioctl(sdev, cmd, argp, 523 ret = scsi_nonblockable_ioctl(sdev, cmd, argp,
528 file ? file->f_flags & O_NDELAY : 0); 524 (mode & FMODE_NDELAY_NOW) != 0);
529 if (ret != -ENODEV) 525 if (ret != -ENODEV)
530 return ret; 526 return ret;
531 return scsi_ioctl(sdev, cmd, argp); 527 return scsi_ioctl(sdev, cmd, argp);
@@ -540,9 +536,9 @@ static int sr_block_media_changed(struct gendisk *disk)
540static struct block_device_operations sr_bdops = 536static struct block_device_operations sr_bdops =
541{ 537{
542 .owner = THIS_MODULE, 538 .owner = THIS_MODULE,
543 .__open = sr_block_open, 539 .open = sr_block_open,
544 .__release = sr_block_release, 540 .release = sr_block_release,
545 .__ioctl = sr_block_ioctl, 541 .locked_ioctl = sr_block_ioctl,
546 .media_changed = sr_block_media_changed, 542 .media_changed = sr_block_media_changed,
547 /* 543 /*
548 * No compat_ioctl for now because sr_block_ioctl never 544 * No compat_ioctl for now because sr_block_ioctl never