aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2008-03-02 10:15:10 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2008-10-21 07:48:01 -0400
commit5e5e007c25009c304af693b7fc49bab8d1d25801 (patch)
tree7283750ec6ab8d24a3579b7ef21062a6ef2b2854 /drivers/block
parent8cfc7ca40c41e6cb9ee96c149d5b928564d635e4 (diff)
[PATCH] switch pktdvdcd
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'drivers/block')
-rw-r--r--drivers/block/pktcdvd.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c
index 33ac8ddf4912..90548da9c1cb 100644
--- a/drivers/block/pktcdvd.c
+++ b/drivers/block/pktcdvd.c
@@ -2411,7 +2411,7 @@ static struct pktcdvd_device *pkt_find_dev_from_minor(int dev_minor)
2411 return pkt_devs[dev_minor]; 2411 return pkt_devs[dev_minor];
2412} 2412}
2413 2413
2414static int pkt_open(struct inode *inode, struct file *file) 2414static int pkt_open(struct block_device *bdev, fmode_t mode)
2415{ 2415{
2416 struct pktcdvd_device *pd = NULL; 2416 struct pktcdvd_device *pd = NULL;
2417 int ret; 2417 int ret;
@@ -2419,7 +2419,7 @@ static int pkt_open(struct inode *inode, struct file *file)
2419 VPRINTK(DRIVER_NAME": entering open\n"); 2419 VPRINTK(DRIVER_NAME": entering open\n");
2420 2420
2421 mutex_lock(&ctl_mutex); 2421 mutex_lock(&ctl_mutex);
2422 pd = pkt_find_dev_from_minor(iminor(inode)); 2422 pd = pkt_find_dev_from_minor(MINOR(bdev->bd_dev));
2423 if (!pd) { 2423 if (!pd) {
2424 ret = -ENODEV; 2424 ret = -ENODEV;
2425 goto out; 2425 goto out;
@@ -2428,20 +2428,20 @@ static int pkt_open(struct inode *inode, struct file *file)
2428 2428
2429 pd->refcnt++; 2429 pd->refcnt++;
2430 if (pd->refcnt > 1) { 2430 if (pd->refcnt > 1) {
2431 if ((file->f_mode & FMODE_WRITE) && 2431 if ((mode & FMODE_WRITE) &&
2432 !test_bit(PACKET_WRITABLE, &pd->flags)) { 2432 !test_bit(PACKET_WRITABLE, &pd->flags)) {
2433 ret = -EBUSY; 2433 ret = -EBUSY;
2434 goto out_dec; 2434 goto out_dec;
2435 } 2435 }
2436 } else { 2436 } else {
2437 ret = pkt_open_dev(pd, file->f_mode & FMODE_WRITE); 2437 ret = pkt_open_dev(pd, mode & FMODE_WRITE);
2438 if (ret) 2438 if (ret)
2439 goto out_dec; 2439 goto out_dec;
2440 /* 2440 /*
2441 * needed here as well, since ext2 (among others) may change 2441 * needed here as well, since ext2 (among others) may change
2442 * the blocksize at mount time 2442 * the blocksize at mount time
2443 */ 2443 */
2444 set_blocksize(inode->i_bdev, CD_FRAMESIZE); 2444 set_blocksize(bdev, CD_FRAMESIZE);
2445 } 2445 }
2446 2446
2447 mutex_unlock(&ctl_mutex); 2447 mutex_unlock(&ctl_mutex);
@@ -2455,9 +2455,9 @@ out:
2455 return ret; 2455 return ret;
2456} 2456}
2457 2457
2458static int pkt_close(struct inode *inode, struct file *file) 2458static int pkt_close(struct gendisk *disk, fmode_t mode)
2459{ 2459{
2460 struct pktcdvd_device *pd = inode->i_bdev->bd_disk->private_data; 2460 struct pktcdvd_device *pd = disk->private_data;
2461 int ret = 0; 2461 int ret = 0;
2462 2462
2463 mutex_lock(&ctl_mutex); 2463 mutex_lock(&ctl_mutex);
@@ -2796,11 +2796,12 @@ out_mem:
2796 return ret; 2796 return ret;
2797} 2797}
2798 2798
2799static int pkt_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) 2799static int pkt_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd, unsigned long arg)
2800{ 2800{
2801 struct pktcdvd_device *pd = inode->i_bdev->bd_disk->private_data; 2801 struct pktcdvd_device *pd = bdev->bd_disk->private_data;
2802 2802
2803 VPRINTK("pkt_ioctl: cmd %x, dev %d:%d\n", cmd, imajor(inode), iminor(inode)); 2803 VPRINTK("pkt_ioctl: cmd %x, dev %d:%d\n", cmd,
2804 MAJOR(bdev->bd_dev), MINOR(bdev->bd_dev));
2804 2805
2805 switch (cmd) { 2806 switch (cmd) {
2806 case CDROMEJECT: 2807 case CDROMEJECT:
@@ -2819,8 +2820,7 @@ static int pkt_ioctl(struct inode *inode, struct file *file, unsigned int cmd, u
2819 case CDROM_LAST_WRITTEN: 2820 case CDROM_LAST_WRITTEN:
2820 case CDROM_SEND_PACKET: 2821 case CDROM_SEND_PACKET:
2821 case SCSI_IOCTL_SEND_COMMAND: 2822 case SCSI_IOCTL_SEND_COMMAND:
2822 return __blkdev_driver_ioctl(pd->bdev, file ? file->f_mode : 0, 2823 return __blkdev_driver_ioctl(pd->bdev, mode, cmd, arg);
2823 cmd, arg);
2824 2824
2825 default: 2825 default:
2826 VPRINTK(DRIVER_NAME": Unknown ioctl for %s (%x)\n", pd->name, cmd); 2826 VPRINTK(DRIVER_NAME": Unknown ioctl for %s (%x)\n", pd->name, cmd);
@@ -2847,9 +2847,9 @@ static int pkt_media_changed(struct gendisk *disk)
2847 2847
2848static struct block_device_operations pktcdvd_ops = { 2848static struct block_device_operations pktcdvd_ops = {
2849 .owner = THIS_MODULE, 2849 .owner = THIS_MODULE,
2850 .__open = pkt_open, 2850 .open = pkt_open,
2851 .__release = pkt_close, 2851 .release = pkt_close,
2852 .__ioctl = pkt_ioctl, 2852 .locked_ioctl = pkt_ioctl,
2853 .media_changed = pkt_media_changed, 2853 .media_changed = pkt_media_changed,
2854}; 2854};
2855 2855