diff options
Diffstat (limited to 'drivers/block')
-rw-r--r-- | drivers/block/ataflop.c | 6 | ||||
-rw-r--r-- | drivers/block/floppy.c | 15 | ||||
-rw-r--r-- | drivers/block/swim3.c | 6 | ||||
-rw-r--r-- | drivers/block/ub.c | 2 |
4 files changed, 11 insertions, 18 deletions
diff --git a/drivers/block/ataflop.c b/drivers/block/ataflop.c index e1db285b72cd..85d56a26f7c6 100644 --- a/drivers/block/ataflop.c +++ b/drivers/block/ataflop.c | |||
@@ -1813,17 +1813,17 @@ static int floppy_open( struct inode *inode, struct file *filp ) | |||
1813 | if (p->ref && p->type != type) | 1813 | if (p->ref && p->type != type) |
1814 | return -EBUSY; | 1814 | return -EBUSY; |
1815 | 1815 | ||
1816 | if (p->ref == -1 || (p->ref && filp->f_flags & O_EXCL)) | 1816 | if (p->ref == -1 || (p->ref && filp->f_mode & FMODE_EXCL)) |
1817 | return -EBUSY; | 1817 | return -EBUSY; |
1818 | 1818 | ||
1819 | if (filp->f_flags & O_EXCL) | 1819 | if (filp->f_mode & FMODE_EXCL) |
1820 | p->ref = -1; | 1820 | p->ref = -1; |
1821 | else | 1821 | else |
1822 | p->ref++; | 1822 | p->ref++; |
1823 | 1823 | ||
1824 | p->type = type; | 1824 | p->type = type; |
1825 | 1825 | ||
1826 | if (filp->f_flags & O_NDELAY) | 1826 | if (filp->f_mode & FMODE_NDELAY) |
1827 | return 0; | 1827 | return 0; |
1828 | 1828 | ||
1829 | if (filp->f_mode & (FMODE_READ|FMODE_WRITE)) { | 1829 | if (filp->f_mode & (FMODE_READ|FMODE_WRITE)) { |
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c index ae3ef8945f3f..5d60c05a736a 100644 --- a/drivers/block/floppy.c +++ b/drivers/block/floppy.c | |||
@@ -3453,7 +3453,7 @@ static int fd_getgeo(struct block_device *bdev, struct hd_geometry *geo) | |||
3453 | static int fd_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, | 3453 | static int fd_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, |
3454 | unsigned long param) | 3454 | unsigned long param) |
3455 | { | 3455 | { |
3456 | #define FD_IOCTL_ALLOWED ((filp) && (filp)->private_data) | 3456 | #define FD_IOCTL_ALLOWED ((filp) && (filp)->f_mode & (FMODE_WRITE|FMODE_WRITE_IOCTL)) |
3457 | #define OUT(c,x) case c: outparam = (const char *) (x); break | 3457 | #define OUT(c,x) case c: outparam = (const char *) (x); break |
3458 | #define IN(c,x,tag) case c: *(x) = inparam. tag ; return 0 | 3458 | #define IN(c,x,tag) case c: *(x) = inparam. tag ; return 0 |
3459 | 3459 | ||
@@ -3690,7 +3690,6 @@ static int floppy_open(struct inode *inode, struct file *filp) | |||
3690 | int res = -EBUSY; | 3690 | int res = -EBUSY; |
3691 | char *tmp; | 3691 | char *tmp; |
3692 | 3692 | ||
3693 | filp->private_data = (void *)0; | ||
3694 | mutex_lock(&open_lock); | 3693 | mutex_lock(&open_lock); |
3695 | old_dev = UDRS->fd_device; | 3694 | old_dev = UDRS->fd_device; |
3696 | if (opened_bdev[drive] && opened_bdev[drive] != inode->i_bdev) | 3695 | if (opened_bdev[drive] && opened_bdev[drive] != inode->i_bdev) |
@@ -3701,10 +3700,10 @@ static int floppy_open(struct inode *inode, struct file *filp) | |||
3701 | USETF(FD_VERIFY); | 3700 | USETF(FD_VERIFY); |
3702 | } | 3701 | } |
3703 | 3702 | ||
3704 | if (UDRS->fd_ref == -1 || (UDRS->fd_ref && (filp->f_flags & O_EXCL))) | 3703 | if (UDRS->fd_ref == -1 || (UDRS->fd_ref && (filp->f_mode & FMODE_EXCL))) |
3705 | goto out2; | 3704 | goto out2; |
3706 | 3705 | ||
3707 | if (filp->f_flags & O_EXCL) | 3706 | if (filp->f_mode & FMODE_EXCL) |
3708 | UDRS->fd_ref = -1; | 3707 | UDRS->fd_ref = -1; |
3709 | else | 3708 | else |
3710 | UDRS->fd_ref++; | 3709 | UDRS->fd_ref++; |
@@ -3751,16 +3750,10 @@ static int floppy_open(struct inode *inode, struct file *filp) | |||
3751 | buffer_track = -1; | 3750 | buffer_track = -1; |
3752 | } | 3751 | } |
3753 | 3752 | ||
3754 | /* Allow ioctls if we have write-permissions even if read-only open. | ||
3755 | * Needed so that programs such as fdrawcmd still can work on write | ||
3756 | * protected disks */ | ||
3757 | if ((filp->f_mode & FMODE_WRITE) || !file_permission(filp, MAY_WRITE)) | ||
3758 | filp->private_data = (void *)8; | ||
3759 | |||
3760 | if (UFDCS->rawcmd == 1) | 3753 | if (UFDCS->rawcmd == 1) |
3761 | UFDCS->rawcmd = 2; | 3754 | UFDCS->rawcmd = 2; |
3762 | 3755 | ||
3763 | if (!(filp->f_flags & O_NDELAY)) { | 3756 | if (!(filp->f_mode & FMODE_NDELAY)) { |
3764 | if (filp->f_mode & (FMODE_READ|FMODE_WRITE)) { | 3757 | if (filp->f_mode & (FMODE_READ|FMODE_WRITE)) { |
3765 | UDRS->last_checked = 0; | 3758 | UDRS->last_checked = 0; |
3766 | check_disk_change(inode->i_bdev); | 3759 | check_disk_change(inode->i_bdev); |
diff --git a/drivers/block/swim3.c b/drivers/block/swim3.c index a53ca54bee12..5c45d5556ae8 100644 --- a/drivers/block/swim3.c +++ b/drivers/block/swim3.c | |||
@@ -904,10 +904,10 @@ static int floppy_open(struct inode *inode, struct file *filp) | |||
904 | swim3_action(fs, SETMFM); | 904 | swim3_action(fs, SETMFM); |
905 | swim3_select(fs, RELAX); | 905 | swim3_select(fs, RELAX); |
906 | 906 | ||
907 | } else if (fs->ref_count == -1 || filp->f_flags & O_EXCL) | 907 | } else if (fs->ref_count == -1 || filp->f_mode & FMODE_EXCL) |
908 | return -EBUSY; | 908 | return -EBUSY; |
909 | 909 | ||
910 | if (err == 0 && (filp->f_flags & O_NDELAY) == 0 | 910 | if (err == 0 && (filp->f_mode & FMODE_NDELAY) == 0 |
911 | && (filp->f_mode & (FMODE_READ|FMODE_WRITE))) { | 911 | && (filp->f_mode & (FMODE_READ|FMODE_WRITE))) { |
912 | check_disk_change(inode->i_bdev); | 912 | check_disk_change(inode->i_bdev); |
913 | if (fs->ejected) | 913 | if (fs->ejected) |
@@ -930,7 +930,7 @@ static int floppy_open(struct inode *inode, struct file *filp) | |||
930 | return err; | 930 | return err; |
931 | } | 931 | } |
932 | 932 | ||
933 | if (filp->f_flags & O_EXCL) | 933 | if (filp->f_mode & FMODE_EXCL) |
934 | fs->ref_count = -1; | 934 | fs->ref_count = -1; |
935 | else | 935 | else |
936 | ++fs->ref_count; | 936 | ++fs->ref_count; |
diff --git a/drivers/block/ub.c b/drivers/block/ub.c index f60e41833f69..85d41eb67c0b 100644 --- a/drivers/block/ub.c +++ b/drivers/block/ub.c | |||
@@ -1691,7 +1691,7 @@ static int ub_bd_open(struct inode *inode, struct file *filp) | |||
1691 | * under some pretty murky conditions (a failure of READ CAPACITY). | 1691 | * under some pretty murky conditions (a failure of READ CAPACITY). |
1692 | * We may need it one day. | 1692 | * We may need it one day. |
1693 | */ | 1693 | */ |
1694 | if (lun->removable && lun->changed && !(filp->f_flags & O_NDELAY)) { | 1694 | if (lun->removable && lun->changed && !(filp->f_mode & FMODE_NDELAY)) { |
1695 | rc = -ENOMEDIUM; | 1695 | rc = -ENOMEDIUM; |
1696 | goto err_open; | 1696 | goto err_open; |
1697 | } | 1697 | } |