Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 117505
b: refs/heads/master
c: d4430d6
h: refs/heads/master
i:
  117503: 5c62248
v: v3
  • Loading branch information
Al Viro committed Oct 21, 2008
1 parent a50ac3f commit 7722403
Show file tree
Hide file tree
Showing 46 changed files with 168 additions and 132 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: badf8082c33d18b118d3a6f1b32d5ea6b97d3839
refs/heads/master: d4430d62fa77208824a37fe6f85ab2831d274769
6 changes: 3 additions & 3 deletions trunk/arch/um/drivers/ubd_kern.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};

Expand Down
17 changes: 9 additions & 8 deletions trunk/block/compat_ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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;
Expand Down
35 changes: 26 additions & 9 deletions trunk/block/ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/block/DAC960.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions trunk/drivers/block/amiflop.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down
4 changes: 2 additions & 2 deletions trunk/drivers/block/aoe/aoeblk.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down
6 changes: 3 additions & 3 deletions trunk/drivers/block/ataflop.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/block/brd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions trunk/drivers/block/cciss.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down
6 changes: 3 additions & 3 deletions trunk/drivers/block/cpqarray.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down
6 changes: 3 additions & 3 deletions trunk/drivers/block/floppy.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
8 changes: 4 additions & 4 deletions trunk/drivers/block/loop.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
};

Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/block/nbd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};

/*
Expand Down
6 changes: 3 additions & 3 deletions trunk/drivers/block/paride/pcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};

Expand Down
6 changes: 3 additions & 3 deletions trunk/drivers/block/paride/pd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions trunk/drivers/block/paride/pf.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down
6 changes: 3 additions & 3 deletions trunk/drivers/block/pktcdvd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};

Expand Down
6 changes: 3 additions & 3 deletions trunk/drivers/block/swim3.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down
6 changes: 3 additions & 3 deletions trunk/drivers/block/ub.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down
4 changes: 2 additions & 2 deletions trunk/drivers/block/viodasd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};

Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/block/virtio_blk.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/block/xd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions trunk/drivers/block/xen-blkfront.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down
4 changes: 2 additions & 2 deletions trunk/drivers/block/xsysace.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions trunk/drivers/block/z2ram.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions trunk/drivers/cdrom/gdrom.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Loading

0 comments on commit 7722403

Please sign in to comment.