aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/block/ataflop.c6
-rw-r--r--drivers/block/floppy.c15
-rw-r--r--drivers/block/swim3.c6
-rw-r--r--drivers/block/ub.c2
-rw-r--r--drivers/cdrom/cdrom.c4
-rw-r--r--drivers/ide/ide-gd.c2
-rw-r--r--drivers/scsi/sd.c2
7 files changed, 15 insertions, 22 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)
3453static int fd_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, 3453static 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 }
diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c
index d47f2f80accd..4feefa622aed 100644
--- a/drivers/cdrom/cdrom.c
+++ b/drivers/cdrom/cdrom.c
@@ -982,7 +982,7 @@ int cdrom_open(struct cdrom_device_info *cdi, struct inode *ip, struct file *fp)
982 /* if this was a O_NONBLOCK open and we should honor the flags, 982 /* if this was a O_NONBLOCK open and we should honor the flags,
983 * do a quick open without drive/disc integrity checks. */ 983 * do a quick open without drive/disc integrity checks. */
984 cdi->use_count++; 984 cdi->use_count++;
985 if ((fp->f_flags & O_NONBLOCK) && (cdi->options & CDO_USE_FFLAGS)) { 985 if ((fp->f_mode & FMODE_NDELAY) && (cdi->options & CDO_USE_FFLAGS)) {
986 ret = cdi->ops->open(cdi, 1); 986 ret = cdi->ops->open(cdi, 1);
987 } else { 987 } else {
988 ret = open_for_data(cdi); 988 ret = open_for_data(cdi);
@@ -1205,7 +1205,7 @@ int cdrom_release(struct cdrom_device_info *cdi, struct file *fp)
1205 } 1205 }
1206 1206
1207 opened_for_data = !(cdi->options & CDO_USE_FFLAGS) || 1207 opened_for_data = !(cdi->options & CDO_USE_FFLAGS) ||
1208 !(fp && fp->f_flags & O_NONBLOCK); 1208 !(fp && fp->f_mode & FMODE_NDELAY);
1209 1209
1210 /* 1210 /*
1211 * flush cache on last write release 1211 * flush cache on last write release
diff --git a/drivers/ide/ide-gd.c b/drivers/ide/ide-gd.c
index d367473098f9..66bbb0a22f57 100644
--- a/drivers/ide/ide-gd.c
+++ b/drivers/ide/ide-gd.c
@@ -197,7 +197,7 @@ static int ide_gd_open(struct inode *inode, struct file *filp)
197 * unreadable disk, so that we can get the format capacity 197 * unreadable disk, so that we can get the format capacity
198 * of the drive or begin the format - Sam 198 * of the drive or begin the format - Sam
199 */ 199 */
200 if (ret && (filp->f_flags & O_NDELAY) == 0) { 200 if (ret && (filp->f_mode & FMODE_NDELAY) == 0) {
201 ret = -EIO; 201 ret = -EIO;
202 goto out_put_idkp; 202 goto out_put_idkp;
203 } 203 }
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 7c4d2e68df1c..202c1ed9abd7 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -640,7 +640,7 @@ static int sd_open(struct inode *inode, struct file *filp)
640 */ 640 */
641 retval = -ENOMEDIUM; 641 retval = -ENOMEDIUM;
642 if (sdev->removable && !sdkp->media_present && 642 if (sdev->removable && !sdkp->media_present &&
643 !(filp->f_flags & O_NDELAY)) 643 !(filp->f_mode & FMODE_NDELAY))
644 goto error_out; 644 goto error_out;
645 645
646 /* 646 /*