diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2008-03-02 10:21:43 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2008-10-21 07:48:05 -0400 |
commit | 4099a96693ab58a95b3ecf19704973cd0f1bdf9d (patch) | |
tree | bd0e357291c1b4e8b1d083d680c3d997a19b9e14 /drivers/block/ub.c | |
parent | b4d9a4425bde774ab30f0f43da60bb4ed3508903 (diff) |
[PATCH] switch ub
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'drivers/block/ub.c')
-rw-r--r-- | drivers/block/ub.c | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/drivers/block/ub.c b/drivers/block/ub.c index 5261773407da..fccac18d3111 100644 --- a/drivers/block/ub.c +++ b/drivers/block/ub.c | |||
@@ -1667,10 +1667,9 @@ static void ub_revalidate(struct ub_dev *sc, struct ub_lun *lun) | |||
1667 | * This is mostly needed to keep refcounting, but also to support | 1667 | * This is mostly needed to keep refcounting, but also to support |
1668 | * media checks on removable media drives. | 1668 | * media checks on removable media drives. |
1669 | */ | 1669 | */ |
1670 | static int ub_bd_open(struct inode *inode, struct file *filp) | 1670 | static int ub_bd_open(struct block_device *bdev, fmode_t mode) |
1671 | { | 1671 | { |
1672 | struct gendisk *disk = inode->i_bdev->bd_disk; | 1672 | struct ub_lun *lun = bdev->bd_disk->private_data; |
1673 | struct ub_lun *lun = disk->private_data; | ||
1674 | struct ub_dev *sc = lun->udev; | 1673 | struct ub_dev *sc = lun->udev; |
1675 | unsigned long flags; | 1674 | unsigned long flags; |
1676 | int rc; | 1675 | int rc; |
@@ -1684,19 +1683,19 @@ static int ub_bd_open(struct inode *inode, struct file *filp) | |||
1684 | spin_unlock_irqrestore(&ub_lock, flags); | 1683 | spin_unlock_irqrestore(&ub_lock, flags); |
1685 | 1684 | ||
1686 | if (lun->removable || lun->readonly) | 1685 | if (lun->removable || lun->readonly) |
1687 | check_disk_change(inode->i_bdev); | 1686 | check_disk_change(bdev); |
1688 | 1687 | ||
1689 | /* | 1688 | /* |
1690 | * The sd.c considers ->media_present and ->changed not equivalent, | 1689 | * The sd.c considers ->media_present and ->changed not equivalent, |
1691 | * under some pretty murky conditions (a failure of READ CAPACITY). | 1690 | * under some pretty murky conditions (a failure of READ CAPACITY). |
1692 | * We may need it one day. | 1691 | * We may need it one day. |
1693 | */ | 1692 | */ |
1694 | if (lun->removable && lun->changed && !(filp->f_mode & FMODE_NDELAY)) { | 1693 | if (lun->removable && lun->changed && !(mode & FMODE_NDELAY)) { |
1695 | rc = -ENOMEDIUM; | 1694 | rc = -ENOMEDIUM; |
1696 | goto err_open; | 1695 | goto err_open; |
1697 | } | 1696 | } |
1698 | 1697 | ||
1699 | if (lun->readonly && (filp->f_mode & FMODE_WRITE)) { | 1698 | if (lun->readonly && (mode & FMODE_WRITE)) { |
1700 | rc = -EROFS; | 1699 | rc = -EROFS; |
1701 | goto err_open; | 1700 | goto err_open; |
1702 | } | 1701 | } |
@@ -1710,9 +1709,8 @@ err_open: | |||
1710 | 1709 | ||
1711 | /* | 1710 | /* |
1712 | */ | 1711 | */ |
1713 | static int ub_bd_release(struct inode *inode, struct file *filp) | 1712 | static int ub_bd_release(struct gendisk *disk, fmode_t mode) |
1714 | { | 1713 | { |
1715 | struct gendisk *disk = inode->i_bdev->bd_disk; | ||
1716 | struct ub_lun *lun = disk->private_data; | 1714 | struct ub_lun *lun = disk->private_data; |
1717 | struct ub_dev *sc = lun->udev; | 1715 | struct ub_dev *sc = lun->udev; |
1718 | 1716 | ||
@@ -1723,13 +1721,13 @@ static int ub_bd_release(struct inode *inode, struct file *filp) | |||
1723 | /* | 1721 | /* |
1724 | * The ioctl interface. | 1722 | * The ioctl interface. |
1725 | */ | 1723 | */ |
1726 | static int ub_bd_ioctl(struct inode *inode, struct file *filp, | 1724 | static int ub_bd_ioctl(struct block_device *bdev, fmode_t mode, |
1727 | unsigned int cmd, unsigned long arg) | 1725 | unsigned int cmd, unsigned long arg) |
1728 | { | 1726 | { |
1729 | struct gendisk *disk = inode->i_bdev->bd_disk; | 1727 | struct gendisk *disk = bdev->bd_disk; |
1730 | void __user *usermem = (void __user *) arg; | 1728 | void __user *usermem = (void __user *) arg; |
1731 | 1729 | ||
1732 | return scsi_cmd_ioctl(disk->queue, disk, filp ? filp->f_mode : 0, cmd, usermem); | 1730 | return scsi_cmd_ioctl(disk->queue, disk, mode, cmd, usermem); |
1733 | } | 1731 | } |
1734 | 1732 | ||
1735 | /* | 1733 | /* |
@@ -1791,9 +1789,9 @@ static int ub_bd_media_changed(struct gendisk *disk) | |||
1791 | 1789 | ||
1792 | static struct block_device_operations ub_bd_fops = { | 1790 | static struct block_device_operations ub_bd_fops = { |
1793 | .owner = THIS_MODULE, | 1791 | .owner = THIS_MODULE, |
1794 | .__open = ub_bd_open, | 1792 | .open = ub_bd_open, |
1795 | .__release = ub_bd_release, | 1793 | .release = ub_bd_release, |
1796 | .__ioctl = ub_bd_ioctl, | 1794 | .locked_ioctl = ub_bd_ioctl, |
1797 | .media_changed = ub_bd_media_changed, | 1795 | .media_changed = ub_bd_media_changed, |
1798 | .revalidate_disk = ub_bd_revalidate, | 1796 | .revalidate_disk = ub_bd_revalidate, |
1799 | }; | 1797 | }; |