summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFabian Frederick <fabf@skynet.be>2015-04-16 15:48:24 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2015-04-17 09:04:08 -0400
commit79bda4d510f80e403ef66fee852f8ccb17308581 (patch)
tree74c292beca04f1469623cdd7141c074c2ac5a67a
parent34f24835383092098cb4ce5c4eb6e719a9973d68 (diff)
fs/affs: use affs_test_opt()
Replace mount option test by affs_test_opt(). Signed-off-by: Fabian Frederick <fabf@skynet.be> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--fs/affs/amigaffs.c3
-rw-r--r--fs/affs/file.c2
-rw-r--r--fs/affs/inode.c26
-rw-r--r--fs/affs/namei.c6
-rw-r--r--fs/affs/super.c6
5 files changed, 22 insertions, 21 deletions
diff --git a/fs/affs/amigaffs.c b/fs/affs/amigaffs.c
index 1a90e19a3f5b..5022ac96aa40 100644
--- a/fs/affs/amigaffs.c
+++ b/fs/affs/amigaffs.c
@@ -472,7 +472,8 @@ bool
472affs_nofilenametruncate(const struct dentry *dentry) 472affs_nofilenametruncate(const struct dentry *dentry)
473{ 473{
474 struct inode *inode = dentry->d_inode; 474 struct inode *inode = dentry->d_inode;
475 return AFFS_SB(inode->i_sb)->s_flags & AFFS_MOUNT_SF_NO_TRUNCATE; 475
476 return affs_test_opt(AFFS_SB(inode->i_sb)->s_flags, SF_NO_TRUNCATE);
476 477
477} 478}
478 479
diff --git a/fs/affs/file.c b/fs/affs/file.c
index 2e247595f3b3..7f506fb1ca23 100644
--- a/fs/affs/file.c
+++ b/fs/affs/file.c
@@ -915,7 +915,7 @@ affs_truncate(struct inode *inode)
915 if (inode->i_size) { 915 if (inode->i_size) {
916 AFFS_I(inode)->i_blkcnt = last_blk + 1; 916 AFFS_I(inode)->i_blkcnt = last_blk + 1;
917 AFFS_I(inode)->i_extcnt = ext + 1; 917 AFFS_I(inode)->i_extcnt = ext + 1;
918 if (AFFS_SB(sb)->s_flags & AFFS_MOUNT_SF_OFS) { 918 if (affs_test_opt(AFFS_SB(sb)->s_flags, SF_OFS)) {
919 struct buffer_head *bh = affs_bread_ino(inode, last_blk, 0); 919 struct buffer_head *bh = affs_bread_ino(inode, last_blk, 0);
920 u32 tmp; 920 u32 tmp;
921 if (IS_ERR(bh)) { 921 if (IS_ERR(bh)) {
diff --git a/fs/affs/inode.c b/fs/affs/inode.c
index 53af66b01566..9628003ccd2f 100644
--- a/fs/affs/inode.c
+++ b/fs/affs/inode.c
@@ -66,23 +66,23 @@ struct inode *affs_iget(struct super_block *sb, unsigned long ino)
66 AFFS_I(inode)->i_lastalloc = 0; 66 AFFS_I(inode)->i_lastalloc = 0;
67 AFFS_I(inode)->i_pa_cnt = 0; 67 AFFS_I(inode)->i_pa_cnt = 0;
68 68
69 if (sbi->s_flags & AFFS_MOUNT_SF_SETMODE) 69 if (affs_test_opt(sbi->s_flags, SF_SETMODE))
70 inode->i_mode = sbi->s_mode; 70 inode->i_mode = sbi->s_mode;
71 else 71 else
72 inode->i_mode = prot_to_mode(prot); 72 inode->i_mode = prot_to_mode(prot);
73 73
74 id = be16_to_cpu(tail->uid); 74 id = be16_to_cpu(tail->uid);
75 if (id == 0 || sbi->s_flags & AFFS_MOUNT_SF_SETUID) 75 if (id == 0 || affs_test_opt(sbi->s_flags, SF_SETUID))
76 inode->i_uid = sbi->s_uid; 76 inode->i_uid = sbi->s_uid;
77 else if (id == 0xFFFF && sbi->s_flags & AFFS_MOUNT_SF_MUFS) 77 else if (id == 0xFFFF && affs_test_opt(sbi->s_flags, SF_MUFS))
78 i_uid_write(inode, 0); 78 i_uid_write(inode, 0);
79 else 79 else
80 i_uid_write(inode, id); 80 i_uid_write(inode, id);
81 81
82 id = be16_to_cpu(tail->gid); 82 id = be16_to_cpu(tail->gid);
83 if (id == 0 || sbi->s_flags & AFFS_MOUNT_SF_SETGID) 83 if (id == 0 || affs_test_opt(sbi->s_flags, SF_SETGID))
84 inode->i_gid = sbi->s_gid; 84 inode->i_gid = sbi->s_gid;
85 else if (id == 0xFFFF && sbi->s_flags & AFFS_MOUNT_SF_MUFS) 85 else if (id == 0xFFFF && affs_test_opt(sbi->s_flags, SF_MUFS))
86 i_gid_write(inode, 0); 86 i_gid_write(inode, 0);
87 else 87 else
88 i_gid_write(inode, id); 88 i_gid_write(inode, id);
@@ -94,7 +94,7 @@ struct inode *affs_iget(struct super_block *sb, unsigned long ino)
94 /* fall through */ 94 /* fall through */
95 case ST_USERDIR: 95 case ST_USERDIR:
96 if (be32_to_cpu(tail->stype) == ST_USERDIR || 96 if (be32_to_cpu(tail->stype) == ST_USERDIR ||
97 sbi->s_flags & AFFS_MOUNT_SF_SETMODE) { 97 affs_test_opt(sbi->s_flags, SF_SETMODE)) {
98 if (inode->i_mode & S_IRUSR) 98 if (inode->i_mode & S_IRUSR)
99 inode->i_mode |= S_IXUSR; 99 inode->i_mode |= S_IXUSR;
100 if (inode->i_mode & S_IRGRP) 100 if (inode->i_mode & S_IRGRP)
@@ -133,7 +133,7 @@ struct inode *affs_iget(struct super_block *sb, unsigned long ino)
133 } 133 }
134 if (tail->link_chain) 134 if (tail->link_chain)
135 set_nlink(inode, 2); 135 set_nlink(inode, 2);
136 inode->i_mapping->a_ops = (sbi->s_flags & AFFS_MOUNT_SF_OFS) ? 136 inode->i_mapping->a_ops = affs_test_opt(sbi->s_flags, SF_OFS) ?
137 &affs_aops_ofs : &affs_aops; 137 &affs_aops_ofs : &affs_aops;
138 inode->i_op = &affs_file_inode_operations; 138 inode->i_op = &affs_file_inode_operations;
139 inode->i_fop = &affs_file_operations; 139 inode->i_fop = &affs_file_operations;
@@ -191,15 +191,15 @@ affs_write_inode(struct inode *inode, struct writeback_control *wbc)
191 if (!(inode->i_ino == AFFS_SB(sb)->s_root_block)) { 191 if (!(inode->i_ino == AFFS_SB(sb)->s_root_block)) {
192 uid = i_uid_read(inode); 192 uid = i_uid_read(inode);
193 gid = i_gid_read(inode); 193 gid = i_gid_read(inode);
194 if (AFFS_SB(sb)->s_flags & AFFS_MOUNT_SF_MUFS) { 194 if (affs_test_opt(AFFS_SB(sb)->s_flags, SF_MUFS)) {
195 if (uid == 0 || uid == 0xFFFF) 195 if (uid == 0 || uid == 0xFFFF)
196 uid = uid ^ ~0; 196 uid = uid ^ ~0;
197 if (gid == 0 || gid == 0xFFFF) 197 if (gid == 0 || gid == 0xFFFF)
198 gid = gid ^ ~0; 198 gid = gid ^ ~0;
199 } 199 }
200 if (!(AFFS_SB(sb)->s_flags & AFFS_MOUNT_SF_SETUID)) 200 if (!affs_test_opt(AFFS_SB(sb)->s_flags, SF_SETUID))
201 tail->uid = cpu_to_be16(uid); 201 tail->uid = cpu_to_be16(uid);
202 if (!(AFFS_SB(sb)->s_flags & AFFS_MOUNT_SF_SETGID)) 202 if (!affs_test_opt(AFFS_SB(sb)->s_flags, SF_SETGID))
203 tail->gid = cpu_to_be16(gid); 203 tail->gid = cpu_to_be16(gid);
204 } 204 }
205 } 205 }
@@ -223,13 +223,13 @@ affs_notify_change(struct dentry *dentry, struct iattr *attr)
223 goto out; 223 goto out;
224 224
225 if (((attr->ia_valid & ATTR_UID) && 225 if (((attr->ia_valid & ATTR_UID) &&
226 (AFFS_SB(inode->i_sb)->s_flags & AFFS_MOUNT_SF_SETUID)) || 226 affs_test_opt(AFFS_SB(inode->i_sb)->s_flags, SF_SETUID)) ||
227 ((attr->ia_valid & ATTR_GID) && 227 ((attr->ia_valid & ATTR_GID) &&
228 (AFFS_SB(inode->i_sb)->s_flags & AFFS_MOUNT_SF_SETGID)) || 228 affs_test_opt(AFFS_SB(inode->i_sb)->s_flags, SF_SETGID)) ||
229 ((attr->ia_valid & ATTR_MODE) && 229 ((attr->ia_valid & ATTR_MODE) &&
230 (AFFS_SB(inode->i_sb)->s_flags & 230 (AFFS_SB(inode->i_sb)->s_flags &
231 (AFFS_MOUNT_SF_SETMODE | AFFS_MOUNT_SF_IMMUTABLE)))) { 231 (AFFS_MOUNT_SF_SETMODE | AFFS_MOUNT_SF_IMMUTABLE)))) {
232 if (!(AFFS_SB(inode->i_sb)->s_flags & AFFS_MOUNT_SF_QUIET)) 232 if (!affs_test_opt(AFFS_SB(inode->i_sb)->s_flags, SF_QUIET))
233 error = -EPERM; 233 error = -EPERM;
234 goto out; 234 goto out;
235 } 235 }
diff --git a/fs/affs/namei.c b/fs/affs/namei.c
index aaa81ab1b6fc..ec8ca0efb960 100644
--- a/fs/affs/namei.c
+++ b/fs/affs/namei.c
@@ -53,8 +53,8 @@ affs_intl_toupper(int ch)
53static inline toupper_t 53static inline toupper_t
54affs_get_toupper(struct super_block *sb) 54affs_get_toupper(struct super_block *sb)
55{ 55{
56 return AFFS_SB(sb)->s_flags & AFFS_MOUNT_SF_INTL ? 56 return affs_test_opt(AFFS_SB(sb)->s_flags, SF_INTL) ?
57 affs_intl_toupper : affs_toupper; 57 affs_intl_toupper : affs_toupper;
58} 58}
59 59
60/* 60/*
@@ -276,7 +276,7 @@ affs_create(struct inode *dir, struct dentry *dentry, umode_t mode, bool excl)
276 276
277 inode->i_op = &affs_file_inode_operations; 277 inode->i_op = &affs_file_inode_operations;
278 inode->i_fop = &affs_file_operations; 278 inode->i_fop = &affs_file_operations;
279 inode->i_mapping->a_ops = (AFFS_SB(sb)->s_flags & AFFS_MOUNT_SF_OFS) ? 279 inode->i_mapping->a_ops = affs_test_opt(AFFS_SB(sb)->s_flags, SF_OFS) ?
280 &affs_aops_ofs : &affs_aops; 280 &affs_aops_ofs : &affs_aops;
281 error = affs_add_entry(dir, inode, dentry, ST_FILE); 281 error = affs_add_entry(dir, inode, dentry, ST_FILE);
282 if (error) { 282 if (error) {
diff --git a/fs/affs/super.c b/fs/affs/super.c
index 32bfad4234f7..6819d0426af5 100644
--- a/fs/affs/super.c
+++ b/fs/affs/super.c
@@ -468,7 +468,7 @@ got_root:
468 return -EINVAL; 468 return -EINVAL;
469 } 469 }
470 470
471 if (mount_flags & AFFS_MOUNT_SF_VERBOSE) { 471 if (affs_test_opt(mount_flags, SF_VERBOSE)) {
472 u8 len = AFFS_ROOT_TAIL(sb, root_bh)->disk_name[0]; 472 u8 len = AFFS_ROOT_TAIL(sb, root_bh)->disk_name[0];
473 pr_notice("Mounting volume \"%.*s\": Type=%.3s\\%c, Blocksize=%d\n", 473 pr_notice("Mounting volume \"%.*s\": Type=%.3s\\%c, Blocksize=%d\n",
474 len > 31 ? 31 : len, 474 len > 31 ? 31 : len,
@@ -479,7 +479,7 @@ got_root:
479 sb->s_flags |= MS_NODEV | MS_NOSUID; 479 sb->s_flags |= MS_NODEV | MS_NOSUID;
480 480
481 sbi->s_data_blksize = sb->s_blocksize; 481 sbi->s_data_blksize = sb->s_blocksize;
482 if (sbi->s_flags & AFFS_MOUNT_SF_OFS) 482 if (affs_test_opt(sbi->s_flags, SF_OFS))
483 sbi->s_data_blksize -= 24; 483 sbi->s_data_blksize -= 24;
484 484
485 tmp_flags = sb->s_flags; 485 tmp_flags = sb->s_flags;
@@ -494,7 +494,7 @@ got_root:
494 if (IS_ERR(root_inode)) 494 if (IS_ERR(root_inode))
495 return PTR_ERR(root_inode); 495 return PTR_ERR(root_inode);
496 496
497 if (AFFS_SB(sb)->s_flags & AFFS_MOUNT_SF_INTL) 497 if (affs_test_opt(AFFS_SB(sb)->s_flags, SF_INTL))
498 sb->s_d_op = &affs_intl_dentry_operations; 498 sb->s_d_op = &affs_intl_dentry_operations;
499 else 499 else
500 sb->s_d_op = &affs_dentry_operations; 500 sb->s_d_op = &affs_dentry_operations;