mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-08-18 02:22:47 -07:00
Merge git://git.kernel.org/pub/scm/linux/kernel/git/viro/bdev
* git://git.kernel.org/pub/scm/linux/kernel/git/viro/bdev: (66 commits) [PATCH] kill the rest of struct file propagation in block ioctls [PATCH] get rid of struct file use in blkdev_ioctl() BLKBSZSET [PATCH] get rid of blkdev_locked_ioctl() [PATCH] get rid of blkdev_driver_ioctl() [PATCH] sanitize blkdev_get() and friends [PATCH] remember mode of reiserfs journal [PATCH] propagate mode through swsusp_close() [PATCH] propagate mode through open_bdev_excl/close_bdev_excl [PATCH] pass fmode_t to blkdev_put() [PATCH] kill the unused bsize on the send side of /dev/loop [PATCH] trim file propagation in block/compat_ioctl.c [PATCH] end of methods switch: remove the old ones [PATCH] switch sr [PATCH] switch sd [PATCH] switch ide-scsi [PATCH] switch tape_block [PATCH] switch dcssblk [PATCH] switch dasd [PATCH] switch mtd_blkdevs [PATCH] switch mmc ...
This commit is contained in:
commit
2248485640
107 files changed
+868
-1002
No files matched your search
@@ -98,9 +98,9 @@ static inline void ubd_set_bit(__u64 bit, unsigned char *data)
|
||||
|
||||
static DEFINE_MUTEX(ubd_lock);
|
||||
|
||||
static int ubd_open(struct inode * inode, struct file * filp);
|
||||
static int ubd_release(struct inode * inode, struct file * file);
|
||||
static int ubd_ioctl(struct inode * inode, struct file * file,
|
||||
static int ubd_open(struct block_device *bdev, fmode_t mode);
|
||||
static int ubd_release(struct gendisk *disk, fmode_t mode);
|
||||
static int ubd_ioctl(struct block_device *bdev, fmode_t mode,
|
||||
unsigned int cmd, unsigned long arg);
|
||||
static int ubd_getgeo(struct block_device *bdev, struct hd_geometry *geo);
|
||||
|
||||
@@ -1112,9 +1112,9 @@ static int __init ubd_driver_init(void){
|
||||
|
||||
device_initcall(ubd_driver_init);
|
||||
|
||||
static int ubd_open(struct inode *inode, struct file *filp)
|
||||
static int ubd_open(struct block_device *bdev, fmode_t mode)
|
||||
{
|
||||
struct gendisk *disk = inode->i_bdev->bd_disk;
|
||||
struct gendisk *disk = bdev->bd_disk;
|
||||
struct ubd *ubd_dev = disk->private_data;
|
||||
int err = 0;
|
||||
|
||||
@@ -1131,7 +1131,7 @@ static int ubd_open(struct inode *inode, struct file *filp)
|
||||
|
||||
/* This should no more be needed. And it didn't work anyway to exclude
|
||||
* read-write remounting of filesystems.*/
|
||||
/*if((filp->f_mode & FMODE_WRITE) && !ubd_dev->openflags.w){
|
||||
/*if((mode & FMODE_WRITE) && !ubd_dev->openflags.w){
|
||||
if(--ubd_dev->count == 0) ubd_close_dev(ubd_dev);
|
||||
err = -EROFS;
|
||||
}*/
|
||||
@@ -1139,9 +1139,8 @@ static int ubd_open(struct inode *inode, struct file *filp)
|
||||
return err;
|
||||
}
|
||||
|
||||
static int ubd_release(struct inode * inode, struct file * file)
|
||||
static int ubd_release(struct gendisk *disk, fmode_t mode)
|
||||
{
|
||||
struct gendisk *disk = inode->i_bdev->bd_disk;
|
||||
struct ubd *ubd_dev = disk->private_data;
|
||||
|
||||
if(--ubd_dev->count == 0)
|
||||
@@ -1306,10 +1305,10 @@ static int ubd_getgeo(struct block_device *bdev, struct hd_geometry *geo)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ubd_ioctl(struct inode * inode, struct file * file,
|
||||
static int ubd_ioctl(struct block_device *bdev, fmode_t mode,
|
||||
unsigned int cmd, unsigned long arg)
|
||||
{
|
||||
struct ubd *ubd_dev = inode->i_bdev->bd_disk->private_data;
|
||||
struct ubd *ubd_dev = bdev->bd_disk->private_data;
|
||||
struct hd_driveid ubd_id = {
|
||||
.cyls = 0,
|
||||
.heads = 128,
|
||||
|
||||
+5
-4
@@ -173,7 +173,7 @@ unlock:
|
||||
|
||||
static int blk_fill_sgv4_hdr_rq(struct request_queue *q, struct request *rq,
|
||||
struct sg_io_v4 *hdr, struct bsg_device *bd,
|
||||
int has_write_perm)
|
||||
fmode_t has_write_perm)
|
||||
{
|
||||
if (hdr->request_len > BLK_MAX_CDB) {
|
||||
rq->cmd = kzalloc(hdr->request_len, GFP_KERNEL);
|
||||
@@ -242,7 +242,7 @@ bsg_validate_sgv4_hdr(struct request_queue *q, struct sg_io_v4 *hdr, int *rw)
|
||||
* map sg_io_v4 to a request.
|
||||
*/
|
||||
static struct request *
|
||||
bsg_map_hdr(struct bsg_device *bd, struct sg_io_v4 *hdr, int has_write_perm)
|
||||
bsg_map_hdr(struct bsg_device *bd, struct sg_io_v4 *hdr, fmode_t has_write_perm)
|
||||
{
|
||||
struct request_queue *q = bd->queue;
|
||||
struct request *rq, *next_rq = NULL;
|
||||
@@ -601,7 +601,8 @@ bsg_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)
|
||||
}
|
||||
|
||||
static int __bsg_write(struct bsg_device *bd, const char __user *buf,
|
||||
size_t count, ssize_t *bytes_written, int has_write_perm)
|
||||
size_t count, ssize_t *bytes_written,
|
||||
fmode_t has_write_perm)
|
||||
{
|
||||
struct bsg_command *bc;
|
||||
struct request *rq;
|
||||
@@ -913,7 +914,7 @@ static long bsg_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
|
||||
case SG_EMULATED_HOST:
|
||||
case SCSI_IOCTL_SEND_COMMAND: {
|
||||
void __user *uarg = (void __user *) arg;
|
||||
return scsi_cmd_ioctl(file, bd->queue, NULL, cmd, uarg);
|
||||
return scsi_cmd_ioctl(bd->queue, NULL, file->f_mode, cmd, uarg);
|
||||
}
|
||||
case SG_IO: {
|
||||
struct request *rq;
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@
|
||||
#include <linux/cdrom.h>
|
||||
|
||||
int blk_verify_command(struct blk_cmd_filter *filter,
|
||||
unsigned char *cmd, int has_write_perm)
|
||||
unsigned char *cmd, fmode_t has_write_perm)
|
||||
{
|
||||
/* root can do any command. */
|
||||
if (capable(CAP_SYS_RAWIO))
|
||||
|
||||
+70
-105
@@ -71,8 +71,8 @@ static int compat_hdio_getgeo(struct gendisk *disk, struct block_device *bdev,
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int compat_hdio_ioctl(struct inode *inode, struct file *file,
|
||||
struct gendisk *disk, unsigned int cmd, unsigned long arg)
|
||||
static int compat_hdio_ioctl(struct block_device *bdev, fmode_t mode,
|
||||
unsigned int cmd, unsigned long arg)
|
||||
{
|
||||
mm_segment_t old_fs = get_fs();
|
||||
unsigned long kval;
|
||||
@@ -80,7 +80,7 @@ static int compat_hdio_ioctl(struct inode *inode, struct file *file,
|
||||
int error;
|
||||
|
||||
set_fs(KERNEL_DS);
|
||||
error = blkdev_driver_ioctl(inode, file, disk,
|
||||
error = __blkdev_driver_ioctl(bdev, mode,
|
||||
cmd, (unsigned long)(&kval));
|
||||
set_fs(old_fs);
|
||||
|
||||
@@ -111,8 +111,8 @@ struct compat_cdrom_generic_command {
|
||||
compat_caddr_t reserved[1];
|
||||
};
|
||||
|
||||
static int compat_cdrom_read_audio(struct inode *inode, struct file *file,
|
||||
struct gendisk *disk, unsigned int cmd, unsigned long arg)
|
||||
static int compat_cdrom_read_audio(struct block_device *bdev, fmode_t mode,
|
||||
unsigned int cmd, unsigned long arg)
|
||||
{
|
||||
struct cdrom_read_audio __user *cdread_audio;
|
||||
struct compat_cdrom_read_audio __user *cdread_audio32;
|
||||
@@ -134,12 +134,12 @@ static int compat_cdrom_read_audio(struct inode *inode, struct file *file,
|
||||
if (put_user(datap, &cdread_audio->buf))
|
||||
return -EFAULT;
|
||||
|
||||
return blkdev_driver_ioctl(inode, file, disk, cmd,
|
||||
return __blkdev_driver_ioctl(bdev, mode, cmd,
|
||||
(unsigned long)cdread_audio);
|
||||
}
|
||||
|
||||
static int compat_cdrom_generic_command(struct inode *inode, struct file *file,
|
||||
struct gendisk *disk, unsigned int cmd, unsigned long arg)
|
||||
static int compat_cdrom_generic_command(struct block_device *bdev, fmode_t mode,
|
||||
unsigned int cmd, unsigned long arg)
|
||||
{
|
||||
struct cdrom_generic_command __user *cgc;
|
||||
struct compat_cdrom_generic_command __user *cgc32;
|
||||
@@ -167,7 +167,7 @@ static int compat_cdrom_generic_command(struct inode *inode, struct file *file,
|
||||
put_user(compat_ptr(data), &cgc->reserved[0]))
|
||||
return -EFAULT;
|
||||
|
||||
return blkdev_driver_ioctl(inode, file, disk, cmd, (unsigned long)cgc);
|
||||
return __blkdev_driver_ioctl(bdev, mode, cmd, (unsigned long)cgc);
|
||||
}
|
||||
|
||||
struct compat_blkpg_ioctl_arg {
|
||||
@@ -177,7 +177,7 @@ struct compat_blkpg_ioctl_arg {
|
||||
compat_caddr_t data;
|
||||
};
|
||||
|
||||
static int compat_blkpg_ioctl(struct inode *inode, struct file *file,
|
||||
static int compat_blkpg_ioctl(struct block_device *bdev, fmode_t mode,
|
||||
unsigned int cmd, struct compat_blkpg_ioctl_arg __user *ua32)
|
||||
{
|
||||
struct blkpg_ioctl_arg __user *a = compat_alloc_user_space(sizeof(*a));
|
||||
@@ -196,7 +196,7 @@ static int compat_blkpg_ioctl(struct inode *inode, struct file *file,
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
return blkdev_ioctl(inode, file, cmd, (unsigned long)a);
|
||||
return blkdev_ioctl(bdev, mode, cmd, (unsigned long)a);
|
||||
}
|
||||
|
||||
#define BLKBSZGET_32 _IOR(0x12, 112, int)
|
||||
@@ -308,8 +308,8 @@ static struct {
|
||||
|
||||
#define NR_FD_IOCTL_TRANS ARRAY_SIZE(fd_ioctl_trans_table)
|
||||
|
||||
static int compat_fd_ioctl(struct inode *inode, struct file *file,
|
||||
struct gendisk *disk, unsigned int cmd, unsigned long arg)
|
||||
static int compat_fd_ioctl(struct block_device *bdev, fmode_t mode,
|
||||
unsigned int cmd, unsigned long arg)
|
||||
{
|
||||
mm_segment_t old_fs = get_fs();
|
||||
void *karg = NULL;
|
||||
@@ -413,7 +413,7 @@ static int compat_fd_ioctl(struct inode *inode, struct file *file,
|
||||
return -EINVAL;
|
||||
}
|
||||
set_fs(KERNEL_DS);
|
||||
err = blkdev_driver_ioctl(inode, file, disk, kcmd, (unsigned long)karg);
|
||||
err = __blkdev_driver_ioctl(bdev, mode, kcmd, (unsigned long)karg);
|
||||
set_fs(old_fs);
|
||||
if (err)
|
||||
goto out;
|
||||
@@ -579,8 +579,8 @@ static int compat_blk_trace_setup(struct block_device *bdev, char __user *arg)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int compat_blkdev_driver_ioctl(struct inode *inode, struct file *file,
|
||||
struct gendisk *disk, unsigned cmd, unsigned long arg)
|
||||
static int compat_blkdev_driver_ioctl(struct block_device *bdev, fmode_t mode,
|
||||
unsigned cmd, unsigned long arg)
|
||||
{
|
||||
int ret;
|
||||
|
||||
@@ -596,7 +596,7 @@ static int compat_blkdev_driver_ioctl(struct inode *inode, struct file *file,
|
||||
case HDIO_GET_ACOUSTIC:
|
||||
case HDIO_GET_ADDRESS:
|
||||
case HDIO_GET_BUSSTATE:
|
||||
return compat_hdio_ioctl(inode, file, disk, cmd, arg);
|
||||
return compat_hdio_ioctl(bdev, mode, cmd, arg);
|
||||
case FDSETPRM32:
|
||||
case FDDEFPRM32:
|
||||
case FDGETPRM32:
|
||||
@@ -606,11 +606,11 @@ static int compat_blkdev_driver_ioctl(struct inode *inode, struct file *file,
|
||||
case FDPOLLDRVSTAT32:
|
||||
case FDGETFDCSTAT32:
|
||||
case FDWERRORGET32:
|
||||
return compat_fd_ioctl(inode, file, disk, cmd, arg);
|
||||
return compat_fd_ioctl(bdev, mode, cmd, arg);
|
||||
case CDROMREADAUDIO:
|
||||
return compat_cdrom_read_audio(inode, file, disk, cmd, arg);
|
||||
return compat_cdrom_read_audio(bdev, mode, cmd, arg);
|
||||
case CDROM_SEND_PACKET:
|
||||
return compat_cdrom_generic_command(inode, file, disk, cmd, arg);
|
||||
return compat_cdrom_generic_command(bdev, mode, cmd, arg);
|
||||
|
||||
/*
|
||||
* No handler required for the ones below, we just need to
|
||||
@@ -679,55 +679,49 @@ static int compat_blkdev_driver_ioctl(struct inode *inode, struct file *file,
|
||||
case DVD_WRITE_STRUCT:
|
||||
case DVD_AUTH:
|
||||
arg = (unsigned long)compat_ptr(arg);
|
||||
/* These intepret arg as an unsigned long, not as a pointer,
|
||||
* so we must not do compat_ptr() conversion. */
|
||||
case HDIO_SET_MULTCOUNT:
|
||||
case HDIO_SET_UNMASKINTR:
|
||||
case HDIO_SET_KEEPSETTINGS:
|
||||
case HDIO_SET_32BIT:
|
||||
case HDIO_SET_NOWERR:
|
||||
case HDIO_SET_DMA:
|
||||
case HDIO_SET_PIO_MODE:
|
||||
case HDIO_SET_NICE:
|
||||
case HDIO_SET_WCACHE:
|
||||
case HDIO_SET_ACOUSTIC:
|
||||
case HDIO_SET_BUSSTATE:
|
||||
case HDIO_SET_ADDRESS:
|
||||
case CDROMEJECT_SW:
|
||||
case CDROM_SET_OPTIONS:
|
||||
case CDROM_CLEAR_OPTIONS:
|
||||
case CDROM_SELECT_SPEED:
|
||||
case CDROM_SELECT_DISC:
|
||||
case CDROM_MEDIA_CHANGED:
|
||||
case CDROM_DRIVE_STATUS:
|
||||
case CDROM_LOCKDOOR:
|
||||
case CDROM_DEBUG:
|
||||
break;
|
||||
default:
|
||||
/* unknown ioctl number */
|
||||
return -ENOIOCTLCMD;
|
||||
}
|
||||
|
||||
if (disk->fops->unlocked_ioctl)
|
||||
return disk->fops->unlocked_ioctl(file, cmd, arg);
|
||||
|
||||
if (disk->fops->ioctl) {
|
||||
lock_kernel();
|
||||
ret = disk->fops->ioctl(inode, file, cmd, arg);
|
||||
unlock_kernel();
|
||||
return ret;
|
||||
}
|
||||
|
||||
return -ENOTTY;
|
||||
return __blkdev_driver_ioctl(bdev, mode, cmd, arg);
|
||||
}
|
||||
|
||||
static int compat_blkdev_locked_ioctl(struct inode *inode, struct file *file,
|
||||
struct block_device *bdev,
|
||||
unsigned cmd, unsigned long arg)
|
||||
/* Most of the generic ioctls are handled in the normal fallback path.
|
||||
This assumes the blkdev's low level compat_ioctl always returns
|
||||
ENOIOCTLCMD for unknown ioctls. */
|
||||
long compat_blkdev_ioctl(struct file *file, unsigned cmd, unsigned long arg)
|
||||
{
|
||||
int ret = -ENOIOCTLCMD;
|
||||
struct inode *inode = file->f_mapping->host;
|
||||
struct block_device *bdev = inode->i_bdev;
|
||||
struct gendisk *disk = bdev->bd_disk;
|
||||
fmode_t mode = file->f_mode;
|
||||
struct backing_dev_info *bdi;
|
||||
loff_t size;
|
||||
|
||||
if (file->f_flags & O_NDELAY)
|
||||
mode |= FMODE_NDELAY_NOW;
|
||||
|
||||
switch (cmd) {
|
||||
case HDIO_GETGEO:
|
||||
return compat_hdio_getgeo(disk, bdev, compat_ptr(arg));
|
||||
case BLKFLSBUF:
|
||||
case BLKROSET:
|
||||
case BLKDISCARD:
|
||||
/*
|
||||
* the ones below are implemented in blkdev_locked_ioctl,
|
||||
* but we call blkdev_ioctl, which gets the lock for us
|
||||
*/
|
||||
case BLKRRPART:
|
||||
return blkdev_ioctl(bdev, mode, cmd,
|
||||
(unsigned long)compat_ptr(arg));
|
||||
case BLKBSZSET_32:
|
||||
return blkdev_ioctl(bdev, mode, BLKBSZSET,
|
||||
(unsigned long)compat_ptr(arg));
|
||||
case BLKPG:
|
||||
return compat_blkpg_ioctl(bdev, mode, cmd, compat_ptr(arg));
|
||||
case BLKRAGET:
|
||||
case BLKFRAGET:
|
||||
if (!arg)
|
||||
@@ -753,65 +747,36 @@ static int compat_blkdev_locked_ioctl(struct inode *inode, struct file *file,
|
||||
bdi = blk_get_backing_dev_info(bdev);
|
||||
if (bdi == NULL)
|
||||
return -ENOTTY;
|
||||
lock_kernel();
|
||||
bdi->ra_pages = (arg * 512) / PAGE_CACHE_SIZE;
|
||||
unlock_kernel();
|
||||
return 0;
|
||||
case BLKGETSIZE:
|
||||
if ((bdev->bd_inode->i_size >> 9) > ~0UL)
|
||||
size = bdev->bd_inode->i_size;
|
||||
if ((size >> 9) > ~0UL)
|
||||
return -EFBIG;
|
||||
return compat_put_ulong(arg, bdev->bd_inode->i_size >> 9);
|
||||
return compat_put_ulong(arg, size >> 9);
|
||||
|
||||
case BLKGETSIZE64_32:
|
||||
return compat_put_u64(arg, bdev->bd_inode->i_size);
|
||||
|
||||
case BLKTRACESETUP32:
|
||||
return compat_blk_trace_setup(bdev, compat_ptr(arg));
|
||||
lock_kernel();
|
||||
ret = compat_blk_trace_setup(bdev, compat_ptr(arg));
|
||||
unlock_kernel();
|
||||
return ret;
|
||||
case BLKTRACESTART: /* compatible */
|
||||
case BLKTRACESTOP: /* compatible */
|
||||
case BLKTRACETEARDOWN: /* compatible */
|
||||
return blk_trace_ioctl(bdev, cmd, compat_ptr(arg));
|
||||
}
|
||||
return -ENOIOCTLCMD;
|
||||
}
|
||||
|
||||
/* Most of the generic ioctls are handled in the normal fallback path.
|
||||
This assumes the blkdev's low level compat_ioctl always returns
|
||||
ENOIOCTLCMD for unknown ioctls. */
|
||||
long compat_blkdev_ioctl(struct file *file, unsigned cmd, unsigned long arg)
|
||||
{
|
||||
int ret = -ENOIOCTLCMD;
|
||||
struct inode *inode = file->f_mapping->host;
|
||||
struct block_device *bdev = inode->i_bdev;
|
||||
struct gendisk *disk = bdev->bd_disk;
|
||||
|
||||
switch (cmd) {
|
||||
case HDIO_GETGEO:
|
||||
return compat_hdio_getgeo(disk, bdev, compat_ptr(arg));
|
||||
case BLKFLSBUF:
|
||||
case BLKROSET:
|
||||
case BLKDISCARD:
|
||||
/*
|
||||
* the ones below are implemented in blkdev_locked_ioctl,
|
||||
* but we call blkdev_ioctl, which gets the lock for us
|
||||
*/
|
||||
case BLKRRPART:
|
||||
return blkdev_ioctl(inode, file, cmd,
|
||||
(unsigned long)compat_ptr(arg));
|
||||
case BLKBSZSET_32:
|
||||
return blkdev_ioctl(inode, file, BLKBSZSET,
|
||||
(unsigned long)compat_ptr(arg));
|
||||
case BLKPG:
|
||||
return compat_blkpg_ioctl(inode, file, cmd, compat_ptr(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);
|
||||
unlock_kernel();
|
||||
|
||||
if (ret != -ENOIOCTLCMD)
|
||||
lock_kernel();
|
||||
ret = blk_trace_ioctl(bdev, cmd, compat_ptr(arg));
|
||||
unlock_kernel();
|
||||
return ret;
|
||||
|
||||
return compat_blkdev_driver_ioctl(inode, file, disk, cmd, arg);
|
||||
default:
|
||||
if (disk->fops->compat_ioctl)
|
||||
ret = disk->fops->compat_ioctl(bdev, mode, cmd, arg);
|
||||
if (ret == -ENOIOCTLCMD)
|
||||
ret = compat_blkdev_driver_ioctl(bdev, mode, cmd, arg);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
+89
-84
@@ -201,97 +201,41 @@ static int put_u64(unsigned long arg, u64 val)
|
||||
return put_user(val, (u64 __user *)arg);
|
||||
}
|
||||
|
||||
static int blkdev_locked_ioctl(struct file *file, struct block_device *bdev,
|
||||
unsigned cmd, unsigned long arg)
|
||||
{
|
||||
struct backing_dev_info *bdi;
|
||||
int ret, n;
|
||||
|
||||
switch (cmd) {
|
||||
case BLKRAGET:
|
||||
case BLKFRAGET:
|
||||
if (!arg)
|
||||
return -EINVAL;
|
||||
bdi = blk_get_backing_dev_info(bdev);
|
||||
if (bdi == NULL)
|
||||
return -ENOTTY;
|
||||
return put_long(arg, (bdi->ra_pages * PAGE_CACHE_SIZE) / 512);
|
||||
case BLKROGET:
|
||||
return put_int(arg, bdev_read_only(bdev) != 0);
|
||||
case BLKBSZGET: /* get the logical block size (cf. BLKSSZGET) */
|
||||
return put_int(arg, block_size(bdev));
|
||||
case BLKSSZGET: /* get block device hardware sector size */
|
||||
return put_int(arg, bdev_hardsect_size(bdev));
|
||||
case BLKSECTGET:
|
||||
return put_ushort(arg, bdev_get_queue(bdev)->max_sectors);
|
||||
case BLKRASET:
|
||||
case BLKFRASET:
|
||||
if(!capable(CAP_SYS_ADMIN))
|
||||
return -EACCES;
|
||||
bdi = blk_get_backing_dev_info(bdev);
|
||||
if (bdi == NULL)
|
||||
return -ENOTTY;
|
||||
bdi->ra_pages = (arg * 512) / PAGE_CACHE_SIZE;
|
||||
return 0;
|
||||
case BLKBSZSET:
|
||||
/* set the logical block size */
|
||||
if (!capable(CAP_SYS_ADMIN))
|
||||
return -EACCES;
|
||||
if (!arg)
|
||||
return -EINVAL;
|
||||
if (get_user(n, (int __user *) arg))
|
||||
return -EFAULT;
|
||||
if (bd_claim(bdev, file) < 0)
|
||||
return -EBUSY;
|
||||
ret = set_blocksize(bdev, n);
|
||||
bd_release(bdev);
|
||||
return ret;
|
||||
case BLKPG:
|
||||
return blkpg_ioctl(bdev, (struct blkpg_ioctl_arg __user *) arg);
|
||||
case BLKRRPART:
|
||||
return blkdev_reread_part(bdev);
|
||||
case BLKGETSIZE:
|
||||
if ((bdev->bd_inode->i_size >> 9) > ~0UL)
|
||||
return -EFBIG;
|
||||
return put_ulong(arg, bdev->bd_inode->i_size >> 9);
|
||||
case BLKGETSIZE64:
|
||||
return put_u64(arg, bdev->bd_inode->i_size);
|
||||
case BLKTRACESTART:
|
||||
case BLKTRACESTOP:
|
||||
case BLKTRACESETUP:
|
||||
case BLKTRACETEARDOWN:
|
||||
return blk_trace_ioctl(bdev, cmd, (char __user *) arg);
|
||||
}
|
||||
return -ENOIOCTLCMD;
|
||||
}
|
||||
|
||||
int blkdev_driver_ioctl(struct inode *inode, struct file *file,
|
||||
struct gendisk *disk, unsigned cmd, unsigned long arg)
|
||||
int __blkdev_driver_ioctl(struct block_device *bdev, fmode_t mode,
|
||||
unsigned cmd, unsigned long arg)
|
||||
{
|
||||
struct gendisk *disk = bdev->bd_disk;
|
||||
int ret;
|
||||
if (disk->fops->unlocked_ioctl)
|
||||
return disk->fops->unlocked_ioctl(file, cmd, arg);
|
||||
|
||||
if (disk->fops->ioctl) {
|
||||
if (disk->fops->ioctl)
|
||||
return disk->fops->ioctl(bdev, mode, cmd, arg);
|
||||
|
||||
if (disk->fops->locked_ioctl) {
|
||||
lock_kernel();
|
||||
ret = disk->fops->ioctl(inode, file, cmd, arg);
|
||||
ret = disk->fops->locked_ioctl(bdev, mode, cmd, arg);
|
||||
unlock_kernel();
|
||||
return ret;
|
||||
}
|
||||
|
||||
return -ENOTTY;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(blkdev_driver_ioctl);
|
||||
/*
|
||||
* For the record: _GPL here is only because somebody decided to slap it
|
||||
* on the previous export. Sheer idiocy, since it wasn't copyrightable
|
||||
* at all and could be open-coded without any exports by anybody who cares.
|
||||
*/
|
||||
EXPORT_SYMBOL_GPL(__blkdev_driver_ioctl);
|
||||
|
||||
/*
|
||||
* always keep this in sync with compat_blkdev_ioctl() and
|
||||
* compat_blkdev_locked_ioctl()
|
||||
*/
|
||||
int blkdev_ioctl(struct inode *inode, struct file *file, unsigned cmd,
|
||||
int blkdev_ioctl(struct block_device *bdev, fmode_t mode, unsigned cmd,
|
||||
unsigned long arg)
|
||||
{
|
||||
struct block_device *bdev = inode->i_bdev;
|
||||
struct gendisk *disk = bdev->bd_disk;
|
||||
struct backing_dev_info *bdi;
|
||||
loff_t size;
|
||||
int ret, n;
|
||||
|
||||
switch(cmd) {
|
||||
@@ -299,7 +243,7 @@ int blkdev_ioctl(struct inode *inode, struct file *file, unsigned cmd,
|
||||
if (!capable(CAP_SYS_ADMIN))
|
||||
return -EACCES;
|
||||
|
||||
ret = blkdev_driver_ioctl(inode, file, disk, cmd, arg);
|
||||
ret = __blkdev_driver_ioctl(bdev, mode, cmd, arg);
|
||||
/* -EINVAL to handle old uncorrected drivers */
|
||||
if (ret != -EINVAL && ret != -ENOTTY)
|
||||
return ret;
|
||||
@@ -311,7 +255,7 @@ int blkdev_ioctl(struct inode *inode, struct file *file, unsigned cmd,
|
||||
return 0;
|
||||
|
||||
case BLKROSET:
|
||||
ret = blkdev_driver_ioctl(inode, file, disk, cmd, arg);
|
||||
ret = __blkdev_driver_ioctl(bdev, mode, cmd, arg);
|
||||
/* -EINVAL to handle old uncorrected drivers */
|
||||
if (ret != -EINVAL && ret != -ENOTTY)
|
||||
return ret;
|
||||
@@ -327,7 +271,7 @@ int blkdev_ioctl(struct inode *inode, struct file *file, unsigned cmd,
|
||||
case BLKDISCARD: {
|
||||
uint64_t range[2];
|
||||
|
||||
if (!(file->f_mode & FMODE_WRITE))
|
||||
if (!(mode & FMODE_WRITE))
|
||||
return -EBADF;
|
||||
|
||||
if (copy_from_user(range, (void __user *)arg, sizeof(range)))
|
||||
@@ -357,14 +301,75 @@ int blkdev_ioctl(struct inode *inode, struct file *file, unsigned cmd,
|
||||
return -EFAULT;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
lock_kernel();
|
||||
ret = blkdev_locked_ioctl(file, bdev, cmd, arg);
|
||||
unlock_kernel();
|
||||
if (ret != -ENOIOCTLCMD)
|
||||
case BLKRAGET:
|
||||
case BLKFRAGET:
|
||||
if (!arg)
|
||||
return -EINVAL;
|
||||
bdi = blk_get_backing_dev_info(bdev);
|
||||
if (bdi == NULL)
|
||||
return -ENOTTY;
|
||||
return put_long(arg, (bdi->ra_pages * PAGE_CACHE_SIZE) / 512);
|
||||
case BLKROGET:
|
||||
return put_int(arg, bdev_read_only(bdev) != 0);
|
||||
case BLKBSZGET: /* get the logical block size (cf. BLKSSZGET) */
|
||||
return put_int(arg, block_size(bdev));
|
||||
case BLKSSZGET: /* get block device hardware sector size */
|
||||
return put_int(arg, bdev_hardsect_size(bdev));
|
||||
case BLKSECTGET:
|
||||
return put_ushort(arg, bdev_get_queue(bdev)->max_sectors);
|
||||
case BLKRASET:
|
||||
case BLKFRASET:
|
||||
if(!capable(CAP_SYS_ADMIN))
|
||||
return -EACCES;
|
||||
bdi = blk_get_backing_dev_info(bdev);
|
||||
if (bdi == NULL)
|
||||
return -ENOTTY;
|
||||
lock_kernel();
|
||||
bdi->ra_pages = (arg * 512) / PAGE_CACHE_SIZE;
|
||||
unlock_kernel();
|
||||
return 0;
|
||||
case BLKBSZSET:
|
||||
/* set the logical block size */
|
||||
if (!capable(CAP_SYS_ADMIN))
|
||||
return -EACCES;
|
||||
if (!arg)
|
||||
return -EINVAL;
|
||||
if (get_user(n, (int __user *) arg))
|
||||
return -EFAULT;
|
||||
if (!(mode & FMODE_EXCL) && bd_claim(bdev, &bdev) < 0)
|
||||
return -EBUSY;
|
||||
ret = set_blocksize(bdev, n);
|
||||
if (!(mode & FMODE_EXCL))
|
||||
bd_release(bdev);
|
||||
return ret;
|
||||
|
||||
return blkdev_driver_ioctl(inode, file, disk, cmd, arg);
|
||||
case BLKPG:
|
||||
lock_kernel();
|
||||
ret = blkpg_ioctl(bdev, (struct blkpg_ioctl_arg __user *) arg);
|
||||
unlock_kernel();
|
||||
break;
|
||||
case BLKRRPART:
|
||||
lock_kernel();
|
||||
ret = blkdev_reread_part(bdev);
|
||||
unlock_kernel();
|
||||
break;
|
||||
case BLKGETSIZE:
|
||||
size = bdev->bd_inode->i_size;
|
||||
if ((size >> 9) > ~0UL)
|
||||
return -EFBIG;
|
||||
return put_ulong(arg, size >> 9);
|
||||
case BLKGETSIZE64:
|
||||
return put_u64(arg, bdev->bd_inode->i_size);
|
||||
case BLKTRACESTART:
|
||||
case BLKTRACESTOP:
|
||||
case BLKTRACESETUP:
|
||||
case BLKTRACETEARDOWN:
|
||||
lock_kernel();
|
||||
ret = blk_trace_ioctl(bdev, cmd, (char __user *) arg);
|
||||
unlock_kernel();
|
||||
break;
|
||||
default:
|
||||
ret = __blkdev_driver_ioctl(bdev, mode, cmd, arg);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(blkdev_ioctl);
|
||||
+14
-19
@@ -190,12 +190,11 @@ void blk_set_cmd_filter_defaults(struct blk_cmd_filter *filter)
|
||||
EXPORT_SYMBOL_GPL(blk_set_cmd_filter_defaults);
|
||||
|
||||
static int blk_fill_sghdr_rq(struct request_queue *q, struct request *rq,
|
||||
struct sg_io_hdr *hdr, struct file *file)
|
||||
struct sg_io_hdr *hdr, fmode_t mode)
|
||||
{
|
||||
if (copy_from_user(rq->cmd, hdr->cmdp, hdr->cmd_len))
|
||||
return -EFAULT;
|
||||
if (blk_verify_command(&q->cmd_filter, rq->cmd,
|
||||
file->f_mode & FMODE_WRITE))
|
||||
if (blk_verify_command(&q->cmd_filter, rq->cmd, mode & FMODE_WRITE))
|
||||
return -EPERM;
|
||||
|
||||
/*
|
||||
@@ -260,8 +259,8 @@ static int blk_complete_sghdr_rq(struct request *rq, struct sg_io_hdr *hdr,
|
||||
return r;
|
||||
}
|
||||
|
||||
static int sg_io(struct file *file, struct request_queue *q,
|
||||
struct gendisk *bd_disk, struct sg_io_hdr *hdr)
|
||||
static int sg_io(struct request_queue *q, struct gendisk *bd_disk,
|
||||
struct sg_io_hdr *hdr, fmode_t mode)
|
||||
{
|
||||
unsigned long start_time;
|
||||
int writing = 0, ret = 0;
|
||||
@@ -293,7 +292,7 @@ static int sg_io(struct file *file, struct request_queue *q,
|
||||
if (!rq)
|
||||
return -ENOMEM;
|
||||
|
||||
if (blk_fill_sghdr_rq(q, rq, hdr, file)) {
|
||||
if (blk_fill_sghdr_rq(q, rq, hdr, mode)) {
|
||||
blk_put_request(rq);
|
||||
return -EFAULT;
|
||||
}
|
||||
@@ -380,11 +379,11 @@ out:
|
||||
* bytes in one int) where the lowest byte is the SCSI status.
|
||||
*/
|
||||
#define OMAX_SB_LEN 16 /* For backward compatibility */
|
||||
int sg_scsi_ioctl(struct file *file, struct request_queue *q,
|
||||
struct gendisk *disk, struct scsi_ioctl_command __user *sic)
|
||||
int sg_scsi_ioctl(struct request_queue *q, struct gendisk *disk, fmode_t mode,
|
||||
struct scsi_ioctl_command __user *sic)
|
||||
{
|
||||
struct request *rq;
|
||||
int err, write_perm = 0;
|
||||
int err;
|
||||
unsigned int in_len, out_len, bytes, opcode, cmdlen;
|
||||
char *buffer = NULL, sense[SCSI_SENSE_BUFFERSIZE];
|
||||
|
||||
@@ -426,11 +425,7 @@ int sg_scsi_ioctl(struct file *file, struct request_queue *q,
|
||||
if (in_len && copy_from_user(buffer, sic->data + cmdlen, in_len))
|
||||
goto error;
|
||||
|
||||
/* scsi_ioctl passes NULL */
|
||||
if (file && (file->f_mode & FMODE_WRITE))
|
||||
write_perm = 1;
|
||||
|
||||
err = blk_verify_command(&q->cmd_filter, rq->cmd, write_perm);
|
||||
err = blk_verify_command(&q->cmd_filter, rq->cmd, mode & FMODE_WRITE);
|
||||
if (err)
|
||||
goto error;
|
||||
|
||||
@@ -522,8 +517,8 @@ static inline int blk_send_start_stop(struct request_queue *q,
|
||||
return __blk_send_generic(q, bd_disk, GPCMD_START_STOP_UNIT, data);
|
||||
}
|
||||
|
||||
int scsi_cmd_ioctl(struct file *file, struct request_queue *q,
|
||||
struct gendisk *bd_disk, unsigned int cmd, void __user *arg)
|
||||
int scsi_cmd_ioctl(struct request_queue *q, struct gendisk *bd_disk, fmode_t mode,
|
||||
unsigned int cmd, void __user *arg)
|
||||
{
|
||||
int err;
|
||||
|
||||
@@ -564,7 +559,7 @@ int scsi_cmd_ioctl(struct file *file, struct request_queue *q,
|
||||
err = -EFAULT;
|
||||
if (copy_from_user(&hdr, arg, sizeof(hdr)))
|
||||
break;
|
||||
err = sg_io(file, q, bd_disk, &hdr);
|
||||
err = sg_io(q, bd_disk, &hdr, mode);
|
||||
if (err == -EFAULT)
|
||||
break;
|
||||
|
||||
@@ -612,7 +607,7 @@ int scsi_cmd_ioctl(struct file *file, struct request_queue *q,
|
||||
hdr.cmdp = ((struct cdrom_generic_command __user*) arg)->cmd;
|
||||
hdr.cmd_len = sizeof(cgc.cmd);
|
||||
|
||||
err = sg_io(file, q, bd_disk, &hdr);
|
||||
err = sg_io(q, bd_disk, &hdr, mode);
|
||||
if (err == -EFAULT)
|
||||
break;
|
||||
|
||||
@@ -636,7 +631,7 @@ int scsi_cmd_ioctl(struct file *file, struct request_queue *q,
|
||||
if (!arg)
|
||||
break;
|
||||
|
||||
err = sg_scsi_ioctl(file, q, bd_disk, arg);
|
||||
err = sg_scsi_ioctl(q, bd_disk, mode, arg);
|
||||
break;
|
||||
case CDROMCLOSETRAY:
|
||||
err = blk_send_start_stop(q, bd_disk, 0x03);
|
||||
|
||||
@@ -72,9 +72,9 @@ static long disk_size(DAC960_Controller_T *p, int drive_nr)
|
||||
}
|
||||
}
|
||||
|
||||
static int DAC960_open(struct inode *inode, struct file *file)
|
||||
static int DAC960_open(struct block_device *bdev, fmode_t mode)
|
||||
{
|
||||
struct gendisk *disk = inode->i_bdev->bd_disk;
|
||||
struct gendisk *disk = bdev->bd_disk;
|
||||
DAC960_Controller_T *p = disk->queue->queuedata;
|
||||
int drive_nr = (long)disk->private_data;
|
||||
|
||||
@@ -89,7 +89,7 @@ static int DAC960_open(struct inode *inode, struct file *file)
|
||||
return -ENXIO;
|
||||
}
|
||||
|
||||
check_disk_change(inode->i_bdev);
|
||||
check_disk_change(bdev);
|
||||
|
||||
if (!get_capacity(p->disks[drive_nr]))
|
||||
return -ENXIO;
|
||||
|
||||
+24
-22
@@ -1437,10 +1437,11 @@ static int fd_getgeo(struct block_device *bdev, struct hd_geometry *geo)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int fd_ioctl(struct inode *inode, struct file *filp,
|
||||
static int fd_ioctl(struct block_device *bdev, fmode_t mode,
|
||||
unsigned int cmd, unsigned long param)
|
||||
{
|
||||
int drive = iminor(inode) & 3;
|
||||
struct amiga_floppy_struct *p = bdev->bd_disk->private_data;
|
||||
int drive = p - unit;
|
||||
static struct floppy_struct getprm;
|
||||
void __user *argp = (void __user *)param;
|
||||
|
||||
@@ -1451,7 +1452,7 @@ static int fd_ioctl(struct inode *inode, struct file *filp,
|
||||
rel_fdc();
|
||||
return -EBUSY;
|
||||
}
|
||||
fsync_bdev(inode->i_bdev);
|
||||
fsync_bdev(bdev);
|
||||
if (fd_motor_on(drive) == 0) {
|
||||
rel_fdc();
|
||||
return -ENODEV;
|
||||
@@ -1464,12 +1465,12 @@ static int fd_ioctl(struct inode *inode, struct file *filp,
|
||||
rel_fdc();
|
||||
break;
|
||||
case FDFMTTRK:
|
||||
if (param < unit[drive].type->tracks * unit[drive].type->heads)
|
||||
if (param < p->type->tracks * p->type->heads)
|
||||
{
|
||||
get_fdc(drive);
|
||||
if (fd_seek(drive,param) != 0){
|
||||
memset(unit[drive].trackbuf, FD_FILL_BYTE,
|
||||
unit[drive].dtype->sects * unit[drive].type->sect_mult * 512);
|
||||
memset(p->trackbuf, FD_FILL_BYTE,
|
||||
p->dtype->sects * p->type->sect_mult * 512);
|
||||
non_int_flush_track(drive);
|
||||
}
|
||||
floppy_off(drive);
|
||||
@@ -1480,14 +1481,14 @@ static int fd_ioctl(struct inode *inode, struct file *filp,
|
||||
break;
|
||||
case FDFMTEND:
|
||||
floppy_off(drive);
|
||||
invalidate_bdev(inode->i_bdev);
|
||||
invalidate_bdev(bdev);
|
||||
break;
|
||||
case FDGETPRM:
|
||||
memset((void *)&getprm, 0, sizeof (getprm));
|
||||
getprm.track=unit[drive].type->tracks;
|
||||
getprm.head=unit[drive].type->heads;
|
||||
getprm.sect=unit[drive].dtype->sects * unit[drive].type->sect_mult;
|
||||
getprm.size=unit[drive].blocks;
|
||||
getprm.track=p->type->tracks;
|
||||
getprm.head=p->type->heads;
|
||||
getprm.sect=p->dtype->sects * p->type->sect_mult;
|
||||
getprm.size=p->blocks;
|
||||
if (copy_to_user(argp, &getprm, sizeof(struct floppy_struct)))
|
||||
return -EFAULT;
|
||||
break;
|
||||
@@ -1500,10 +1501,10 @@ static int fd_ioctl(struct inode *inode, struct file *filp,
|
||||
break;
|
||||
#ifdef RAW_IOCTL
|
||||
case IOCTL_RAW_TRACK:
|
||||
if (copy_to_user(argp, raw_buf, unit[drive].type->read_size))
|
||||
if (copy_to_user(argp, raw_buf, p->type->read_size))
|
||||
return -EFAULT;
|
||||
else
|
||||
return unit[drive].type->read_size;
|
||||
return p->type->read_size;
|
||||
#endif
|
||||
default:
|
||||
printk(KERN_DEBUG "fd_ioctl: unknown cmd %d for drive %d.",
|
||||
@@ -1548,10 +1549,10 @@ static void fd_probe(int dev)
|
||||
* /dev/PS0 etc), and disallows simultaneous access to the same
|
||||
* drive with different device numbers.
|
||||
*/
|
||||
static int floppy_open(struct inode *inode, struct file *filp)
|
||||
static int floppy_open(struct block_device *bdev, fmode_t mode)
|
||||
{
|
||||
int drive = iminor(inode) & 3;
|
||||
int system = (iminor(inode) & 4) >> 2;
|
||||
int drive = MINOR(bdev->bd_dev) & 3;
|
||||
int system = (MINOR(bdev->bd_dev) & 4) >> 2;
|
||||
int old_dev;
|
||||
unsigned long flags;
|
||||
|
||||
@@ -1560,9 +1561,9 @@ static int floppy_open(struct inode *inode, struct file *filp)
|
||||
if (fd_ref[drive] && old_dev != system)
|
||||
return -EBUSY;
|
||||
|
||||
if (filp && filp->f_mode & 3) {
|
||||
check_disk_change(inode->i_bdev);
|
||||
if (filp->f_mode & 2 ) {
|
||||
if (mode & (FMODE_READ|FMODE_WRITE)) {
|
||||
check_disk_change(bdev);
|
||||
if (mode & FMODE_WRITE) {
|
||||
int wrprot;
|
||||
|
||||
get_fdc(drive);
|
||||
@@ -1592,9 +1593,10 @@ static int floppy_open(struct inode *inode, struct file *filp)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int floppy_release(struct inode * inode, struct file * filp)
|
||||
static int floppy_release(struct gendisk *disk, fmode_t mode)
|
||||
{
|
||||
int drive = iminor(inode) & 3;
|
||||
struct amiga_floppy_struct *p = disk->private_data;
|
||||
int drive = p - unit;
|
||||
|
||||
if (unit[drive].dirty == 1) {
|
||||
del_timer (flush_track_timer + drive);
|
||||
@@ -1650,7 +1652,7 @@ static struct block_device_operations floppy_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = floppy_open,
|
||||
.release = floppy_release,
|
||||
.ioctl = fd_ioctl,
|
||||
.locked_ioctl = fd_ioctl,
|
||||
.getgeo = fd_getgeo,
|
||||
.media_changed = amiga_floppy_change,
|
||||
};
|
||||
|
||||
@@ -118,13 +118,11 @@ aoedisk_rm_sysfs(struct aoedev *d)
|
||||
}
|
||||
|
||||
static int
|
||||
aoeblk_open(struct inode *inode, struct file *filp)
|
||||
aoeblk_open(struct block_device *bdev, fmode_t mode)
|
||||
{
|
||||
struct aoedev *d;
|
||||
struct aoedev *d = bdev->bd_disk->private_data;
|
||||
ulong flags;
|
||||
|
||||
d = inode->i_bdev->bd_disk->private_data;
|
||||
|
||||
spin_lock_irqsave(&d->lock, flags);
|
||||
if (d->flags & DEVFL_UP) {
|
||||
d->nopen++;
|
||||
@@ -136,13 +134,11 @@ aoeblk_open(struct inode *inode, struct file *filp)
|
||||
}
|
||||
|
||||
static int
|
||||
aoeblk_release(struct inode *inode, struct file *filp)
|
||||
aoeblk_release(struct gendisk *disk, fmode_t mode)
|
||||
{
|
||||
struct aoedev *d;
|
||||
struct aoedev *d = disk->private_data;
|
||||
ulong flags;
|
||||
|
||||
d = inode->i_bdev->bd_disk->private_data;
|
||||
|
||||
spin_lock_irqsave(&d->lock, flags);
|
||||
|
||||
if (--d->nopen == 0) {
|
||||
|
||||
+18
-19
@@ -361,13 +361,13 @@ static void finish_fdc( void );
|
||||
static void finish_fdc_done( int dummy );
|
||||
static void setup_req_params( int drive );
|
||||
static void redo_fd_request( void);
|
||||
static int fd_ioctl( struct inode *inode, struct file *filp, unsigned int
|
||||
static int fd_ioctl(struct block_device *bdev, fmode_t mode, unsigned int
|
||||
cmd, unsigned long param);
|
||||
static void fd_probe( int drive );
|
||||
static int fd_test_drive_present( int drive );
|
||||
static void config_types( void );
|
||||
static int floppy_open( struct inode *inode, struct file *filp );
|
||||
static int floppy_release( struct inode * inode, struct file * filp );
|
||||
static int floppy_open(struct block_device *bdev, fmode_t mode);
|
||||
static int floppy_release(struct gendisk *disk, fmode_t mode);
|
||||
|
||||
/************************* End of Prototypes **************************/
|
||||
|
||||
@@ -1483,10 +1483,10 @@ void do_fd_request(struct request_queue * q)
|
||||
atari_enable_irq( IRQ_MFP_FDC );
|
||||
}
|
||||
|
||||
static int fd_ioctl(struct inode *inode, struct file *filp,
|
||||
static int fd_ioctl(struct block_device *bdev, fmode_t mode,
|
||||
unsigned int cmd, unsigned long param)
|
||||
{
|
||||
struct gendisk *disk = inode->i_bdev->bd_disk;
|
||||
struct gendisk *disk = bdev->bd_disk;
|
||||
struct atari_floppy_struct *floppy = disk->private_data;
|
||||
int drive = floppy - unit;
|
||||
int type = floppy->type;
|
||||
@@ -1661,7 +1661,7 @@ static int fd_ioctl(struct inode *inode, struct file *filp,
|
||||
/* invalidate the buffer track to force a reread */
|
||||
BufferDrive = -1;
|
||||
set_bit(drive, &fake_change);
|
||||
check_disk_change(inode->i_bdev);
|
||||
check_disk_change(bdev);
|
||||
return 0;
|
||||
default:
|
||||
return -EINVAL;
|
||||
@@ -1804,37 +1804,36 @@ static void __init config_types( void )
|
||||
* drive with different device numbers.
|
||||
*/
|
||||
|
||||
static int floppy_open( struct inode *inode, struct file *filp )
|
||||
static int floppy_open(struct block_device *bdev, fmode_t mode)
|
||||
{
|
||||
struct atari_floppy_struct *p = inode->i_bdev->bd_disk->private_data;
|
||||
int type = iminor(inode) >> 2;
|
||||
struct atari_floppy_struct *p = bdev->bd_disk->private_data;
|
||||
int type = MINOR(bdev->bd_dev) >> 2;
|
||||
|
||||
DPRINT(("fd_open: type=%d\n",type));
|
||||
if (p->ref && p->type != type)
|
||||
return -EBUSY;
|
||||
|
||||
if (p->ref == -1 || (p->ref && filp->f_flags & O_EXCL))
|
||||
if (p->ref == -1 || (p->ref && mode & FMODE_EXCL))
|
||||
return -EBUSY;
|
||||
|
||||
if (filp->f_flags & O_EXCL)
|
||||
if (mode & FMODE_EXCL)
|
||||
p->ref = -1;
|
||||
else
|
||||
p->ref++;
|
||||
|
||||
p->type = type;
|
||||
|
||||
if (filp->f_flags & O_NDELAY)
|
||||
if (mode & FMODE_NDELAY)
|
||||
return 0;
|
||||
|
||||
if (filp->f_mode & 3) {
|
||||
check_disk_change(inode->i_bdev);
|
||||
if (filp->f_mode & 2) {
|
||||
if (mode & (FMODE_READ|FMODE_WRITE)) {
|
||||
check_disk_change(bdev);
|
||||
if (mode & FMODE_WRITE) {
|
||||
if (p->wpstat) {
|
||||
if (p->ref < 0)
|
||||
p->ref = 0;
|
||||
else
|
||||
p->ref--;
|
||||
floppy_release(inode, filp);
|
||||
return -EROFS;
|
||||
}
|
||||
}
|
||||
@@ -1843,9 +1842,9 @@ static int floppy_open( struct inode *inode, struct file *filp )
|
||||
}
|
||||
|
||||
|
||||
static int floppy_release( struct inode * inode, struct file * filp )
|
||||
static int floppy_release(struct gendisk *disk, fmode_t mode)
|
||||
{
|
||||
struct atari_floppy_struct *p = inode->i_bdev->bd_disk->private_data;
|
||||
struct atari_floppy_struct *p = disk->private_data;
|
||||
if (p->ref < 0)
|
||||
p->ref = 0;
|
||||
else if (!p->ref--) {
|
||||
@@ -1859,7 +1858,7 @@ static struct block_device_operations floppy_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = floppy_open,
|
||||
.release = floppy_release,
|
||||
.ioctl = fd_ioctl,
|
||||
.locked_ioctl = fd_ioctl,
|
||||
.media_changed = check_floppy_change,
|
||||
.revalidate_disk= floppy_revalidate,
|
||||
};
|
||||
|
||||
+2
-3
@@ -340,11 +340,10 @@ static int brd_direct_access (struct block_device *bdev, sector_t sector,
|
||||
}
|
||||
#endif
|
||||
|
||||
static int brd_ioctl(struct inode *inode, struct file *file,
|
||||
static int brd_ioctl(struct block_device *bdev, fmode_t mode,
|
||||
unsigned int cmd, unsigned long arg)
|
||||
{
|
||||
int error;
|
||||
struct block_device *bdev = inode->i_bdev;
|
||||
struct brd_device *brd = bdev->bd_disk->private_data;
|
||||
|
||||
if (cmd != BLKFLSBUF)
|
||||
@@ -376,7 +375,7 @@ static int brd_ioctl(struct inode *inode, struct file *file,
|
||||
|
||||
static struct block_device_operations brd_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.ioctl = brd_ioctl,
|
||||
.locked_ioctl = brd_ioctl,
|
||||
#ifdef CONFIG_BLK_DEV_XIP
|
||||
.direct_access = brd_direct_access,
|
||||
#endif
|
||||
|
||||
+36
-35
@@ -152,9 +152,9 @@ static ctlr_info_t *hba[MAX_CTLR];
|
||||
|
||||
static void do_cciss_request(struct request_queue *q);
|
||||
static irqreturn_t do_cciss_intr(int irq, void *dev_id);
|
||||
static int cciss_open(struct inode *inode, struct file *filep);
|
||||
static int cciss_release(struct inode *inode, struct file *filep);
|
||||
static int cciss_ioctl(struct inode *inode, struct file *filep,
|
||||
static int cciss_open(struct block_device *bdev, fmode_t mode);
|
||||
static int cciss_release(struct gendisk *disk, fmode_t mode);
|
||||
static int cciss_ioctl(struct block_device *bdev, fmode_t mode,
|
||||
unsigned int cmd, unsigned long arg);
|
||||
static int cciss_getgeo(struct block_device *bdev, struct hd_geometry *geo);
|
||||
|
||||
@@ -192,14 +192,15 @@ static void cciss_procinit(int i)
|
||||
#endif /* CONFIG_PROC_FS */
|
||||
|
||||
#ifdef CONFIG_COMPAT
|
||||
static long cciss_compat_ioctl(struct file *f, unsigned cmd, unsigned long arg);
|
||||
static int cciss_compat_ioctl(struct block_device *, fmode_t,
|
||||
unsigned, unsigned long);
|
||||
#endif
|
||||
|
||||
static struct block_device_operations cciss_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = cciss_open,
|
||||
.release = cciss_release,
|
||||
.ioctl = cciss_ioctl,
|
||||
.locked_ioctl = cciss_ioctl,
|
||||
.getgeo = cciss_getgeo,
|
||||
#ifdef CONFIG_COMPAT
|
||||
.compat_ioctl = cciss_compat_ioctl,
|
||||
@@ -547,13 +548,13 @@ static inline drive_info_struct *get_drv(struct gendisk *disk)
|
||||
/*
|
||||
* Open. Make sure the device is really there.
|
||||
*/
|
||||
static int cciss_open(struct inode *inode, struct file *filep)
|
||||
static int cciss_open(struct block_device *bdev, fmode_t mode)
|
||||
{
|
||||
ctlr_info_t *host = get_host(inode->i_bdev->bd_disk);
|
||||
drive_info_struct *drv = get_drv(inode->i_bdev->bd_disk);
|
||||
ctlr_info_t *host = get_host(bdev->bd_disk);
|
||||
drive_info_struct *drv = get_drv(bdev->bd_disk);
|
||||
|
||||
#ifdef CCISS_DEBUG
|
||||
printk(KERN_DEBUG "cciss_open %s\n", inode->i_bdev->bd_disk->disk_name);
|
||||
printk(KERN_DEBUG "cciss_open %s\n", bdev->bd_disk->disk_name);
|
||||
#endif /* CCISS_DEBUG */
|
||||
|
||||
if (host->busy_initializing || drv->busy_configuring)
|
||||
@@ -567,9 +568,9 @@ static int cciss_open(struct inode *inode, struct file *filep)
|
||||
* for "raw controller".
|
||||
*/
|
||||
if (drv->heads == 0) {
|
||||
if (iminor(inode) != 0) { /* not node 0? */
|
||||
if (MINOR(bdev->bd_dev) != 0) { /* not node 0? */
|
||||
/* if not node 0 make sure it is a partition = 0 */
|
||||
if (iminor(inode) & 0x0f) {
|
||||
if (MINOR(bdev->bd_dev) & 0x0f) {
|
||||
return -ENXIO;
|
||||
/* if it is, make sure we have a LUN ID */
|
||||
} else if (drv->LunID == 0) {
|
||||
@@ -587,14 +588,13 @@ static int cciss_open(struct inode *inode, struct file *filep)
|
||||
/*
|
||||
* Close. Sync first.
|
||||
*/
|
||||
static int cciss_release(struct inode *inode, struct file *filep)
|
||||
static int cciss_release(struct gendisk *disk, fmode_t mode)
|
||||
{
|
||||
ctlr_info_t *host = get_host(inode->i_bdev->bd_disk);
|
||||
drive_info_struct *drv = get_drv(inode->i_bdev->bd_disk);
|
||||
ctlr_info_t *host = get_host(disk);
|
||||
drive_info_struct *drv = get_drv(disk);
|
||||
|
||||
#ifdef CCISS_DEBUG
|
||||
printk(KERN_DEBUG "cciss_release %s\n",
|
||||
inode->i_bdev->bd_disk->disk_name);
|
||||
printk(KERN_DEBUG "cciss_release %s\n", disk->disk_name);
|
||||
#endif /* CCISS_DEBUG */
|
||||
|
||||
drv->usage_count--;
|
||||
@@ -604,21 +604,23 @@ static int cciss_release(struct inode *inode, struct file *filep)
|
||||
|
||||
#ifdef CONFIG_COMPAT
|
||||
|
||||
static int do_ioctl(struct file *f, unsigned cmd, unsigned long arg)
|
||||
static int do_ioctl(struct block_device *bdev, fmode_t mode,
|
||||
unsigned cmd, unsigned long arg)
|
||||
{
|
||||
int ret;
|
||||
lock_kernel();
|
||||
ret = cciss_ioctl(f->f_path.dentry->d_inode, f, cmd, arg);
|
||||
ret = cciss_ioctl(bdev, mode, cmd, arg);
|
||||
unlock_kernel();
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int cciss_ioctl32_passthru(struct file *f, unsigned cmd,
|
||||
unsigned long arg);
|
||||
static int cciss_ioctl32_big_passthru(struct file *f, unsigned cmd,
|
||||
unsigned long arg);
|
||||
static int cciss_ioctl32_passthru(struct block_device *bdev, fmode_t mode,
|
||||
unsigned cmd, unsigned long arg);
|
||||
static int cciss_ioctl32_big_passthru(struct block_device *bdev, fmode_t mode,
|
||||
unsigned cmd, unsigned long arg);
|
||||
|
||||
static long cciss_compat_ioctl(struct file *f, unsigned cmd, unsigned long arg)
|
||||
static int cciss_compat_ioctl(struct block_device *bdev, fmode_t mode,
|
||||
unsigned cmd, unsigned long arg)
|
||||
{
|
||||
switch (cmd) {
|
||||
case CCISS_GETPCIINFO:
|
||||
@@ -636,20 +638,20 @@ static long cciss_compat_ioctl(struct file *f, unsigned cmd, unsigned long arg)
|
||||
case CCISS_REGNEWD:
|
||||
case CCISS_RESCANDISK:
|
||||
case CCISS_GETLUNINFO:
|
||||
return do_ioctl(f, cmd, arg);
|
||||
return do_ioctl(bdev, mode, cmd, arg);
|
||||
|
||||
case CCISS_PASSTHRU32:
|
||||
return cciss_ioctl32_passthru(f, cmd, arg);
|
||||
return cciss_ioctl32_passthru(bdev, mode, cmd, arg);
|
||||
case CCISS_BIG_PASSTHRU32:
|
||||
return cciss_ioctl32_big_passthru(f, cmd, arg);
|
||||
return cciss_ioctl32_big_passthru(bdev, mode, cmd, arg);
|
||||
|
||||
default:
|
||||
return -ENOIOCTLCMD;
|
||||
}
|
||||
}
|
||||
|
||||
static int cciss_ioctl32_passthru(struct file *f, unsigned cmd,
|
||||
unsigned long arg)
|
||||
static int cciss_ioctl32_passthru(struct block_device *bdev, fmode_t mode,
|
||||
unsigned cmd, unsigned long arg)
|
||||
{
|
||||
IOCTL32_Command_struct __user *arg32 =
|
||||
(IOCTL32_Command_struct __user *) arg;
|
||||
@@ -676,7 +678,7 @@ static int cciss_ioctl32_passthru(struct file *f, unsigned cmd,
|
||||
if (err)
|
||||
return -EFAULT;
|
||||
|
||||
err = do_ioctl(f, CCISS_PASSTHRU, (unsigned long)p);
|
||||
err = do_ioctl(bdev, mode, CCISS_PASSTHRU, (unsigned long)p);
|
||||
if (err)
|
||||
return err;
|
||||
err |=
|
||||
@@ -687,8 +689,8 @@ static int cciss_ioctl32_passthru(struct file *f, unsigned cmd,
|
||||
return err;
|
||||
}
|
||||
|
||||
static int cciss_ioctl32_big_passthru(struct file *file, unsigned cmd,
|
||||
unsigned long arg)
|
||||
static int cciss_ioctl32_big_passthru(struct block_device *bdev, fmode_t mode,
|
||||
unsigned cmd, unsigned long arg)
|
||||
{
|
||||
BIG_IOCTL32_Command_struct __user *arg32 =
|
||||
(BIG_IOCTL32_Command_struct __user *) arg;
|
||||
@@ -717,7 +719,7 @@ static int cciss_ioctl32_big_passthru(struct file *file, unsigned cmd,
|
||||
if (err)
|
||||
return -EFAULT;
|
||||
|
||||
err = do_ioctl(file, CCISS_BIG_PASSTHRU, (unsigned long)p);
|
||||
err = do_ioctl(bdev, mode, CCISS_BIG_PASSTHRU, (unsigned long)p);
|
||||
if (err)
|
||||
return err;
|
||||
err |=
|
||||
@@ -745,10 +747,9 @@ static int cciss_getgeo(struct block_device *bdev, struct hd_geometry *geo)
|
||||
/*
|
||||
* ioctl
|
||||
*/
|
||||
static int cciss_ioctl(struct inode *inode, struct file *filep,
|
||||
static int cciss_ioctl(struct block_device *bdev, fmode_t mode,
|
||||
unsigned int cmd, unsigned long arg)
|
||||
{
|
||||
struct block_device *bdev = inode->i_bdev;
|
||||
struct gendisk *disk = bdev->bd_disk;
|
||||
ctlr_info_t *host = get_host(disk);
|
||||
drive_info_struct *drv = get_drv(disk);
|
||||
@@ -1232,7 +1233,7 @@ static int cciss_ioctl(struct inode *inode, struct file *filep,
|
||||
case SG_EMULATED_HOST:
|
||||
case SG_IO:
|
||||
case SCSI_IOCTL_SEND_COMMAND:
|
||||
return scsi_cmd_ioctl(filep, disk->queue, disk, cmd, argp);
|
||||
return scsi_cmd_ioctl(disk->queue, disk, mode, cmd, argp);
|
||||
|
||||
/* scsi_cmd_ioctl would normally handle these, below, but */
|
||||
/* they aren't a good fit for cciss, as CD-ROMs are */
|
||||
|
||||
+14
-14
@@ -156,9 +156,9 @@ static int sendcmd(
|
||||
unsigned int blkcnt,
|
||||
unsigned int log_unit );
|
||||
|
||||
static int ida_open(struct inode *inode, struct file *filep);
|
||||
static int ida_release(struct inode *inode, struct file *filep);
|
||||
static int ida_ioctl(struct inode *inode, struct file *filep, unsigned int cmd, unsigned long arg);
|
||||
static int ida_open(struct block_device *bdev, fmode_t mode);
|
||||
static int ida_release(struct gendisk *disk, fmode_t mode);
|
||||
static int ida_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd, unsigned long arg);
|
||||
static int ida_getgeo(struct block_device *bdev, struct hd_geometry *geo);
|
||||
static int ida_ctlr_ioctl(ctlr_info_t *h, int dsk, ida_ioctl_t *io);
|
||||
|
||||
@@ -197,7 +197,7 @@ static struct block_device_operations ida_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = ida_open,
|
||||
.release = ida_release,
|
||||
.ioctl = ida_ioctl,
|
||||
.locked_ioctl = ida_ioctl,
|
||||
.getgeo = ida_getgeo,
|
||||
.revalidate_disk= ida_revalidate,
|
||||
};
|
||||
@@ -818,12 +818,12 @@ DBGINFO(
|
||||
/*
|
||||
* Open. Make sure the device is really there.
|
||||
*/
|
||||
static int ida_open(struct inode *inode, struct file *filep)
|
||||
static int ida_open(struct block_device *bdev, fmode_t mode)
|
||||
{
|
||||
drv_info_t *drv = get_drv(inode->i_bdev->bd_disk);
|
||||
ctlr_info_t *host = get_host(inode->i_bdev->bd_disk);
|
||||
drv_info_t *drv = get_drv(bdev->bd_disk);
|
||||
ctlr_info_t *host = get_host(bdev->bd_disk);
|
||||
|
||||
DBGINFO(printk("ida_open %s\n", inode->i_bdev->bd_disk->disk_name));
|
||||
DBGINFO(printk("ida_open %s\n", bdev->bd_disk->disk_name));
|
||||
/*
|
||||
* Root is allowed to open raw volume zero even if it's not configured
|
||||
* so array config can still work. I don't think I really like this,
|
||||
@@ -843,9 +843,9 @@ static int ida_open(struct inode *inode, struct file *filep)
|
||||
/*
|
||||
* Close. Sync first.
|
||||
*/
|
||||
static int ida_release(struct inode *inode, struct file *filep)
|
||||
static int ida_release(struct gendisk *disk, fmode_t mode)
|
||||
{
|
||||
ctlr_info_t *host = get_host(inode->i_bdev->bd_disk);
|
||||
ctlr_info_t *host = get_host(disk);
|
||||
host->usage_count--;
|
||||
return 0;
|
||||
}
|
||||
@@ -1128,10 +1128,10 @@ static int ida_getgeo(struct block_device *bdev, struct hd_geometry *geo)
|
||||
* ida_ioctl does some miscellaneous stuff like reporting drive geometry,
|
||||
* setting readahead and submitting commands from userspace to the controller.
|
||||
*/
|
||||
static int ida_ioctl(struct inode *inode, struct file *filep, unsigned int cmd, unsigned long arg)
|
||||
static int ida_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd, unsigned long arg)
|
||||
{
|
||||
drv_info_t *drv = get_drv(inode->i_bdev->bd_disk);
|
||||
ctlr_info_t *host = get_host(inode->i_bdev->bd_disk);
|
||||
drv_info_t *drv = get_drv(bdev->bd_disk);
|
||||
ctlr_info_t *host = get_host(bdev->bd_disk);
|
||||
int error;
|
||||
ida_ioctl_t __user *io = (ida_ioctl_t __user *)arg;
|
||||
ida_ioctl_t *my_io;
|
||||
@@ -1165,7 +1165,7 @@ out_passthru:
|
||||
put_user(host->ctlr_sig, (int __user *)arg);
|
||||
return 0;
|
||||
case IDAREVALIDATEVOLS:
|
||||
if (iminor(inode) != 0)
|
||||
if (MINOR(bdev->bd_dev) != 0)
|
||||
return -ENXIO;
|
||||
return revalidate_allvol(host);
|
||||
case IDADRIVERVERSION:
|
||||
|
||||
+24
-30
@@ -3450,14 +3450,14 @@ static int fd_getgeo(struct block_device *bdev, struct hd_geometry *geo)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int fd_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
|
||||
static int fd_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd,
|
||||
unsigned long param)
|
||||
{
|
||||
#define FD_IOCTL_ALLOWED ((filp) && (filp)->private_data)
|
||||
#define FD_IOCTL_ALLOWED (mode & (FMODE_WRITE|FMODE_WRITE_IOCTL))
|
||||
#define OUT(c,x) case c: outparam = (const char *) (x); break
|
||||
#define IN(c,x,tag) case c: *(x) = inparam. tag ; return 0
|
||||
|
||||
int drive = (long)inode->i_bdev->bd_disk->private_data;
|
||||
int drive = (long)bdev->bd_disk->private_data;
|
||||
int type = ITYPE(UDRS->fd_device);
|
||||
int i;
|
||||
int ret;
|
||||
@@ -3516,11 +3516,11 @@ static int fd_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
|
||||
current_type[drive] = NULL;
|
||||
floppy_sizes[drive] = MAX_DISK_SIZE << 1;
|
||||
UDRS->keep_data = 0;
|
||||
return invalidate_drive(inode->i_bdev);
|
||||
return invalidate_drive(bdev);
|
||||
case FDSETPRM:
|
||||
case FDDEFPRM:
|
||||
return set_geometry(cmd, &inparam.g,
|
||||
drive, type, inode->i_bdev);
|
||||
drive, type, bdev);
|
||||
case FDGETPRM:
|
||||
ECALL(get_floppy_geometry(drive, type,
|
||||
(struct floppy_struct **)
|
||||
@@ -3551,7 +3551,7 @@ static int fd_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
|
||||
case FDFMTEND:
|
||||
case FDFLUSH:
|
||||
LOCK_FDC(drive, 1);
|
||||
return invalidate_drive(inode->i_bdev);
|
||||
return invalidate_drive(bdev);
|
||||
|
||||
case FDSETEMSGTRESH:
|
||||
UDP->max_errors.reporting =
|
||||
@@ -3659,9 +3659,9 @@ static void __init config_types(void)
|
||||
printk("\n");
|
||||
}
|
||||
|
||||
static int floppy_release(struct inode *inode, struct file *filp)
|
||||
static int floppy_release(struct gendisk *disk, fmode_t mode)
|
||||
{
|
||||
int drive = (long)inode->i_bdev->bd_disk->private_data;
|
||||
int drive = (long)disk->private_data;
|
||||
|
||||
mutex_lock(&open_lock);
|
||||
if (UDRS->fd_ref < 0)
|
||||
@@ -3682,18 +3682,17 @@ static int floppy_release(struct inode *inode, struct file *filp)
|
||||
* /dev/PS0 etc), and disallows simultaneous access to the same
|
||||
* drive with different device numbers.
|
||||
*/
|
||||
static int floppy_open(struct inode *inode, struct file *filp)
|
||||
static int floppy_open(struct block_device *bdev, fmode_t mode)
|
||||
{
|
||||
int drive = (long)inode->i_bdev->bd_disk->private_data;
|
||||
int old_dev;
|
||||
int drive = (long)bdev->bd_disk->private_data;
|
||||
int old_dev, new_dev;
|
||||
int try;
|
||||
int res = -EBUSY;
|
||||
char *tmp;
|
||||
|
||||
filp->private_data = (void *)0;
|
||||
mutex_lock(&open_lock);
|
||||
old_dev = UDRS->fd_device;
|
||||
if (opened_bdev[drive] && opened_bdev[drive] != inode->i_bdev)
|
||||
if (opened_bdev[drive] && opened_bdev[drive] != bdev)
|
||||
goto out2;
|
||||
|
||||
if (!UDRS->fd_ref && (UDP->flags & FD_BROKEN_DCL)) {
|
||||
@@ -3701,15 +3700,15 @@ static int floppy_open(struct inode *inode, struct file *filp)
|
||||
USETF(FD_VERIFY);
|
||||
}
|
||||
|
||||
if (UDRS->fd_ref == -1 || (UDRS->fd_ref && (filp->f_flags & O_EXCL)))
|
||||
if (UDRS->fd_ref == -1 || (UDRS->fd_ref && (mode & FMODE_EXCL)))
|
||||
goto out2;
|
||||
|
||||
if (filp->f_flags & O_EXCL)
|
||||
if (mode & FMODE_EXCL)
|
||||
UDRS->fd_ref = -1;
|
||||
else
|
||||
UDRS->fd_ref++;
|
||||
|
||||
opened_bdev[drive] = inode->i_bdev;
|
||||
opened_bdev[drive] = bdev;
|
||||
|
||||
res = -ENXIO;
|
||||
|
||||
@@ -3744,31 +3743,26 @@ static int floppy_open(struct inode *inode, struct file *filp)
|
||||
}
|
||||
}
|
||||
|
||||
UDRS->fd_device = iminor(inode);
|
||||
set_capacity(disks[drive], floppy_sizes[iminor(inode)]);
|
||||
if (old_dev != -1 && old_dev != iminor(inode)) {
|
||||
new_dev = MINOR(bdev->bd_dev);
|
||||
UDRS->fd_device = new_dev;
|
||||
set_capacity(disks[drive], floppy_sizes[new_dev]);
|
||||
if (old_dev != -1 && old_dev != new_dev) {
|
||||
if (buffer_drive == drive)
|
||||
buffer_track = -1;
|
||||
}
|
||||
|
||||
/* Allow ioctls if we have write-permissions even if read-only open.
|
||||
* Needed so that programs such as fdrawcmd still can work on write
|
||||
* protected disks */
|
||||
if ((filp->f_mode & FMODE_WRITE) || !file_permission(filp, MAY_WRITE))
|
||||
filp->private_data = (void *)8;
|
||||
|
||||
if (UFDCS->rawcmd == 1)
|
||||
UFDCS->rawcmd = 2;
|
||||
|
||||
if (!(filp->f_flags & O_NDELAY)) {
|
||||
if (filp->f_mode & 3) {
|
||||
if (!(mode & FMODE_NDELAY)) {
|
||||
if (mode & (FMODE_READ|FMODE_WRITE)) {
|
||||
UDRS->last_checked = 0;
|
||||
check_disk_change(inode->i_bdev);
|
||||
check_disk_change(bdev);
|
||||
if (UTESTF(FD_DISK_CHANGED))
|
||||
goto out;
|
||||
}
|
||||
res = -EROFS;
|
||||
if ((filp->f_mode & 2) && !(UTESTF(FD_DISK_WRITABLE)))
|
||||
if ((mode & FMODE_WRITE) && !(UTESTF(FD_DISK_WRITABLE)))
|
||||
goto out;
|
||||
}
|
||||
mutex_unlock(&open_lock);
|
||||
@@ -3911,7 +3905,7 @@ static struct block_device_operations floppy_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = floppy_open,
|
||||
.release = floppy_release,
|
||||
.ioctl = fd_ioctl,
|
||||
.locked_ioctl = fd_ioctl,
|
||||
.getgeo = fd_getgeo,
|
||||
.media_changed = check_floppy_change,
|
||||
.revalidate_disk = floppy_revalidate,
|
||||
|
||||
+30
-29
@@ -210,7 +210,7 @@ lo_do_transfer(struct loop_device *lo, int cmd,
|
||||
* space operations write_begin and write_end.
|
||||
*/
|
||||
static int do_lo_send_aops(struct loop_device *lo, struct bio_vec *bvec,
|
||||
int bsize, loff_t pos, struct page *unused)
|
||||
loff_t pos, struct page *unused)
|
||||
{
|
||||
struct file *file = lo->lo_backing_file; /* kudos to NFsckingS */
|
||||
struct address_space *mapping = file->f_mapping;
|
||||
@@ -302,7 +302,7 @@ static int __do_lo_send_write(struct file *file,
|
||||
* filesystems.
|
||||
*/
|
||||
static int do_lo_send_direct_write(struct loop_device *lo,
|
||||
struct bio_vec *bvec, int bsize, loff_t pos, struct page *page)
|
||||
struct bio_vec *bvec, loff_t pos, struct page *page)
|
||||
{
|
||||
ssize_t bw = __do_lo_send_write(lo->lo_backing_file,
|
||||
kmap(bvec->bv_page) + bvec->bv_offset,
|
||||
@@ -326,7 +326,7 @@ static int do_lo_send_direct_write(struct loop_device *lo,
|
||||
* destination pages of the backing file.
|
||||
*/
|
||||
static int do_lo_send_write(struct loop_device *lo, struct bio_vec *bvec,
|
||||
int bsize, loff_t pos, struct page *page)
|
||||
loff_t pos, struct page *page)
|
||||
{
|
||||
int ret = lo_do_transfer(lo, WRITE, page, 0, bvec->bv_page,
|
||||
bvec->bv_offset, bvec->bv_len, pos >> 9);
|
||||
@@ -341,10 +341,9 @@ static int do_lo_send_write(struct loop_device *lo, struct bio_vec *bvec,
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int lo_send(struct loop_device *lo, struct bio *bio, int bsize,
|
||||
loff_t pos)
|
||||
static int lo_send(struct loop_device *lo, struct bio *bio, loff_t pos)
|
||||
{
|
||||
int (*do_lo_send)(struct loop_device *, struct bio_vec *, int, loff_t,
|
||||
int (*do_lo_send)(struct loop_device *, struct bio_vec *, loff_t,
|
||||
struct page *page);
|
||||
struct bio_vec *bvec;
|
||||
struct page *page = NULL;
|
||||
@@ -362,7 +361,7 @@ static int lo_send(struct loop_device *lo, struct bio *bio, int bsize,
|
||||
}
|
||||
}
|
||||
bio_for_each_segment(bvec, bio, i) {
|
||||
ret = do_lo_send(lo, bvec, bsize, pos, page);
|
||||
ret = do_lo_send(lo, bvec, pos, page);
|
||||
if (ret < 0)
|
||||
break;
|
||||
pos += bvec->bv_len;
|
||||
@@ -478,7 +477,7 @@ static int do_bio_filebacked(struct loop_device *lo, struct bio *bio)
|
||||
|
||||
pos = ((loff_t) bio->bi_sector << 9) + lo->lo_offset;
|
||||
if (bio_rw(bio) == WRITE)
|
||||
ret = lo_send(lo, bio, lo->lo_blocksize, pos);
|
||||
ret = lo_send(lo, bio, pos);
|
||||
else
|
||||
ret = lo_receive(lo, bio, lo->lo_blocksize, pos);
|
||||
return ret;
|
||||
@@ -652,8 +651,8 @@ static void do_loop_switch(struct loop_device *lo, struct switch_request *p)
|
||||
* This can only work if the loop device is used read-only, and if the
|
||||
* new backing store is the same size and type as the old backing store.
|
||||
*/
|
||||
static int loop_change_fd(struct loop_device *lo, struct file *lo_file,
|
||||
struct block_device *bdev, unsigned int arg)
|
||||
static int loop_change_fd(struct loop_device *lo, struct block_device *bdev,
|
||||
unsigned int arg)
|
||||
{
|
||||
struct file *file, *old_file;
|
||||
struct inode *inode;
|
||||
@@ -712,7 +711,7 @@ static inline int is_loop_device(struct file *file)
|
||||
return i && S_ISBLK(i->i_mode) && MAJOR(i->i_rdev) == LOOP_MAJOR;
|
||||
}
|
||||
|
||||
static int loop_set_fd(struct loop_device *lo, struct file *lo_file,
|
||||
static int loop_set_fd(struct loop_device *lo, fmode_t mode,
|
||||
struct block_device *bdev, unsigned int arg)
|
||||
{
|
||||
struct file *file, *f;
|
||||
@@ -740,7 +739,7 @@ static int loop_set_fd(struct loop_device *lo, struct file *lo_file,
|
||||
while (is_loop_device(f)) {
|
||||
struct loop_device *l;
|
||||
|
||||
if (f->f_mapping->host->i_rdev == lo_file->f_mapping->host->i_rdev)
|
||||
if (f->f_mapping->host->i_bdev == bdev)
|
||||
goto out_putf;
|
||||
|
||||
l = f->f_mapping->host->i_bdev->bd_disk->private_data;
|
||||
@@ -786,7 +785,7 @@ static int loop_set_fd(struct loop_device *lo, struct file *lo_file,
|
||||
goto out_putf;
|
||||
}
|
||||
|
||||
if (!(lo_file->f_mode & FMODE_WRITE))
|
||||
if (!(mode & FMODE_WRITE))
|
||||
lo_flags |= LO_FLAGS_READ_ONLY;
|
||||
|
||||
set_device_ro(bdev, (lo_flags & LO_FLAGS_READ_ONLY) != 0);
|
||||
@@ -918,9 +917,11 @@ static int loop_clr_fd(struct loop_device *lo, struct block_device *bdev)
|
||||
memset(lo->lo_encrypt_key, 0, LO_KEY_SIZE);
|
||||
memset(lo->lo_crypt_name, 0, LO_NAME_SIZE);
|
||||
memset(lo->lo_file_name, 0, LO_NAME_SIZE);
|
||||
invalidate_bdev(bdev);
|
||||
if (bdev)
|
||||
invalidate_bdev(bdev);
|
||||
set_capacity(lo->lo_disk, 0);
|
||||
bd_set_size(bdev, 0);
|
||||
if (bdev)
|
||||
bd_set_size(bdev, 0);
|
||||
mapping_set_gfp_mask(filp->f_mapping, gfp);
|
||||
lo->lo_state = Lo_unbound;
|
||||
fput(filp);
|
||||
@@ -1137,22 +1138,22 @@ loop_get_status64(struct loop_device *lo, struct loop_info64 __user *arg) {
|
||||
return err;
|
||||
}
|
||||
|
||||
static int lo_ioctl(struct inode * inode, struct file * file,
|
||||
static int lo_ioctl(struct block_device *bdev, fmode_t mode,
|
||||
unsigned int cmd, unsigned long arg)
|
||||
{
|
||||
struct loop_device *lo = inode->i_bdev->bd_disk->private_data;
|
||||
struct loop_device *lo = bdev->bd_disk->private_data;
|
||||
int err;
|
||||
|
||||
mutex_lock(&lo->lo_ctl_mutex);
|
||||
switch (cmd) {
|
||||
case LOOP_SET_FD:
|
||||
err = loop_set_fd(lo, file, inode->i_bdev, arg);
|
||||
err = loop_set_fd(lo, mode, bdev, arg);
|
||||
break;
|
||||
case LOOP_CHANGE_FD:
|
||||
err = loop_change_fd(lo, file, inode->i_bdev, arg);
|
||||
err = loop_change_fd(lo, bdev, arg);
|
||||
break;
|
||||
case LOOP_CLR_FD:
|
||||
err = loop_clr_fd(lo, inode->i_bdev);
|
||||
err = loop_clr_fd(lo, bdev);
|
||||
break;
|
||||
case LOOP_SET_STATUS:
|
||||
err = loop_set_status_old(lo, (struct loop_info __user *) arg);
|
||||
@@ -1292,10 +1293,10 @@ loop_get_status_compat(struct loop_device *lo,
|
||||
return err;
|
||||
}
|
||||
|
||||
static long lo_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
|
||||
static int lo_compat_ioctl(struct block_device *bdev, fmode_t mode,
|
||||
unsigned int cmd, unsigned long arg)
|
||||
{
|
||||
struct inode *inode = file->f_path.dentry->d_inode;
|
||||
struct loop_device *lo = inode->i_bdev->bd_disk->private_data;
|
||||
struct loop_device *lo = bdev->bd_disk->private_data;
|
||||
int err;
|
||||
|
||||
switch(cmd) {
|
||||
@@ -1317,7 +1318,7 @@ static long lo_compat_ioctl(struct file *file, unsigned int cmd, unsigned long a
|
||||
arg = (unsigned long) compat_ptr(arg);
|
||||
case LOOP_SET_FD:
|
||||
case LOOP_CHANGE_FD:
|
||||
err = lo_ioctl(inode, file, cmd, arg);
|
||||
err = lo_ioctl(bdev, mode, cmd, arg);
|
||||
break;
|
||||
default:
|
||||
err = -ENOIOCTLCMD;
|
||||
@@ -1327,9 +1328,9 @@ static long lo_compat_ioctl(struct file *file, unsigned int cmd, unsigned long a
|
||||
}
|
||||
#endif
|
||||
|
||||
static int lo_open(struct inode *inode, struct file *file)
|
||||
static int lo_open(struct block_device *bdev, fmode_t mode)
|
||||
{
|
||||
struct loop_device *lo = inode->i_bdev->bd_disk->private_data;
|
||||
struct loop_device *lo = bdev->bd_disk->private_data;
|
||||
|
||||
mutex_lock(&lo->lo_ctl_mutex);
|
||||
lo->lo_refcnt++;
|
||||
@@ -1338,15 +1339,15 @@ static int lo_open(struct inode *inode, struct file *file)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int lo_release(struct inode *inode, struct file *file)
|
||||
static int lo_release(struct gendisk *disk, fmode_t mode)
|
||||
{
|
||||
struct loop_device *lo = inode->i_bdev->bd_disk->private_data;
|
||||
struct loop_device *lo = disk->private_data;
|
||||
|
||||
mutex_lock(&lo->lo_ctl_mutex);
|
||||
--lo->lo_refcnt;
|
||||
|
||||
if ((lo->lo_flags & LO_FLAGS_AUTOCLEAR) && !lo->lo_refcnt)
|
||||
loop_clr_fd(lo, inode->i_bdev);
|
||||
loop_clr_fd(lo, NULL);
|
||||
|
||||
mutex_unlock(&lo->lo_ctl_mutex);
|
||||
|
||||
|
||||
+14
-14
@@ -557,10 +557,11 @@ static void do_nbd_request(struct request_queue * q)
|
||||
}
|
||||
}
|
||||
|
||||
static int nbd_ioctl(struct inode *inode, struct file *file,
|
||||
static int nbd_ioctl(struct block_device *bdev, fmode_t mode,
|
||||
unsigned int cmd, unsigned long arg)
|
||||
{
|
||||
struct nbd_device *lo = inode->i_bdev->bd_disk->private_data;
|
||||
struct nbd_device *lo = bdev->bd_disk->private_data;
|
||||
struct file *file;
|
||||
int error;
|
||||
struct request sreq ;
|
||||
struct task_struct *thread;
|
||||
@@ -612,8 +613,7 @@ static int nbd_ioctl(struct inode *inode, struct file *file,
|
||||
error = -EINVAL;
|
||||
file = fget(arg);
|
||||
if (file) {
|
||||
struct block_device *bdev = inode->i_bdev;
|
||||
inode = file->f_path.dentry->d_inode;
|
||||
struct inode *inode = file->f_path.dentry->d_inode;
|
||||
if (S_ISSOCK(inode->i_mode)) {
|
||||
lo->file = file;
|
||||
lo->sock = SOCKET_I(inode);
|
||||
@@ -628,14 +628,14 @@ static int nbd_ioctl(struct inode *inode, struct file *file,
|
||||
case NBD_SET_BLKSIZE:
|
||||
lo->blksize = arg;
|
||||
lo->bytesize &= ~(lo->blksize-1);
|
||||
inode->i_bdev->bd_inode->i_size = lo->bytesize;
|
||||
set_blocksize(inode->i_bdev, lo->blksize);
|
||||
bdev->bd_inode->i_size = lo->bytesize;
|
||||
set_blocksize(bdev, lo->blksize);
|
||||
set_capacity(lo->disk, lo->bytesize >> 9);
|
||||
return 0;
|
||||
case NBD_SET_SIZE:
|
||||
lo->bytesize = arg & ~(lo->blksize-1);
|
||||
inode->i_bdev->bd_inode->i_size = lo->bytesize;
|
||||
set_blocksize(inode->i_bdev, lo->blksize);
|
||||
bdev->bd_inode->i_size = lo->bytesize;
|
||||
set_blocksize(bdev, lo->blksize);
|
||||
set_capacity(lo->disk, lo->bytesize >> 9);
|
||||
return 0;
|
||||
case NBD_SET_TIMEOUT:
|
||||
@@ -643,8 +643,8 @@ static int nbd_ioctl(struct inode *inode, struct file *file,
|
||||
return 0;
|
||||
case NBD_SET_SIZE_BLOCKS:
|
||||
lo->bytesize = ((u64) arg) * lo->blksize;
|
||||
inode->i_bdev->bd_inode->i_size = lo->bytesize;
|
||||
set_blocksize(inode->i_bdev, lo->blksize);
|
||||
bdev->bd_inode->i_size = lo->bytesize;
|
||||
set_blocksize(bdev, lo->blksize);
|
||||
set_capacity(lo->disk, lo->bytesize >> 9);
|
||||
return 0;
|
||||
case NBD_DO_IT:
|
||||
@@ -666,10 +666,10 @@ static int nbd_ioctl(struct inode *inode, struct file *file,
|
||||
if (file)
|
||||
fput(file);
|
||||
lo->bytesize = 0;
|
||||
inode->i_bdev->bd_inode->i_size = 0;
|
||||
bdev->bd_inode->i_size = 0;
|
||||
set_capacity(lo->disk, 0);
|
||||
if (max_part > 0)
|
||||
ioctl_by_bdev(inode->i_bdev, BLKRRPART, 0);
|
||||
ioctl_by_bdev(bdev, BLKRRPART, 0);
|
||||
return lo->harderror;
|
||||
case NBD_CLEAR_QUE:
|
||||
/*
|
||||
@@ -680,7 +680,7 @@ static int nbd_ioctl(struct inode *inode, struct file *file,
|
||||
return 0;
|
||||
case NBD_PRINT_DEBUG:
|
||||
printk(KERN_INFO "%s: next = %p, prev = %p, head = %p\n",
|
||||
inode->i_bdev->bd_disk->disk_name,
|
||||
bdev->bd_disk->disk_name,
|
||||
lo->queue_head.next, lo->queue_head.prev,
|
||||
&lo->queue_head);
|
||||
return 0;
|
||||
@@ -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,
|
||||
.locked_ioctl = nbd_ioctl,
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
+11
-10
@@ -223,23 +223,24 @@ static int pcd_warned; /* Have we logged a phase warning ? */
|
||||
|
||||
/* kernel glue structures */
|
||||
|
||||
static int pcd_block_open(struct inode *inode, struct file *file)
|
||||
static int pcd_block_open(struct block_device *bdev, fmode_t mode)
|
||||
{
|
||||
struct pcd_unit *cd = inode->i_bdev->bd_disk->private_data;
|
||||
return cdrom_open(&cd->info, inode, file);
|
||||
struct pcd_unit *cd = bdev->bd_disk->private_data;
|
||||
return cdrom_open(&cd->info, bdev, mode);
|
||||
}
|
||||
|
||||
static int pcd_block_release(struct inode *inode, struct file *file)
|
||||
static int pcd_block_release(struct gendisk *disk, fmode_t mode)
|
||||
{
|
||||
struct pcd_unit *cd = inode->i_bdev->bd_disk->private_data;
|
||||
return cdrom_release(&cd->info, file);
|
||||
struct pcd_unit *cd = disk->private_data;
|
||||
cdrom_release(&cd->info, mode);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int pcd_block_ioctl(struct inode *inode, struct file *file,
|
||||
static int pcd_block_ioctl(struct block_device *bdev, fmode_t mode,
|
||||
unsigned cmd, unsigned long arg)
|
||||
{
|
||||
struct pcd_unit *cd = inode->i_bdev->bd_disk->private_data;
|
||||
return cdrom_ioctl(file, &cd->info, inode, cmd, arg);
|
||||
struct pcd_unit *cd = bdev->bd_disk->private_data;
|
||||
return cdrom_ioctl(&cd->info, bdev, mode, cmd, arg);
|
||||
}
|
||||
|
||||
static int pcd_block_media_changed(struct gendisk *disk)
|
||||
@@ -252,7 +253,7 @@ static struct block_device_operations pcd_bdops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = pcd_block_open,
|
||||
.release = pcd_block_release,
|
||||
.ioctl = pcd_block_ioctl,
|
||||
.locked_ioctl = pcd_block_ioctl,
|
||||
.media_changed = pcd_block_media_changed,
|
||||
};
|
||||
|
||||
|
||||
@@ -728,9 +728,9 @@ static int pd_special_command(struct pd_unit *disk,
|
||||
|
||||
/* kernel glue structures */
|
||||
|
||||
static int pd_open(struct inode *inode, struct file *file)
|
||||
static int pd_open(struct block_device *bdev, fmode_t mode)
|
||||
{
|
||||
struct pd_unit *disk = inode->i_bdev->bd_disk->private_data;
|
||||
struct pd_unit *disk = bdev->bd_disk->private_data;
|
||||
|
||||
disk->access++;
|
||||
|
||||
@@ -758,10 +758,10 @@ static int pd_getgeo(struct block_device *bdev, struct hd_geometry *geo)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int pd_ioctl(struct inode *inode, struct file *file,
|
||||
static int pd_ioctl(struct block_device *bdev, fmode_t mode,
|
||||
unsigned int cmd, unsigned long arg)
|
||||
{
|
||||
struct pd_unit *disk = inode->i_bdev->bd_disk->private_data;
|
||||
struct pd_unit *disk = bdev->bd_disk->private_data;
|
||||
|
||||
switch (cmd) {
|
||||
case CDROMEJECT:
|
||||
@@ -773,9 +773,9 @@ static int pd_ioctl(struct inode *inode, struct file *file,
|
||||
}
|
||||
}
|
||||
|
||||
static int pd_release(struct inode *inode, struct file *file)
|
||||
static int pd_release(struct gendisk *p, fmode_t mode)
|
||||
{
|
||||
struct pd_unit *disk = inode->i_bdev->bd_disk->private_data;
|
||||
struct pd_unit *disk = p->private_data;
|
||||
|
||||
if (!--disk->access && disk->removable)
|
||||
pd_special_command(disk, pd_door_unlock);
|
||||
@@ -809,7 +809,7 @@ static struct block_device_operations pd_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = pd_open,
|
||||
.release = pd_release,
|
||||
.ioctl = pd_ioctl,
|
||||
.locked_ioctl = pd_ioctl,
|
||||
.getgeo = pd_getgeo,
|
||||
.media_changed = pd_check_media,
|
||||
.revalidate_disk= pd_revalidate
|
||||
|
||||
+11
-11
@@ -201,13 +201,13 @@ module_param_array(drive3, int, NULL, 0);
|
||||
#define ATAPI_READ_10 0x28
|
||||
#define ATAPI_WRITE_10 0x2a
|
||||
|
||||
static int pf_open(struct inode *inode, struct file *file);
|
||||
static int pf_open(struct block_device *bdev, fmode_t mode);
|
||||
static void do_pf_request(struct request_queue * q);
|
||||
static int pf_ioctl(struct inode *inode, struct file *file,
|
||||
static int pf_ioctl(struct block_device *bdev, fmode_t mode,
|
||||
unsigned int cmd, unsigned long arg);
|
||||
static int pf_getgeo(struct block_device *bdev, struct hd_geometry *geo);
|
||||
|
||||
static int pf_release(struct inode *inode, struct file *file);
|
||||
static int pf_release(struct gendisk *disk, fmode_t mode);
|
||||
|
||||
static int pf_detect(void);
|
||||
static void do_pf_read(void);
|
||||
@@ -266,7 +266,7 @@ static struct block_device_operations pf_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = pf_open,
|
||||
.release = pf_release,
|
||||
.ioctl = pf_ioctl,
|
||||
.locked_ioctl = pf_ioctl,
|
||||
.getgeo = pf_getgeo,
|
||||
.media_changed = pf_check_media,
|
||||
};
|
||||
@@ -296,16 +296,16 @@ static void __init pf_init_units(void)
|
||||
}
|
||||
}
|
||||
|
||||
static int pf_open(struct inode *inode, struct file *file)
|
||||
static int pf_open(struct block_device *bdev, fmode_t mode)
|
||||
{
|
||||
struct pf_unit *pf = inode->i_bdev->bd_disk->private_data;
|
||||
struct pf_unit *pf = bdev->bd_disk->private_data;
|
||||
|
||||
pf_identify(pf);
|
||||
|
||||
if (pf->media_status == PF_NM)
|
||||
return -ENODEV;
|
||||
|
||||
if ((pf->media_status == PF_RO) && (file->f_mode & 2))
|
||||
if ((pf->media_status == PF_RO) && (mode & FMODE_WRITE))
|
||||
return -EROFS;
|
||||
|
||||
pf->access++;
|
||||
@@ -333,9 +333,9 @@ static int pf_getgeo(struct block_device *bdev, struct hd_geometry *geo)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int pf_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
|
||||
static int pf_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd, unsigned long arg)
|
||||
{
|
||||
struct pf_unit *pf = inode->i_bdev->bd_disk->private_data;
|
||||
struct pf_unit *pf = bdev->bd_disk->private_data;
|
||||
|
||||
if (cmd != CDROMEJECT)
|
||||
return -EINVAL;
|
||||
@@ -346,9 +346,9 @@ static int pf_ioctl(struct inode *inode, struct file *file, unsigned int cmd, un
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int pf_release(struct inode *inode, struct file *file)
|
||||
static int pf_release(struct gendisk *disk, fmode_t mode)
|
||||
{
|
||||
struct pf_unit *pf = inode->i_bdev->bd_disk->private_data;
|
||||
struct pf_unit *pf = disk->private_data;
|
||||
|
||||
if (pf->access <= 0)
|
||||
return -EINVAL;
|
||||
|
||||
@@ -667,7 +667,7 @@ static int pt_open(struct inode *inode, struct file *file)
|
||||
goto out;
|
||||
|
||||
err = -EROFS;
|
||||
if ((!(tape->flags & PT_WRITE_OK)) && (file->f_mode & 2))
|
||||
if ((!(tape->flags & PT_WRITE_OK)) && (file->f_mode & FMODE_WRITE))
|
||||
goto out;
|
||||
|
||||
if (!(iminor(inode) & 128))
|
||||
|
||||
Loaded 20 of 107 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user