diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2008-09-02 15:28:45 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2008-10-21 07:47:06 -0400 |
commit | aeb5d727062a0238a2f96c9c380fbd2be4640c6f (patch) | |
tree | 51dae8a071fcf42e4431a66d37c5b843c8e99cf6 /fs | |
parent | 2515ddc6db8eb49a79f0fe5e67ff09ac7c81eab4 (diff) |
[PATCH] introduce fmode_t, do annotations
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/block_dev.c | 10 | ||||
-rw-r--r-- | fs/fifo.c | 6 | ||||
-rw-r--r-- | fs/file_table.c | 4 | ||||
-rw-r--r-- | fs/hostfs/hostfs_kern.c | 5 | ||||
-rw-r--r-- | fs/locks.c | 3 | ||||
-rw-r--r-- | fs/open.c | 2 | ||||
-rw-r--r-- | fs/proc/base.c | 4 | ||||
-rw-r--r-- | fs/reiserfs/journal.c | 2 |
8 files changed, 19 insertions, 17 deletions
diff --git a/fs/block_dev.c b/fs/block_dev.c index 218408eed1bb..8897f3b02e98 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c | |||
@@ -840,7 +840,7 @@ EXPORT_SYMBOL_GPL(bd_release_from_disk); | |||
840 | * to be used for internal purposes. If you ever need it - reconsider | 840 | * to be used for internal purposes. If you ever need it - reconsider |
841 | * your API. | 841 | * your API. |
842 | */ | 842 | */ |
843 | struct block_device *open_by_devnum(dev_t dev, unsigned mode) | 843 | struct block_device *open_by_devnum(dev_t dev, fmode_t mode) |
844 | { | 844 | { |
845 | struct block_device *bdev = bdget(dev); | 845 | struct block_device *bdev = bdget(dev); |
846 | int err = -ENOMEM; | 846 | int err = -ENOMEM; |
@@ -975,7 +975,7 @@ void bd_set_size(struct block_device *bdev, loff_t size) | |||
975 | } | 975 | } |
976 | EXPORT_SYMBOL(bd_set_size); | 976 | EXPORT_SYMBOL(bd_set_size); |
977 | 977 | ||
978 | static int __blkdev_get(struct block_device *bdev, mode_t mode, unsigned flags, | 978 | static int __blkdev_get(struct block_device *bdev, fmode_t mode, unsigned flags, |
979 | int for_part); | 979 | int for_part); |
980 | static int __blkdev_put(struct block_device *bdev, int for_part); | 980 | static int __blkdev_put(struct block_device *bdev, int for_part); |
981 | 981 | ||
@@ -1104,7 +1104,7 @@ static int do_open(struct block_device *bdev, struct file *file, int for_part) | |||
1104 | return ret; | 1104 | return ret; |
1105 | } | 1105 | } |
1106 | 1106 | ||
1107 | static int __blkdev_get(struct block_device *bdev, mode_t mode, unsigned flags, | 1107 | static int __blkdev_get(struct block_device *bdev, fmode_t mode, unsigned flags, |
1108 | int for_part) | 1108 | int for_part) |
1109 | { | 1109 | { |
1110 | /* | 1110 | /* |
@@ -1123,7 +1123,7 @@ static int __blkdev_get(struct block_device *bdev, mode_t mode, unsigned flags, | |||
1123 | return do_open(bdev, &fake_file, for_part); | 1123 | return do_open(bdev, &fake_file, for_part); |
1124 | } | 1124 | } |
1125 | 1125 | ||
1126 | int blkdev_get(struct block_device *bdev, mode_t mode, unsigned flags) | 1126 | int blkdev_get(struct block_device *bdev, fmode_t mode, unsigned flags) |
1127 | { | 1127 | { |
1128 | return __blkdev_get(bdev, mode, flags, 0); | 1128 | return __blkdev_get(bdev, mode, flags, 0); |
1129 | } | 1129 | } |
@@ -1315,7 +1315,7 @@ EXPORT_SYMBOL(lookup_bdev); | |||
1315 | struct block_device *open_bdev_excl(const char *path, int flags, void *holder) | 1315 | struct block_device *open_bdev_excl(const char *path, int flags, void *holder) |
1316 | { | 1316 | { |
1317 | struct block_device *bdev; | 1317 | struct block_device *bdev; |
1318 | mode_t mode = FMODE_READ; | 1318 | fmode_t mode = FMODE_READ; |
1319 | int error = 0; | 1319 | int error = 0; |
1320 | 1320 | ||
1321 | bdev = lookup_bdev(path); | 1321 | bdev = lookup_bdev(path); |
@@ -51,7 +51,7 @@ static int fifo_open(struct inode *inode, struct file *filp) | |||
51 | filp->f_mode &= (FMODE_READ | FMODE_WRITE); | 51 | filp->f_mode &= (FMODE_READ | FMODE_WRITE); |
52 | 52 | ||
53 | switch (filp->f_mode) { | 53 | switch (filp->f_mode) { |
54 | case 1: | 54 | case FMODE_READ: |
55 | /* | 55 | /* |
56 | * O_RDONLY | 56 | * O_RDONLY |
57 | * POSIX.1 says that O_NONBLOCK means return with the FIFO | 57 | * POSIX.1 says that O_NONBLOCK means return with the FIFO |
@@ -76,7 +76,7 @@ static int fifo_open(struct inode *inode, struct file *filp) | |||
76 | } | 76 | } |
77 | break; | 77 | break; |
78 | 78 | ||
79 | case 2: | 79 | case FMODE_WRITE: |
80 | /* | 80 | /* |
81 | * O_WRONLY | 81 | * O_WRONLY |
82 | * POSIX.1 says that O_NONBLOCK means return -1 with | 82 | * POSIX.1 says that O_NONBLOCK means return -1 with |
@@ -98,7 +98,7 @@ static int fifo_open(struct inode *inode, struct file *filp) | |||
98 | } | 98 | } |
99 | break; | 99 | break; |
100 | 100 | ||
101 | case 3: | 101 | case FMODE_READ | FMODE_WRITE: |
102 | /* | 102 | /* |
103 | * O_RDWR | 103 | * O_RDWR |
104 | * POSIX.1 leaves this case "undefined" when O_NONBLOCK is set. | 104 | * POSIX.1 leaves this case "undefined" when O_NONBLOCK is set. |
diff --git a/fs/file_table.c b/fs/file_table.c index f45a4493f9e7..efc06faede6c 100644 --- a/fs/file_table.c +++ b/fs/file_table.c | |||
@@ -161,7 +161,7 @@ EXPORT_SYMBOL(get_empty_filp); | |||
161 | * code should be moved into this function. | 161 | * code should be moved into this function. |
162 | */ | 162 | */ |
163 | struct file *alloc_file(struct vfsmount *mnt, struct dentry *dentry, | 163 | struct file *alloc_file(struct vfsmount *mnt, struct dentry *dentry, |
164 | mode_t mode, const struct file_operations *fop) | 164 | fmode_t mode, const struct file_operations *fop) |
165 | { | 165 | { |
166 | struct file *file; | 166 | struct file *file; |
167 | struct path; | 167 | struct path; |
@@ -193,7 +193,7 @@ EXPORT_SYMBOL(alloc_file); | |||
193 | * of this should be moving to alloc_file(). | 193 | * of this should be moving to alloc_file(). |
194 | */ | 194 | */ |
195 | int init_file(struct file *file, struct vfsmount *mnt, struct dentry *dentry, | 195 | int init_file(struct file *file, struct vfsmount *mnt, struct dentry *dentry, |
196 | mode_t mode, const struct file_operations *fop) | 196 | fmode_t mode, const struct file_operations *fop) |
197 | { | 197 | { |
198 | int error = 0; | 198 | int error = 0; |
199 | file->f_path.dentry = dentry; | 199 | file->f_path.dentry = dentry; |
diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c index d6ecabf4d231..7f34f4385de0 100644 --- a/fs/hostfs/hostfs_kern.c +++ b/fs/hostfs/hostfs_kern.c | |||
@@ -20,7 +20,7 @@ | |||
20 | struct hostfs_inode_info { | 20 | struct hostfs_inode_info { |
21 | char *host_filename; | 21 | char *host_filename; |
22 | int fd; | 22 | int fd; |
23 | int mode; | 23 | fmode_t mode; |
24 | struct inode vfs_inode; | 24 | struct inode vfs_inode; |
25 | }; | 25 | }; |
26 | 26 | ||
@@ -373,7 +373,8 @@ int hostfs_readdir(struct file *file, void *ent, filldir_t filldir) | |||
373 | int hostfs_file_open(struct inode *ino, struct file *file) | 373 | int hostfs_file_open(struct inode *ino, struct file *file) |
374 | { | 374 | { |
375 | char *name; | 375 | char *name; |
376 | int mode = 0, r = 0, w = 0, fd; | 376 | fmode_t mode = 0; |
377 | int r = 0, w = 0, fd; | ||
377 | 378 | ||
378 | mode = file->f_mode & (FMODE_READ | FMODE_WRITE); | 379 | mode = file->f_mode & (FMODE_READ | FMODE_WRITE); |
379 | if ((mode & HOSTFS_I(ino)->mode) == mode) | 380 | if ((mode & HOSTFS_I(ino)->mode) == mode) |
diff --git a/fs/locks.c b/fs/locks.c index 5eb259e3cd38..20457486d6b2 100644 --- a/fs/locks.c +++ b/fs/locks.c | |||
@@ -1580,7 +1580,8 @@ asmlinkage long sys_flock(unsigned int fd, unsigned int cmd) | |||
1580 | cmd &= ~LOCK_NB; | 1580 | cmd &= ~LOCK_NB; |
1581 | unlock = (cmd == LOCK_UN); | 1581 | unlock = (cmd == LOCK_UN); |
1582 | 1582 | ||
1583 | if (!unlock && !(cmd & LOCK_MAND) && !(filp->f_mode & 3)) | 1583 | if (!unlock && !(cmd & LOCK_MAND) && |
1584 | !(filp->f_mode & (FMODE_READ|FMODE_WRITE))) | ||
1584 | goto out_putf; | 1585 | goto out_putf; |
1585 | 1586 | ||
1586 | error = flock_make_lock(filp, &lock, cmd); | 1587 | error = flock_make_lock(filp, &lock, cmd); |
@@ -798,7 +798,7 @@ static struct file *__dentry_open(struct dentry *dentry, struct vfsmount *mnt, | |||
798 | int error; | 798 | int error; |
799 | 799 | ||
800 | f->f_flags = flags; | 800 | f->f_flags = flags; |
801 | f->f_mode = ((flags+1) & O_ACCMODE) | FMODE_LSEEK | | 801 | f->f_mode = (__force fmode_t)((flags+1) & O_ACCMODE) | FMODE_LSEEK | |
802 | FMODE_PREAD | FMODE_PWRITE; | 802 | FMODE_PREAD | FMODE_PWRITE; |
803 | inode = dentry->d_inode; | 803 | inode = dentry->d_inode; |
804 | if (f->f_mode & FMODE_WRITE) { | 804 | if (f->f_mode & FMODE_WRITE) { |
diff --git a/fs/proc/base.c b/fs/proc/base.c index b5918ae8ca79..486cf3fe7139 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c | |||
@@ -1712,9 +1712,9 @@ static struct dentry *proc_fd_instantiate(struct inode *dir, | |||
1712 | file = fcheck_files(files, fd); | 1712 | file = fcheck_files(files, fd); |
1713 | if (!file) | 1713 | if (!file) |
1714 | goto out_unlock; | 1714 | goto out_unlock; |
1715 | if (file->f_mode & 1) | 1715 | if (file->f_mode & FMODE_READ) |
1716 | inode->i_mode |= S_IRUSR | S_IXUSR; | 1716 | inode->i_mode |= S_IRUSR | S_IXUSR; |
1717 | if (file->f_mode & 2) | 1717 | if (file->f_mode & FMODE_WRITE) |
1718 | inode->i_mode |= S_IWUSR | S_IXUSR; | 1718 | inode->i_mode |= S_IWUSR | S_IXUSR; |
1719 | spin_unlock(&files->file_lock); | 1719 | spin_unlock(&files->file_lock); |
1720 | put_files_struct(files); | 1720 | put_files_struct(files); |
diff --git a/fs/reiserfs/journal.c b/fs/reiserfs/journal.c index c21df71943a6..b89d193a00d9 100644 --- a/fs/reiserfs/journal.c +++ b/fs/reiserfs/journal.c | |||
@@ -2593,7 +2593,7 @@ static int journal_init_dev(struct super_block *super, | |||
2593 | { | 2593 | { |
2594 | int result; | 2594 | int result; |
2595 | dev_t jdev; | 2595 | dev_t jdev; |
2596 | int blkdev_mode = FMODE_READ | FMODE_WRITE; | 2596 | fmode_t blkdev_mode = FMODE_READ | FMODE_WRITE; |
2597 | char b[BDEVNAME_SIZE]; | 2597 | char b[BDEVNAME_SIZE]; |
2598 | 2598 | ||
2599 | result = 0; | 2599 | result = 0; |