[PATCH] introduce fmode_t, do annotations
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
diff --git a/drivers/block/amiflop.c b/drivers/block/amiflop.c
index 7516baf..d19c5a9 100644
--- a/drivers/block/amiflop.c
+++ b/drivers/block/amiflop.c
@@ -1560,9 +1560,9 @@
if (fd_ref[drive] && old_dev != system)
return -EBUSY;
- if (filp && filp->f_mode & 3) {
+ if (filp && filp->f_mode & (FMODE_READ|FMODE_WRITE)) {
check_disk_change(inode->i_bdev);
- if (filp->f_mode & 2 ) {
+ if (filp->f_mode & FMODE_WRITE ) {
int wrprot;
get_fdc(drive);
diff --git a/drivers/block/ataflop.c b/drivers/block/ataflop.c
index 432cf40..e1db285 100644
--- a/drivers/block/ataflop.c
+++ b/drivers/block/ataflop.c
@@ -1826,9 +1826,9 @@
if (filp->f_flags & O_NDELAY)
return 0;
- if (filp->f_mode & 3) {
+ if (filp->f_mode & (FMODE_READ|FMODE_WRITE)) {
check_disk_change(inode->i_bdev);
- if (filp->f_mode & 2) {
+ if (filp->f_mode & FMODE_WRITE) {
if (p->wpstat) {
if (p->ref < 0)
p->ref = 0;
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
index 2cea27a..ae3ef894 100644
--- a/drivers/block/floppy.c
+++ b/drivers/block/floppy.c
@@ -3761,14 +3761,14 @@
UFDCS->rawcmd = 2;
if (!(filp->f_flags & O_NDELAY)) {
- if (filp->f_mode & 3) {
+ if (filp->f_mode & (FMODE_READ|FMODE_WRITE)) {
UDRS->last_checked = 0;
check_disk_change(inode->i_bdev);
if (UTESTF(FD_DISK_CHANGED))
goto out;
}
res = -EROFS;
- if ((filp->f_mode & 2) && !(UTESTF(FD_DISK_WRITABLE)))
+ if ((filp->f_mode & FMODE_WRITE) && !(UTESTF(FD_DISK_WRITABLE)))
goto out;
}
mutex_unlock(&open_lock);
diff --git a/drivers/block/paride/pf.c b/drivers/block/paride/pf.c
index e7fe6ca..a902d84 100644
--- a/drivers/block/paride/pf.c
+++ b/drivers/block/paride/pf.c
@@ -305,7 +305,7 @@
if (pf->media_status == PF_NM)
return -ENODEV;
- if ((pf->media_status == PF_RO) && (file->f_mode & 2))
+ if ((pf->media_status == PF_RO) && (file->f_mode & FMODE_WRITE))
return -EROFS;
pf->access++;
diff --git a/drivers/block/paride/pt.c b/drivers/block/paride/pt.c
index 5ae2296..1e4006e 100644
--- a/drivers/block/paride/pt.c
+++ b/drivers/block/paride/pt.c
@@ -667,7 +667,7 @@
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))
diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c
index 195ca7c..4d581e8 100644
--- a/drivers/block/pktcdvd.c
+++ b/drivers/block/pktcdvd.c
@@ -2320,7 +2320,7 @@
/*
* called at open time.
*/
-static int pkt_open_dev(struct pktcdvd_device *pd, int write)
+static int pkt_open_dev(struct pktcdvd_device *pd, fmode_t write)
{
int ret;
long lba;
diff --git a/drivers/block/swim3.c b/drivers/block/swim3.c
index 730ccea..a53ca54 100644
--- a/drivers/block/swim3.c
+++ b/drivers/block/swim3.c
@@ -908,13 +908,13 @@
return -EBUSY;
if (err == 0 && (filp->f_flags & O_NDELAY) == 0
- && (filp->f_mode & 3)) {
+ && (filp->f_mode & (FMODE_READ|FMODE_WRITE))) {
check_disk_change(inode->i_bdev);
if (fs->ejected)
err = -ENXIO;
}
- if (err == 0 && (filp->f_mode & 2)) {
+ if (err == 0 && (filp->f_mode & FMODE_WRITE)) {
if (fs->write_prot < 0)
fs->write_prot = swim3_readbit(fs, WRITE_PROT);
if (fs->write_prot)