]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[PATCH] beginning of methods conversion
authorAl Viro <viro@zeniv.linux.org.uk>
Sun, 2 Mar 2008 14:09:22 +0000 (09:09 -0500)
committerAl Viro <viro@zeniv.linux.org.uk>
Tue, 21 Oct 2008 11:47:32 +0000 (07:47 -0400)
To keep the size of changesets sane we split the switch by drivers;
to keep the damn thing bisectable we do the following:
1) rename the affected methods, add ones with correct
prototypes, make (few) callers handle both.  That's this changeset.
2) for each driver convert to new methods.  *ALL* drivers
are converted in this series.
3) kill the old (renamed) methods.

Note that it _is_ a flagday; all in-tree drivers are converted and by the
end of this series no trace of old methods remain.  The only reason why
we do that this way is to keep the damn thing bisectable and allow per-driver
debugging if anything goes wrong.

New methods:
open(bdev, mode)
release(disk, mode)
ioctl(bdev, mode, cmd, arg) /* Called without BKL */
compat_ioctl(bdev, mode, cmd, arg)
locked_ioctl(bdev, mode, cmd, arg) /* Called with BKL, legacy */

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
45 files changed:
arch/um/drivers/ubd_kern.c
block/compat_ioctl.c
block/ioctl.c
drivers/block/DAC960.c
drivers/block/amiflop.c
drivers/block/aoe/aoeblk.c
drivers/block/ataflop.c
drivers/block/brd.c
drivers/block/cciss.c
drivers/block/cpqarray.c
drivers/block/floppy.c
drivers/block/loop.c
drivers/block/nbd.c
drivers/block/paride/pcd.c
drivers/block/paride/pd.c
drivers/block/paride/pf.c
drivers/block/pktcdvd.c
drivers/block/swim3.c
drivers/block/ub.c
drivers/block/viodasd.c
drivers/block/virtio_blk.c
drivers/block/xd.c
drivers/block/xen-blkfront.c
drivers/block/xsysace.c
drivers/block/z2ram.c
drivers/cdrom/gdrom.c
drivers/cdrom/viocd.c
drivers/ide/ide-cd.c
drivers/ide/ide-gd.c
drivers/ide/ide-tape.c
drivers/md/dm.c
drivers/md/md.c
drivers/memstick/core/mspro_block.c
drivers/message/i2o/i2o_block.c
drivers/mmc/card/block.c
drivers/mtd/mtd_blkdevs.c
drivers/s390/block/dasd.c
drivers/s390/block/dcssblk.c
drivers/s390/char/tape_block.c
drivers/scsi/ide-scsi.c
drivers/scsi/sd.c
drivers/scsi/sr.c
fs/block_dev.c
include/linux/blkdev.h
include/linux/fs.h

index b58fb8941d8d7eb4cb27447084332f686dca031a..72569cc3cbb76b874af04f84d080ba102cabc814 100644 (file)
@@ -108,9 +108,9 @@ static int ubd_getgeo(struct block_device *bdev, struct hd_geometry *geo);
 
 static struct block_device_operations ubd_blops = {
         .owner         = THIS_MODULE,
-        .open          = ubd_open,
-        .release       = ubd_release,
-        .ioctl         = ubd_ioctl,
+        .__open                = ubd_open,
+        .__release     = ubd_release,
+        .__ioctl               = ubd_ioctl,
        .getgeo         = ubd_getgeo,
 };
 
index 1e559fba7bdfc58859605b0d9fdc879346f86b07..576c4fd154638b581b2788b0008b7796b9b429c5 100644 (file)
@@ -708,17 +708,17 @@ static int compat_blkdev_driver_ioctl(struct inode *inode, struct file *file,
                return -ENOIOCTLCMD;
        }
 
-       if (disk->fops->unlocked_ioctl)
-               return disk->fops->unlocked_ioctl(file, cmd, arg);
+       if (disk->fops->__unlocked_ioctl)
+               return disk->fops->__unlocked_ioctl(file, cmd, arg);
 
-       if (disk->fops->ioctl) {
+       if (disk->fops->__ioctl) {
                lock_kernel();
-               ret = disk->fops->ioctl(inode, file, cmd, arg);
+               ret = disk->fops->__ioctl(inode, file, cmd, arg);
                unlock_kernel();
                return ret;
        }
 
-       return -ENOTTY;
+       return __blkdev_driver_ioctl(inode->i_bdev, file->f_mode, cmd, arg);
 }
 
 static int compat_blkdev_locked_ioctl(struct inode *inode, struct file *file,
@@ -805,10 +805,11 @@ long compat_blkdev_ioctl(struct file *file, unsigned cmd, unsigned long arg)
 
        lock_kernel();
        ret = compat_blkdev_locked_ioctl(inode, file, bdev, cmd, arg);
-       /* FIXME: why do we assume -> compat_ioctl needs the BKL? */
-       if (ret == -ENOIOCTLCMD && disk->fops->compat_ioctl)
-               ret = disk->fops->compat_ioctl(file, cmd, arg);
+       if (ret == -ENOIOCTLCMD && disk->fops->__compat_ioctl)
+               ret = disk->fops->__compat_ioctl(file, cmd, arg);
        unlock_kernel();
+       if (ret == -ENOIOCTLCMD && disk->fops->compat_ioctl)
+               ret = disk->fops->compat_ioctl(bdev, file->f_mode, cmd, arg);
 
        if (ret != -ENOIOCTLCMD)
                return ret;
index 9a26ace6d04292b26ad4362a4956f7e3fbc01386..01ff463bc801e8b5babd7f1f0b4993d5aeac88a7 100644 (file)
@@ -269,17 +269,24 @@ int blkdev_driver_ioctl(struct inode *inode, struct file *file,
                        struct gendisk *disk, unsigned cmd, unsigned long arg)
 {
        int ret;
-       if (disk->fops->unlocked_ioctl)
-               return disk->fops->unlocked_ioctl(file, cmd, arg);
+       fmode_t mode = 0;
+       if (file) {
+               mode = file->f_mode;
+               if (file->f_flags & O_NDELAY)
+                       mode |= FMODE_NDELAY_NOW;
+       }
+
+       if (disk->fops->__unlocked_ioctl)
+               return disk->fops->__unlocked_ioctl(file, cmd, arg);
 
-       if (disk->fops->ioctl) {
+       if (disk->fops->__ioctl) {
                lock_kernel();
-               ret = disk->fops->ioctl(inode, file, cmd, arg);
+               ret = disk->fops->__ioctl(inode, file, cmd, arg);
                unlock_kernel();
                return ret;
        }
 
-       return -ENOTTY;
+       return __blkdev_driver_ioctl(inode->i_bdev, mode, cmd, arg);
 }
 EXPORT_SYMBOL_GPL(blkdev_driver_ioctl);
 
@@ -295,12 +302,22 @@ int __blkdev_driver_ioctl(struct block_device *bdev, fmode_t mode,
        fake_file.f_path.dentry = &fake_dentry;
        fake_dentry.d_inode = bdev->bd_inode;
 
-       if (disk->fops->unlocked_ioctl)
-               return disk->fops->unlocked_ioctl(&fake_file, cmd, arg);
+       if (disk->fops->__unlocked_ioctl)
+               return disk->fops->__unlocked_ioctl(&fake_file, cmd, arg);
+
+       if (disk->fops->__ioctl) {
+               lock_kernel();
+               ret = disk->fops->__ioctl(bdev->bd_inode, &fake_file, cmd, arg);
+               unlock_kernel();
+               return ret;
+       }
+
+       if (disk->fops->ioctl)
+               return disk->fops->ioctl(bdev, mode, cmd, arg);
 
-       if (disk->fops->ioctl) {
+       if (disk->fops->locked_ioctl) {
                lock_kernel();
-               ret = disk->fops->ioctl(bdev->bd_inode, &fake_file, cmd, arg);
+               ret = disk->fops->locked_ioctl(bdev, mode, cmd, arg);
                unlock_kernel();
                return ret;
        }
index a002a381df921f466b1293574aafb7a4b52e2b6b..4b90ebfa6676f977eddbfc46f81a7f69ed2af40e 100644 (file)
@@ -153,7 +153,7 @@ static int DAC960_revalidate_disk(struct gendisk *disk)
 
 static struct block_device_operations DAC960_BlockDeviceOperations = {
        .owner                  = THIS_MODULE,
-       .open                   = DAC960_open,
+       .__open                 = DAC960_open,
        .getgeo                 = DAC960_getgeo,
        .media_changed          = DAC960_media_changed,
        .revalidate_disk        = DAC960_revalidate_disk,
index d19c5a939fe84e0756aeed8fc041e37e29e754c1..d5da4e3cb2ad98cdab9c5132df8bcb95ea1270f5 100644 (file)
@@ -1648,9 +1648,9 @@ static int amiga_floppy_change(struct gendisk *disk)
 
 static struct block_device_operations floppy_fops = {
        .owner          = THIS_MODULE,
-       .open           = floppy_open,
-       .release        = floppy_release,
-       .ioctl          = fd_ioctl,
+       .__open         = floppy_open,
+       .__release      = floppy_release,
+       .__ioctl                = fd_ioctl,
        .getgeo         = fd_getgeo,
        .media_changed  = amiga_floppy_change,
 };
index d876ad861237d9367abdf3df8ef9606274d0ebfb..d4d9796d5dddc1a95949d3037c5cd2d951755853 100644 (file)
@@ -239,8 +239,8 @@ aoeblk_getgeo(struct block_device *bdev, struct hd_geometry *geo)
 }
 
 static struct block_device_operations aoe_bdops = {
-       .open = aoeblk_open,
-       .release = aoeblk_release,
+       .__open = aoeblk_open,
+       .__release = aoeblk_release,
        .getgeo = aoeblk_getgeo,
        .owner = THIS_MODULE,
 };
index 85d56a26f7c6856dffc57e04d937cef8f3e212da..30166774327da97aca0582abed0f37b0c5720b95 100644 (file)
@@ -1857,9 +1857,9 @@ static int floppy_release( struct inode * inode, struct file * filp )
 
 static struct block_device_operations floppy_fops = {
        .owner          = THIS_MODULE,
-       .open           = floppy_open,
-       .release        = floppy_release,
-       .ioctl          = fd_ioctl,
+       .__open         = floppy_open,
+       .__release      = floppy_release,
+       .__ioctl                = fd_ioctl,
        .media_changed  = check_floppy_change,
        .revalidate_disk= floppy_revalidate,
 };
index d070d492e385b26893e34d514cbda0fa6cb5e34f..2ea99f947667ed9be5e41e9b7bafe75b0883f2f4 100644 (file)
@@ -376,7 +376,7 @@ static int brd_ioctl(struct inode *inode, struct file *file,
 
 static struct block_device_operations brd_fops = {
        .owner =                THIS_MODULE,
-       .ioctl =                brd_ioctl,
+       .__ioctl =              brd_ioctl,
 #ifdef CONFIG_BLK_DEV_XIP
        .direct_access =        brd_direct_access,
 #endif
index d9b1c15b81137c73ab787dcec67dca7de09a65ea..781b745181d2f7666a2edb1dab7c410bbfc79bdb 100644 (file)
@@ -197,12 +197,12 @@ static long cciss_compat_ioctl(struct file *f, unsigned cmd, unsigned long arg);
 
 static struct block_device_operations cciss_fops = {
        .owner = THIS_MODULE,
-       .open = cciss_open,
-       .release = cciss_release,
-       .ioctl = cciss_ioctl,
+       .__open = cciss_open,
+       .__release = cciss_release,
+       .__ioctl = cciss_ioctl,
        .getgeo = cciss_getgeo,
 #ifdef CONFIG_COMPAT
-       .compat_ioctl = cciss_compat_ioctl,
+       .__compat_ioctl = cciss_compat_ioctl,
 #endif
        .revalidate_disk = cciss_revalidate,
 };
index 3d967525e9a96f0bfafcb7aa1d95a9e9e42b4fc8..b71334b968b68250f4fee5e6f85f3260bbc072e2 100644 (file)
@@ -195,9 +195,9 @@ static inline ctlr_info_t *get_host(struct gendisk *disk)
 
 static struct block_device_operations ida_fops  = {
        .owner          = THIS_MODULE,
-       .open           = ida_open,
-       .release        = ida_release,
-       .ioctl          = ida_ioctl,
+       .__open         = ida_open,
+       .__release      = ida_release,
+       .__ioctl                = ida_ioctl,
        .getgeo         = ida_getgeo,
        .revalidate_disk= ida_revalidate,
 };
index 5d60c05a736a3821e5a8863e44c3e68ad7b49e75..72363df5895332f36bd487821046b8cde59d5568 100644 (file)
@@ -3902,9 +3902,9 @@ static int floppy_revalidate(struct gendisk *disk)
 
 static struct block_device_operations floppy_fops = {
        .owner                  = THIS_MODULE,
-       .open                   = floppy_open,
-       .release                = floppy_release,
-       .ioctl                  = fd_ioctl,
+       .__open                 = floppy_open,
+       .__release              = floppy_release,
+       .__ioctl                        = fd_ioctl,
        .getgeo                 = fd_getgeo,
        .media_changed          = check_floppy_change,
        .revalidate_disk        = floppy_revalidate,
index d3a25b027ff9fc5e6331372a252b5e134b6270c4..6faca2b7ae379e14d0ca31579b3ff7b774d9e356 100644 (file)
@@ -1355,11 +1355,11 @@ static int lo_release(struct inode *inode, struct file *file)
 
 static struct block_device_operations lo_fops = {
        .owner =        THIS_MODULE,
-       .open =         lo_open,
-       .release =      lo_release,
-       .ioctl =        lo_ioctl,
+       .__open =               lo_open,
+       .__release =    lo_release,
+       .__ioctl =      lo_ioctl,
 #ifdef CONFIG_COMPAT
-       .compat_ioctl = lo_compat_ioctl,
+       .__compat_ioctl =       lo_compat_ioctl,
 #endif
 };
 
index 9034ca585afd710d6425d53f7b6357c13357a6af..36015e0945b1a0fdf95c21f137a59e573d7a6f03 100644 (file)
@@ -691,7 +691,7 @@ static int nbd_ioctl(struct inode *inode, struct file *file,
 static struct block_device_operations nbd_fops =
 {
        .owner =        THIS_MODULE,
-       .ioctl =        nbd_ioctl,
+       .__ioctl =      nbd_ioctl,
 };
 
 /*
index 8bd557e2a65999a693771674f197ef73c8972feb..6e6dcc1d4328820f2197df89647e4b010ea0b6fc 100644 (file)
@@ -252,9 +252,9 @@ static int pcd_block_media_changed(struct gendisk *disk)
 
 static struct block_device_operations pcd_bdops = {
        .owner          = THIS_MODULE,
-       .open           = pcd_block_open,
-       .release        = pcd_block_release,
-       .ioctl          = pcd_block_ioctl,
+       .__open         = pcd_block_open,
+       .__release      = pcd_block_release,
+       .__ioctl                = pcd_block_ioctl,
        .media_changed  = pcd_block_media_changed,
 };
 
index 5fdfa7c888cebc98aacc9873a9f7216f79c3a1f5..b3023844947c8807476dbbd706fb68c3675e9861 100644 (file)
@@ -807,9 +807,9 @@ static int pd_revalidate(struct gendisk *p)
 
 static struct block_device_operations pd_fops = {
        .owner          = THIS_MODULE,
-       .open           = pd_open,
-       .release        = pd_release,
-       .ioctl          = pd_ioctl,
+       .__open         = pd_open,
+       .__release      = pd_release,
+       .__ioctl                = pd_ioctl,
        .getgeo         = pd_getgeo,
        .media_changed  = pd_check_media,
        .revalidate_disk= pd_revalidate
index a902d84fd33083f6ed6651bfee616340ecf1a533..e08ca5161ad87fa2909e1b7803a6577aee817ca4 100644 (file)
@@ -264,9 +264,9 @@ static char *pf_buf;                /* buffer for request in progress */
 
 static struct block_device_operations pf_fops = {
        .owner          = THIS_MODULE,
-       .open           = pf_open,
-       .release        = pf_release,
-       .ioctl          = pf_ioctl,
+       .__open         = pf_open,
+       .__release      = pf_release,
+       .__ioctl                = pf_ioctl,
        .getgeo         = pf_getgeo,
        .media_changed  = pf_check_media,
 };
index a0ba4023953b3ee075378d9495e6982a5523ba9c..33ac8ddf4912f319316232942aa161519b6d7690 100644 (file)
@@ -2847,9 +2847,9 @@ static int pkt_media_changed(struct gendisk *disk)
 
 static struct block_device_operations pktcdvd_ops = {
        .owner =                THIS_MODULE,
-       .open =                 pkt_open,
-       .release =              pkt_close,
-       .ioctl =                pkt_ioctl,
+       .__open =                       pkt_open,
+       .__release =            pkt_close,
+       .__ioctl =              pkt_ioctl,
        .media_changed =        pkt_media_changed,
 };
 
index 5c45d5556ae8c88480a956d6615ee102c8862c48..9398af86a7aa6de06154bfe31e7f51eeb8db0add 100644 (file)
@@ -998,9 +998,9 @@ static int floppy_revalidate(struct gendisk *disk)
 }
 
 static struct block_device_operations floppy_fops = {
-       .open           = floppy_open,
-       .release        = floppy_release,
-       .ioctl          = floppy_ioctl,
+       .__open         = floppy_open,
+       .__release      = floppy_release,
+       .__ioctl                = floppy_ioctl,
        .media_changed  = floppy_check_change,
        .revalidate_disk= floppy_revalidate,
 };
index bc04330f3683ebf4748abc7dd13c9651fc389473..5261773407dac39e9d5e840dc889975e15d1ec44 100644 (file)
@@ -1791,9 +1791,9 @@ static int ub_bd_media_changed(struct gendisk *disk)
 
 static struct block_device_operations ub_bd_fops = {
        .owner          = THIS_MODULE,
-       .open           = ub_bd_open,
-       .release        = ub_bd_release,
-       .ioctl          = ub_bd_ioctl,
+       .__open         = ub_bd_open,
+       .__release      = ub_bd_release,
+       .__ioctl                = ub_bd_ioctl,
        .media_changed  = ub_bd_media_changed,
        .revalidate_disk = ub_bd_revalidate,
 };
index 1730d29e6044039d12a2da60ebfdf23ea225d0ef..7f7beec29ebbcc3c38b51ac13b5ca3ec0a59da86 100644 (file)
@@ -221,8 +221,8 @@ static int viodasd_getgeo(struct block_device *bdev, struct hd_geometry *geo)
  */
 static struct block_device_operations viodasd_fops = {
        .owner = THIS_MODULE,
-       .open = viodasd_open,
-       .release = viodasd_release,
+       .__open = viodasd_open,
+       .__release = viodasd_release,
        .getgeo = viodasd_getgeo,
 };
 
index 7643cd16fd67fb8495b08fc75aeccf1880ce0dd4..10f157ea7b0b87b09518d1ace4945c7757da99b5 100644 (file)
@@ -180,7 +180,7 @@ static int virtblk_getgeo(struct block_device *bd, struct hd_geometry *geo)
 }
 
 static struct block_device_operations virtblk_fops = {
-       .ioctl  = virtblk_ioctl,
+       .__ioctl  = virtblk_ioctl,
        .owner  = THIS_MODULE,
        .getgeo = virtblk_getgeo,
 };
index 624d30f7da3fc0ba125de8c46b5f9ec8d1f4efc8..316fa1da4b9c90bd2bdf785ba1926051a4c6c9ad 100644 (file)
@@ -132,7 +132,7 @@ static int xd_getgeo(struct block_device *bdev, struct hd_geometry *geo);
 
 static struct block_device_operations xd_fops = {
        .owner  = THIS_MODULE,
-       .ioctl  = xd_ioctl,
+       .__ioctl        = xd_ioctl,
        .getgeo = xd_getgeo,
 };
 static DECLARE_WAIT_QUEUE_HEAD(xd_wait_int);
index 1a50ae70f716a28d2ca2146196fa4fc60f7e1f1a..7efac80c8dde3a0ed2cd69a1831a081e9236902f 100644 (file)
@@ -1041,8 +1041,8 @@ static int blkif_release(struct inode *inode, struct file *filep)
 static struct block_device_operations xlvbd_block_fops =
 {
        .owner = THIS_MODULE,
-       .open = blkif_open,
-       .release = blkif_release,
+       .__open = blkif_open,
+       .__release = blkif_release,
        .getgeo = blkif_getgeo,
        .ioctl = blkif_ioctl,
 };
index 4a7a059ebaf70b83f564430883ad517966c635de..e4efe5b7ec229306605b84b65c786bc9a7ea35fe 100644 (file)
@@ -919,8 +919,8 @@ static int ace_getgeo(struct block_device *bdev, struct hd_geometry *geo)
 
 static struct block_device_operations ace_fops = {
        .owner = THIS_MODULE,
-       .open = ace_open,
-       .release = ace_release,
+       .__open = ace_open,
+       .__release = ace_release,
        .media_changed = ace_media_changed,
        .revalidate_disk = ace_revalidate_disk,
        .getgeo = ace_getgeo,
index be20a67f1fa8c78397be751954a1d225e511af77..4860d0f36870bd8c256de5bfc5d2345e75153e90 100644 (file)
@@ -314,8 +314,8 @@ z2_release( struct inode *inode, struct file *filp )
 static struct block_device_operations z2_fops =
 {
        .owner          = THIS_MODULE,
-       .open           = z2_open,
-       .release        = z2_release,
+       .__open         = z2_open,
+       .__release      = z2_release,
 };
 
 static struct kobject *z2_find(dev_t dev, int *part, void *data)
index 0959edf2afdbae939bd0df1e99d3ffe4681bc2ea..ab0c637f58be3ba24203bbb0315f74c2e8a46833 100644 (file)
@@ -514,10 +514,10 @@ static int gdrom_bdops_ioctl(struct inode *inode, struct file *file,
 
 static struct block_device_operations gdrom_bdops = {
        .owner                  = THIS_MODULE,
-       .open                   = gdrom_bdops_open,
-       .release                = gdrom_bdops_release,
+       .__open                 = gdrom_bdops_open,
+       .__release              = gdrom_bdops_release,
        .media_changed          = gdrom_bdops_mediachanged,
-       .ioctl                  = gdrom_bdops_ioctl,
+       .__ioctl                        = gdrom_bdops_ioctl,
 };
 
 static irqreturn_t gdrom_command_interrupt(int irq, void *dev_id)
index abc4079c3f419c9a0455008a0ba36816b3bb204e..57c2dced3e9d0ec1438af11d74b8295c6f294bb0 100644 (file)
@@ -180,9 +180,9 @@ static int viocd_blk_media_changed(struct gendisk *disk)
 
 struct block_device_operations viocd_fops = {
        .owner =                THIS_MODULE,
-       .open =                 viocd_blk_open,
-       .release =              viocd_blk_release,
-       .ioctl =                viocd_blk_ioctl,
+       .__open =                       viocd_blk_open,
+       .__release =            viocd_blk_release,
+       .__ioctl =              viocd_blk_ioctl,
        .media_changed =        viocd_blk_media_changed,
 };
 
index 87d90200b16997d4d1448f01cf9859dd28141aa6..3533984355a6c29dde6b02df033549342f8bca4c 100644 (file)
@@ -2200,9 +2200,9 @@ static int idecd_revalidate_disk(struct gendisk *disk)
 
 static struct block_device_operations idecd_ops = {
        .owner                  = THIS_MODULE,
-       .open                   = idecd_open,
-       .release                = idecd_release,
-       .ioctl                  = idecd_ioctl,
+       .__open                 = idecd_open,
+       .__release              = idecd_release,
+       .__ioctl                        = idecd_ioctl,
        .media_changed          = idecd_media_changed,
        .revalidate_disk        = idecd_revalidate_disk
 };
index 948af08abe2359d846c68f16d279cd294343f8bf..d118bbed7cd3fe7ce2d16edaf94072cd6df45cea 100644 (file)
@@ -298,9 +298,9 @@ static int ide_gd_ioctl(struct inode *inode, struct file *file,
 
 static struct block_device_operations ide_gd_ops = {
        .owner                  = THIS_MODULE,
-       .open                   = ide_gd_open,
-       .release                = ide_gd_release,
-       .ioctl                  = ide_gd_ioctl,
+       .__open                 = ide_gd_open,
+       .__release              = ide_gd_release,
+       .__ioctl                        = ide_gd_ioctl,
        .getgeo                 = ide_gd_getgeo,
        .media_changed          = ide_gd_media_changed,
        .revalidate_disk        = ide_gd_revalidate_disk
index 2b263281ffea93d725ab350d8b023c3633d5d9f5..c5df53c4838c30962c9f7000ded36e50afec902c 100644 (file)
@@ -2376,9 +2376,9 @@ static int idetape_ioctl(struct inode *inode, struct file *file,
 
 static struct block_device_operations idetape_block_ops = {
        .owner          = THIS_MODULE,
-       .open           = idetape_open,
-       .release        = idetape_release,
-       .ioctl          = idetape_ioctl,
+       .__open         = idetape_open,
+       .__release      = idetape_release,
+       .__ioctl                = idetape_ioctl,
 };
 
 static int ide_tape_probe(ide_drive_t *drive)
index 5f0f4c8bcd3e399042c1b6feb6102e9f62cf86cc..8b4c92b1b6db87f8d9d04f39d0e2c0e32ee19a1d 100644 (file)
@@ -1698,9 +1698,9 @@ int dm_noflush_suspending(struct dm_target *ti)
 EXPORT_SYMBOL_GPL(dm_noflush_suspending);
 
 static struct block_device_operations dm_blk_dops = {
-       .open = dm_blk_open,
-       .release = dm_blk_close,
-       .ioctl = dm_blk_ioctl,
+       .__open = dm_blk_open,
+       .__release = dm_blk_close,
+       .__ioctl = dm_blk_ioctl,
        .getgeo = dm_blk_getgeo,
        .owner = THIS_MODULE
 };
index aaa3d465de4ece202bd3a18c1c605248ebd40ad7..21b04d39ba3b16376dd76568ab37095866db579f 100644 (file)
@@ -5046,9 +5046,9 @@ static int md_revalidate(struct gendisk *disk)
 static struct block_device_operations md_fops =
 {
        .owner          = THIS_MODULE,
-       .open           = md_open,
-       .release        = md_release,
-       .ioctl          = md_ioctl,
+       .__open         = md_open,
+       .__release      = md_release,
+       .__ioctl                = md_ioctl,
        .getgeo         = md_getgeo,
        .media_changed  = md_media_changed,
        .revalidate_disk= md_revalidate,
index 5263913e0c69e8935add96731944373ee968f01d..fbe5919789d0e3143f0722fd4667bf1d1b264fce 100644 (file)
@@ -237,8 +237,8 @@ static int mspro_block_bd_getgeo(struct block_device *bdev,
 }
 
 static struct block_device_operations ms_block_bdops = {
-       .open    = mspro_block_bd_open,
-       .release = mspro_block_bd_release,
+       .__open    = mspro_block_bd_open,
+       .__release = mspro_block_bd_release,
        .getgeo  = mspro_block_bd_getgeo,
        .owner   = THIS_MODULE
 };
index 81483de8c0fdfeae0262dc745a1147ca5c28f966..71500dda8eb37cfbccd18b1a795acb6f7483c266 100644 (file)
@@ -931,9 +931,9 @@ static void i2o_block_request_fn(struct request_queue *q)
 /* I2O Block device operations definition */
 static struct block_device_operations i2o_block_fops = {
        .owner = THIS_MODULE,
-       .open = i2o_block_open,
-       .release = i2o_block_release,
-       .ioctl = i2o_block_ioctl,
+       .__open = i2o_block_open,
+       .__release = i2o_block_release,
+       .__ioctl = i2o_block_ioctl,
        .getgeo = i2o_block_getgeo,
        .media_changed = i2o_block_media_changed
 };
index 24c97d3d16bba43ab963d9b514ee27fbe938ddcc..8cba06f5e11dfd714dafa170db06d9329b013bce 100644 (file)
@@ -130,8 +130,8 @@ mmc_blk_getgeo(struct block_device *bdev, struct hd_geometry *geo)
 }
 
 static struct block_device_operations mmc_bdops = {
-       .open                   = mmc_blk_open,
-       .release                = mmc_blk_release,
+       .__open                 = mmc_blk_open,
+       .__release              = mmc_blk_release,
        .getgeo                 = mmc_blk_getgeo,
        .owner                  = THIS_MODULE,
 };
index 681d5aca2af436630fda1d5124d8a3d6a1e70ce4..b00d07c537537961c7ac7f06da0f0d39a3216d20 100644 (file)
@@ -213,9 +213,9 @@ static int blktrans_ioctl(struct inode *inode, struct file *file,
 
 static struct block_device_operations mtd_blktrans_ops = {
        .owner          = THIS_MODULE,
-       .open           = blktrans_open,
-       .release        = blktrans_release,
-       .ioctl          = blktrans_ioctl,
+       .__open         = blktrans_open,
+       .__release      = blktrans_release,
+       .__ioctl                = blktrans_ioctl,
        .getgeo         = blktrans_getgeo,
 };
 
index 0a225ccda026017773e1a619fc07c651c7223aef..6bf68e5fe89f81db95292cbc6fade87707831038 100644 (file)
@@ -2087,10 +2087,10 @@ static int dasd_getgeo(struct block_device *bdev, struct hd_geometry *geo)
 struct block_device_operations
 dasd_device_operations = {
        .owner          = THIS_MODULE,
-       .open           = dasd_open,
-       .release        = dasd_release,
-       .ioctl          = dasd_ioctl,
-       .compat_ioctl   = dasd_compat_ioctl,
+       .__open         = dasd_open,
+       .__release      = dasd_release,
+       .__ioctl                = dasd_ioctl,
+       .__compat_ioctl = dasd_compat_ioctl,
        .getgeo         = dasd_getgeo,
 };
 
index a7ff167d5b81089c781a3f3c9aa9e736cc8da48e..413460cc3dd83e19587149ede768a082dec77645 100644 (file)
@@ -42,8 +42,8 @@ static char dcssblk_segments[DCSSBLK_PARM_LEN] = "\0";
 static int dcssblk_major;
 static struct block_device_operations dcssblk_devops = {
        .owner          = THIS_MODULE,
-       .open           = dcssblk_open,
-       .release        = dcssblk_release,
+       .__open         = dcssblk_open,
+       .__release      = dcssblk_release,
        .direct_access  = dcssblk_direct_access,
 };
 
index a25b8bf54f418103ef4dca4da08dd13e1e9d6513..f1a741c9a6f06b379db17ee07f9d61b9fb1c37e3 100644 (file)
@@ -52,9 +52,9 @@ static int tapeblock_revalidate_disk(struct gendisk *);
 
 static struct block_device_operations tapeblock_fops = {
        .owner           = THIS_MODULE,
-       .open            = tapeblock_open,
-       .release         = tapeblock_release,
-       .ioctl           = tapeblock_ioctl,
+       .__open          = tapeblock_open,
+       .__release       = tapeblock_release,
+       .__ioctl           = tapeblock_ioctl,
        .media_changed   = tapeblock_medium_changed,
        .revalidate_disk = tapeblock_revalidate_disk,
 };
index 5bcc04e82c28e46586b5b5506c7b6c427327b6cc..9069afbad9d34c1e15110a759f5265c0c7e7fc68 100644 (file)
@@ -483,9 +483,9 @@ static int idescsi_ide_ioctl(struct inode *inode, struct file *file,
 
 static struct block_device_operations idescsi_ops = {
        .owner          = THIS_MODULE,
-       .open           = idescsi_ide_open,
-       .release        = idescsi_ide_release,
-       .ioctl          = idescsi_ide_ioctl,
+       .__open         = idescsi_ide_open,
+       .__release      = idescsi_ide_release,
+       .__ioctl                = idescsi_ide_ioctl,
 };
 
 static int idescsi_slave_configure(struct scsi_device * sdp)
index 5a18528a69d0b0f970f25d41caa59c8a053d6f00..c8b95e8d2859163aeea032663235d70236f61ed2 100644 (file)
@@ -962,12 +962,12 @@ static long sd_compat_ioctl(struct file *file, unsigned int cmd, unsigned long a
 
 static struct block_device_operations sd_fops = {
        .owner                  = THIS_MODULE,
-       .open                   = sd_open,
-       .release                = sd_release,
-       .ioctl                  = sd_ioctl,
+       .__open                 = sd_open,
+       .__release              = sd_release,
+       .__ioctl                        = sd_ioctl,
        .getgeo                 = sd_getgeo,
 #ifdef CONFIG_COMPAT
-       .compat_ioctl           = sd_compat_ioctl,
+       .__compat_ioctl         = sd_compat_ioctl,
 #endif
        .media_changed          = sd_media_changed,
        .revalidate_disk        = sd_revalidate_disk,
index 2fb8d4d2d6f660b1790a9f6d856b6f2987d030e1..9446cbf4de84dbbf52d9c25d673e91a86d10ee53 100644 (file)
@@ -540,9 +540,9 @@ static int sr_block_media_changed(struct gendisk *disk)
 static struct block_device_operations sr_bdops =
 {
        .owner          = THIS_MODULE,
-       .open           = sr_block_open,
-       .release        = sr_block_release,
-       .ioctl          = sr_block_ioctl,
+       .__open         = sr_block_open,
+       .__release      = sr_block_release,
+       .__ioctl                = sr_block_ioctl,
        .media_changed  = sr_block_media_changed,
        /* 
         * No compat_ioctl for now because sr_block_ioctl never
index b9022694e9f7bc68bd8760db8c7b7bd63f84d796..73b6ce47c861142e7da5d1a5206fced73f7bb53d 100644 (file)
@@ -1033,8 +1033,13 @@ static int do_open(struct block_device *bdev, struct file *file, int for_part)
                bdev->bd_contains = bdev;
                if (!partno) {
                        struct backing_dev_info *bdi;
+                       if (disk->fops->__open) {
+                               ret = disk->fops->__open(bdev->bd_inode, file);
+                               if (ret)
+                                       goto out_first;
+                       }
                        if (disk->fops->open) {
-                               ret = disk->fops->open(bdev->bd_inode, file);
+                               ret = disk->fops->open(bdev, file->f_mode);
                                if (ret)
                                        goto out_clear;
                        }
@@ -1074,8 +1079,13 @@ static int do_open(struct block_device *bdev, struct file *file, int for_part)
                part = NULL;
                disk = NULL;
                if (bdev->bd_contains == bdev) {
+                       if (bdev->bd_disk->fops->__open) {
+                               ret = bdev->bd_disk->fops->__open(bdev->bd_inode, file);
+                               if (ret)
+                                       goto out;
+                       }
                        if (bdev->bd_disk->fops->open) {
-                               ret = bdev->bd_disk->fops->open(bdev->bd_inode, file);
+                               ret = bdev->bd_disk->fops->open(bdev, file->f_mode);
                                if (ret)
                                        goto out_unlock_bdev;
                        }
@@ -1184,8 +1194,10 @@ static int __blkdev_put(struct block_device *bdev, int for_part)
                kill_bdev(bdev);
        }
        if (bdev->bd_contains == bdev) {
+               if (disk->fops->__release)
+                       ret = disk->fops->__release(bd_inode, NULL);
                if (disk->fops->release)
-                       ret = disk->fops->release(bd_inode, NULL);
+                       ret = disk->fops->release(disk, 0);
        }
        if (!bdev->bd_openers) {
                struct module *owner = disk->fops->owner;
index 2bad616b9949dbd02ab8227fcb8cb37353d3bb3b..b573186ff1a1bd4b8b4bd627c5238e956698858d 100644 (file)
@@ -1061,11 +1061,16 @@ struct file;
 struct inode;
 
 struct block_device_operations {
-       int (*open) (struct inode *, struct file *);
-       int (*release) (struct inode *, struct file *);
-       int (*ioctl) (struct inode *, struct file *, unsigned, unsigned long);
-       long (*unlocked_ioctl) (struct file *, unsigned, unsigned long);
-       long (*compat_ioctl) (struct file *, unsigned, unsigned long);
+       int (*__open) (struct inode *, struct file *);
+       int (*__release) (struct inode *, struct file *);
+       int (*__ioctl) (struct inode *, struct file *, unsigned, unsigned long);
+       long (*__unlocked_ioctl) (struct file *, unsigned, unsigned long);
+       long (*__compat_ioctl) (struct file *, unsigned, unsigned long);
+       int (*open) (struct block_device *, fmode_t);
+       int (*release) (struct gendisk *, fmode_t);
+       int (*locked_ioctl) (struct block_device *, fmode_t, unsigned, unsigned long);
+       int (*ioctl) (struct block_device *, fmode_t, unsigned, unsigned long);
+       int (*compat_ioctl) (struct block_device *, fmode_t, unsigned, unsigned long);
        int (*direct_access) (struct block_device *, sector_t,
                                                void **, unsigned long *);
        int (*media_changed) (struct gendisk *);
index 58bbf689fef7c876d86095b91ae3b68418c8769f..b5894604ba5ee5a949cef0bdc8efb6bccae1d5a9 100644 (file)
@@ -79,6 +79,7 @@ extern int dir_notify_enable;
 #define FMODE_NDELAY   ((__force fmode_t)32)
 #define FMODE_EXCL     ((__force fmode_t)64)
 #define FMODE_WRITE_IOCTL      ((__force fmode_t)128)
+#define FMODE_NDELAY_NOW       ((__force fmode_t)256)
 
 #define RW_MASK                1
 #define RWA_MASK       2