summaryrefslogtreecommitdiffstats
path: root/drivers/block
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2007-08-26 19:50:05 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2008-10-21 07:47:08 -0400
commit86d434dede14108dd917b25af0f29c0cb28b8d18 (patch)
treef69305e5213ac9eab854b8c85a918fd71c106e06 /drivers/block
parentaeb5d727062a0238a2f96c9c380fbd2be4640c6f (diff)
downloadkernel-crypto-86d434dede14108dd917b25af0f29c0cb28b8d18.tar.gz
kernel-crypto-86d434dede14108dd917b25af0f29c0cb28b8d18.tar.xz
kernel-crypto-86d434dede14108dd917b25af0f29c0cb28b8d18.zip
[PATCH] eliminate use of ->f_flags in block methods
store needed information in f_mode Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'drivers/block')
-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
4 files changed, 11 insertions, 18 deletions
diff --git a/drivers/block/ataflop.c b/drivers/block/ataflop.c
index e1db285b72c..85d56a26f7c 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 )
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 && filp->f_mode & FMODE_EXCL))
return -EBUSY;
- if (filp->f_flags & O_EXCL)
+ if (filp->f_mode & FMODE_EXCL)
p->ref = -1;
else
p->ref++;
p->type = type;
- if (filp->f_flags & O_NDELAY)
+ if (filp->f_mode & FMODE_NDELAY)
return 0;
if (filp->f_mode & (FMODE_READ|FMODE_WRITE)) {
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
index ae3ef8945f3..5d60c05a736 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)
static int fd_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
unsigned long param)
{
-#define FD_IOCTL_ALLOWED ((filp) && (filp)->private_data)
+#define FD_IOCTL_ALLOWED ((filp) && (filp)->f_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
@@ -3690,7 +3690,6 @@ static int floppy_open(struct inode *inode, struct file *filp)
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)
@@ -3701,10 +3700,10 @@ 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 && (filp->f_mode & FMODE_EXCL)))
goto out2;
- if (filp->f_flags & O_EXCL)
+ if (filp->f_mode & FMODE_EXCL)
UDRS->fd_ref = -1;
else
UDRS->fd_ref++;
@@ -3751,16 +3750,10 @@ static int floppy_open(struct inode *inode, struct file *filp)
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 & FMODE_NDELAY)) {
if (filp->f_mode & (FMODE_READ|FMODE_WRITE)) {
UDRS->last_checked = 0;
check_disk_change(inode->i_bdev);
diff --git a/drivers/block/swim3.c b/drivers/block/swim3.c
index a53ca54bee1..5c45d5556ae 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)
swim3_action(fs, SETMFM);
swim3_select(fs, RELAX);
- } else if (fs->ref_count == -1 || filp->f_flags & O_EXCL)
+ } else if (fs->ref_count == -1 || filp->f_mode & FMODE_EXCL)
return -EBUSY;
- if (err == 0 && (filp->f_flags & O_NDELAY) == 0
+ if (err == 0 && (filp->f_mode & FMODE_NDELAY) == 0
&& (filp->f_mode & (FMODE_READ|FMODE_WRITE))) {
check_disk_change(inode->i_bdev);
if (fs->ejected)
@@ -930,7 +930,7 @@ static int floppy_open(struct inode *inode, struct file *filp)
return err;
}
- if (filp->f_flags & O_EXCL)
+ if (filp->f_mode & FMODE_EXCL)
fs->ref_count = -1;
else
++fs->ref_count;
diff --git a/drivers/block/ub.c b/drivers/block/ub.c
index f60e41833f6..85d41eb67c0 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)
* under some pretty murky conditions (a failure of READ CAPACITY).
* We may need it one day.
*/
- if (lun->removable && lun->changed && !(filp->f_flags & O_NDELAY)) {
+ if (lun->removable && lun->changed && !(filp->f_mode & FMODE_NDELAY)) {
rc = -ENOMEDIUM;
goto err_open;
}