aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/affs/affs.h24
-rw-r--r--fs/affs/amigaffs.c2
-rw-r--r--fs/affs/file.c2
-rw-r--r--fs/affs/inode.c32
-rw-r--r--fs/affs/namei.c6
-rw-r--r--fs/affs/super.c36
6 files changed, 54 insertions, 48 deletions
diff --git a/fs/affs/affs.h b/fs/affs/affs.h
index c8764bd7497d..35a855a8a2d7 100644
--- a/fs/affs/affs.h
+++ b/fs/affs/affs.h
@@ -106,18 +106,18 @@ struct affs_sb_info {
106 spinlock_t work_lock; /* protects sb_work and work_queued */ 106 spinlock_t work_lock; /* protects sb_work and work_queued */
107}; 107};
108 108
109#define SF_INTL 0x0001 /* International filesystem. */ 109#define AFFS_MOUNT_SF_INTL 0x0001 /* International filesystem. */
110#define SF_BM_VALID 0x0002 /* Bitmap is valid. */ 110#define AFFS_MOUNT_SF_BM_VALID 0x0002 /* Bitmap is valid. */
111#define SF_IMMUTABLE 0x0004 /* Protection bits cannot be changed */ 111#define AFFS_MOUNT_SF_IMMUTABLE 0x0004 /* Protection bits cannot be changed */
112#define SF_QUIET 0x0008 /* chmod errors will be not reported */ 112#define AFFS_MOUNT_SF_QUIET 0x0008 /* chmod errors will be not reported */
113#define SF_SETUID 0x0010 /* Ignore Amiga uid */ 113#define AFFS_MOUNT_SF_SETUID 0x0010 /* Ignore Amiga uid */
114#define SF_SETGID 0x0020 /* Ignore Amiga gid */ 114#define AFFS_MOUNT_SF_SETGID 0x0020 /* Ignore Amiga gid */
115#define SF_SETMODE 0x0040 /* Ignore Amiga protection bits */ 115#define AFFS_MOUNT_SF_SETMODE 0x0040 /* Ignore Amiga protection bits */
116#define SF_MUFS 0x0100 /* Use MUFS uid/gid mapping */ 116#define AFFS_MOUNT_SF_MUFS 0x0100 /* Use MUFS uid/gid mapping */
117#define SF_OFS 0x0200 /* Old filesystem */ 117#define AFFS_MOUNT_SF_OFS 0x0200 /* Old filesystem */
118#define SF_PREFIX 0x0400 /* Buffer for prefix is allocated */ 118#define AFFS_MOUNT_SF_PREFIX 0x0400 /* Buffer for prefix is allocated */
119#define SF_VERBOSE 0x0800 /* Talk about fs when mounting */ 119#define AFFS_MOUNT_SF_VERBOSE 0x0800 /* Talk about fs when mounting */
120#define SF_NO_TRUNCATE 0x1000 /* Don't truncate filenames */ 120#define AFFS_MOUNT_SF_NO_TRUNCATE 0x1000 /* Don't truncate filenames */
121 121
122/* short cut to get to the affs specific sb data */ 122/* short cut to get to the affs specific sb data */
123static inline struct affs_sb_info *AFFS_SB(struct super_block *sb) 123static inline struct affs_sb_info *AFFS_SB(struct super_block *sb)
diff --git a/fs/affs/amigaffs.c b/fs/affs/amigaffs.c
index 388da1ea815d..1a90e19a3f5b 100644
--- a/fs/affs/amigaffs.c
+++ b/fs/affs/amigaffs.c
@@ -472,7 +472,7 @@ 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 & SF_NO_TRUNCATE; 475 return AFFS_SB(inode->i_sb)->s_flags & AFFS_MOUNT_SF_NO_TRUNCATE;
476 476
477} 477}
478 478
diff --git a/fs/affs/file.c b/fs/affs/file.c
index 7c1a3d4c19c2..2e247595f3b3 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 & SF_OFS) { 918 if (AFFS_SB(sb)->s_flags & AFFS_MOUNT_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 6f34510449e8..53af66b01566 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 & SF_SETMODE) 69 if (sbi->s_flags & AFFS_MOUNT_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 & SF_SETUID) 75 if (id == 0 || sbi->s_flags & AFFS_MOUNT_SF_SETUID)
76 inode->i_uid = sbi->s_uid; 76 inode->i_uid = sbi->s_uid;
77 else if (id == 0xFFFF && sbi->s_flags & SF_MUFS) 77 else if (id == 0xFFFF && sbi->s_flags & AFFS_MOUNT_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 & SF_SETGID) 83 if (id == 0 || sbi->s_flags & AFFS_MOUNT_SF_SETGID)
84 inode->i_gid = sbi->s_gid; 84 inode->i_gid = sbi->s_gid;
85 else if (id == 0xFFFF && sbi->s_flags & SF_MUFS) 85 else if (id == 0xFFFF && sbi->s_flags & AFFS_MOUNT_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 & SF_SETMODE) { 97 sbi->s_flags & AFFS_MOUNT_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,8 @@ 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 & SF_OFS) ? &affs_aops_ofs : &affs_aops; 136 inode->i_mapping->a_ops = (sbi->s_flags & AFFS_MOUNT_SF_OFS) ?
137 &affs_aops_ofs : &affs_aops;
137 inode->i_op = &affs_file_inode_operations; 138 inode->i_op = &affs_file_inode_operations;
138 inode->i_fop = &affs_file_operations; 139 inode->i_fop = &affs_file_operations;
139 break; 140 break;
@@ -190,15 +191,15 @@ affs_write_inode(struct inode *inode, struct writeback_control *wbc)
190 if (!(inode->i_ino == AFFS_SB(sb)->s_root_block)) { 191 if (!(inode->i_ino == AFFS_SB(sb)->s_root_block)) {
191 uid = i_uid_read(inode); 192 uid = i_uid_read(inode);
192 gid = i_gid_read(inode); 193 gid = i_gid_read(inode);
193 if (AFFS_SB(sb)->s_flags & SF_MUFS) { 194 if (AFFS_SB(sb)->s_flags & AFFS_MOUNT_SF_MUFS) {
194 if (uid == 0 || uid == 0xFFFF) 195 if (uid == 0 || uid == 0xFFFF)
195 uid = uid ^ ~0; 196 uid = uid ^ ~0;
196 if (gid == 0 || gid == 0xFFFF) 197 if (gid == 0 || gid == 0xFFFF)
197 gid = gid ^ ~0; 198 gid = gid ^ ~0;
198 } 199 }
199 if (!(AFFS_SB(sb)->s_flags & SF_SETUID)) 200 if (!(AFFS_SB(sb)->s_flags & AFFS_MOUNT_SF_SETUID))
200 tail->uid = cpu_to_be16(uid); 201 tail->uid = cpu_to_be16(uid);
201 if (!(AFFS_SB(sb)->s_flags & SF_SETGID)) 202 if (!(AFFS_SB(sb)->s_flags & AFFS_MOUNT_SF_SETGID))
202 tail->gid = cpu_to_be16(gid); 203 tail->gid = cpu_to_be16(gid);
203 } 204 }
204 } 205 }
@@ -221,11 +222,14 @@ affs_notify_change(struct dentry *dentry, struct iattr *attr)
221 if (error) 222 if (error)
222 goto out; 223 goto out;
223 224
224 if (((attr->ia_valid & ATTR_UID) && (AFFS_SB(inode->i_sb)->s_flags & SF_SETUID)) || 225 if (((attr->ia_valid & ATTR_UID) &&
225 ((attr->ia_valid & ATTR_GID) && (AFFS_SB(inode->i_sb)->s_flags & SF_SETGID)) || 226 (AFFS_SB(inode->i_sb)->s_flags & AFFS_MOUNT_SF_SETUID)) ||
227 ((attr->ia_valid & ATTR_GID) &&
228 (AFFS_SB(inode->i_sb)->s_flags & AFFS_MOUNT_SF_SETGID)) ||
226 ((attr->ia_valid & ATTR_MODE) && 229 ((attr->ia_valid & ATTR_MODE) &&
227 (AFFS_SB(inode->i_sb)->s_flags & (SF_SETMODE | SF_IMMUTABLE)))) { 230 (AFFS_SB(inode->i_sb)->s_flags &
228 if (!(AFFS_SB(inode->i_sb)->s_flags & SF_QUIET)) 231 (AFFS_MOUNT_SF_SETMODE | AFFS_MOUNT_SF_IMMUTABLE)))) {
232 if (!(AFFS_SB(inode->i_sb)->s_flags & AFFS_MOUNT_SF_QUIET))
229 error = -EPERM; 233 error = -EPERM;
230 goto out; 234 goto out;
231 } 235 }
diff --git a/fs/affs/namei.c b/fs/affs/namei.c
index ffb7bd82c2a5..aaa81ab1b6fc 100644
--- a/fs/affs/namei.c
+++ b/fs/affs/namei.c
@@ -53,7 +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 & SF_INTL ? affs_intl_toupper : affs_toupper; 56 return AFFS_SB(sb)->s_flags & AFFS_MOUNT_SF_INTL ?
57 affs_intl_toupper : affs_toupper;
57} 58}
58 59
59/* 60/*
@@ -275,7 +276,8 @@ affs_create(struct inode *dir, struct dentry *dentry, umode_t mode, bool excl)
275 276
276 inode->i_op = &affs_file_inode_operations; 277 inode->i_op = &affs_file_inode_operations;
277 inode->i_fop = &affs_file_operations; 278 inode->i_fop = &affs_file_operations;
278 inode->i_mapping->a_ops = (AFFS_SB(sb)->s_flags & SF_OFS) ? &affs_aops_ofs : &affs_aops; 279 inode->i_mapping->a_ops = (AFFS_SB(sb)->s_flags & AFFS_MOUNT_SF_OFS) ?
280 &affs_aops_ofs : &affs_aops;
279 error = affs_add_entry(dir, inode, dentry, ST_FILE); 281 error = affs_add_entry(dir, inode, dentry, ST_FILE);
280 if (error) { 282 if (error) {
281 clear_nlink(inode); 283 clear_nlink(inode);
diff --git a/fs/affs/super.c b/fs/affs/super.c
index 4cf0e9113fb6..5623b494bdf5 100644
--- a/fs/affs/super.c
+++ b/fs/affs/super.c
@@ -227,22 +227,22 @@ parse_options(char *options, kuid_t *uid, kgid_t *gid, int *mode, int *reserved,
227 if (match_octal(&args[0], &option)) 227 if (match_octal(&args[0], &option))
228 return 0; 228 return 0;
229 *mode = option & 0777; 229 *mode = option & 0777;
230 *mount_opts |= SF_SETMODE; 230 *mount_opts |= AFFS_MOUNT_SF_SETMODE;
231 break; 231 break;
232 case Opt_mufs: 232 case Opt_mufs:
233 *mount_opts |= SF_MUFS; 233 *mount_opts |= AFFS_MOUNT_SF_MUFS;
234 break; 234 break;
235 case Opt_notruncate: 235 case Opt_notruncate:
236 *mount_opts |= SF_NO_TRUNCATE; 236 *mount_opts |= AFFS_MOUNT_SF_NO_TRUNCATE;
237 break; 237 break;
238 case Opt_prefix: 238 case Opt_prefix:
239 *prefix = match_strdup(&args[0]); 239 *prefix = match_strdup(&args[0]);
240 if (!*prefix) 240 if (!*prefix)
241 return 0; 241 return 0;
242 *mount_opts |= SF_PREFIX; 242 *mount_opts |= AFFS_MOUNT_SF_PREFIX;
243 break; 243 break;
244 case Opt_protect: 244 case Opt_protect:
245 *mount_opts |= SF_IMMUTABLE; 245 *mount_opts |= AFFS_MOUNT_SF_IMMUTABLE;
246 break; 246 break;
247 case Opt_reserved: 247 case Opt_reserved:
248 if (match_int(&args[0], reserved)) 248 if (match_int(&args[0], reserved))
@@ -258,7 +258,7 @@ parse_options(char *options, kuid_t *uid, kgid_t *gid, int *mode, int *reserved,
258 *gid = make_kgid(current_user_ns(), option); 258 *gid = make_kgid(current_user_ns(), option);
259 if (!gid_valid(*gid)) 259 if (!gid_valid(*gid))
260 return 0; 260 return 0;
261 *mount_opts |= SF_SETGID; 261 *mount_opts |= AFFS_MOUNT_SF_SETGID;
262 break; 262 break;
263 case Opt_setuid: 263 case Opt_setuid:
264 if (match_int(&args[0], &option)) 264 if (match_int(&args[0], &option))
@@ -266,10 +266,10 @@ parse_options(char *options, kuid_t *uid, kgid_t *gid, int *mode, int *reserved,
266 *uid = make_kuid(current_user_ns(), option); 266 *uid = make_kuid(current_user_ns(), option);
267 if (!uid_valid(*uid)) 267 if (!uid_valid(*uid))
268 return 0; 268 return 0;
269 *mount_opts |= SF_SETUID; 269 *mount_opts |= AFFS_MOUNT_SF_SETUID;
270 break; 270 break;
271 case Opt_verbose: 271 case Opt_verbose:
272 *mount_opts |= SF_VERBOSE; 272 *mount_opts |= AFFS_MOUNT_SF_VERBOSE;
273 break; 273 break;
274 case Opt_volume: { 274 case Opt_volume: {
275 char *vol = match_strdup(&args[0]); 275 char *vol = match_strdup(&args[0]);
@@ -435,30 +435,30 @@ got_root:
435 case MUFS_FS: 435 case MUFS_FS:
436 case MUFS_INTLFFS: 436 case MUFS_INTLFFS:
437 case MUFS_DCFFS: 437 case MUFS_DCFFS:
438 sbi->s_flags |= SF_MUFS; 438 sbi->s_flags |= AFFS_MOUNT_SF_MUFS;
439 /* fall thru */ 439 /* fall thru */
440 case FS_INTLFFS: 440 case FS_INTLFFS:
441 case FS_DCFFS: 441 case FS_DCFFS:
442 sbi->s_flags |= SF_INTL; 442 sbi->s_flags |= AFFS_MOUNT_SF_INTL;
443 break; 443 break;
444 case MUFS_FFS: 444 case MUFS_FFS:
445 sbi->s_flags |= SF_MUFS; 445 sbi->s_flags |= AFFS_MOUNT_SF_MUFS;
446 break; 446 break;
447 case FS_FFS: 447 case FS_FFS:
448 break; 448 break;
449 case MUFS_OFS: 449 case MUFS_OFS:
450 sbi->s_flags |= SF_MUFS; 450 sbi->s_flags |= AFFS_MOUNT_SF_MUFS;
451 /* fall thru */ 451 /* fall thru */
452 case FS_OFS: 452 case FS_OFS:
453 sbi->s_flags |= SF_OFS; 453 sbi->s_flags |= AFFS_MOUNT_SF_OFS;
454 sb->s_flags |= MS_NOEXEC; 454 sb->s_flags |= MS_NOEXEC;
455 break; 455 break;
456 case MUFS_DCOFS: 456 case MUFS_DCOFS:
457 case MUFS_INTLOFS: 457 case MUFS_INTLOFS:
458 sbi->s_flags |= SF_MUFS; 458 sbi->s_flags |= AFFS_MOUNT_SF_MUFS;
459 case FS_DCOFS: 459 case FS_DCOFS:
460 case FS_INTLOFS: 460 case FS_INTLOFS:
461 sbi->s_flags |= SF_INTL | SF_OFS; 461 sbi->s_flags |= AFFS_MOUNT_SF_INTL | AFFS_MOUNT_SF_OFS;
462 sb->s_flags |= MS_NOEXEC; 462 sb->s_flags |= MS_NOEXEC;
463 break; 463 break;
464 default: 464 default:
@@ -467,7 +467,7 @@ got_root:
467 return -EINVAL; 467 return -EINVAL;
468 } 468 }
469 469
470 if (mount_flags & SF_VERBOSE) { 470 if (mount_flags & AFFS_MOUNT_SF_VERBOSE) {
471 u8 len = AFFS_ROOT_TAIL(sb, root_bh)->disk_name[0]; 471 u8 len = AFFS_ROOT_TAIL(sb, root_bh)->disk_name[0];
472 pr_notice("Mounting volume \"%.*s\": Type=%.3s\\%c, Blocksize=%d\n", 472 pr_notice("Mounting volume \"%.*s\": Type=%.3s\\%c, Blocksize=%d\n",
473 len > 31 ? 31 : len, 473 len > 31 ? 31 : len,
@@ -478,7 +478,7 @@ got_root:
478 sb->s_flags |= MS_NODEV | MS_NOSUID; 478 sb->s_flags |= MS_NODEV | MS_NOSUID;
479 479
480 sbi->s_data_blksize = sb->s_blocksize; 480 sbi->s_data_blksize = sb->s_blocksize;
481 if (sbi->s_flags & SF_OFS) 481 if (sbi->s_flags & AFFS_MOUNT_SF_OFS)
482 sbi->s_data_blksize -= 24; 482 sbi->s_data_blksize -= 24;
483 483
484 tmp_flags = sb->s_flags; 484 tmp_flags = sb->s_flags;
@@ -493,7 +493,7 @@ got_root:
493 if (IS_ERR(root_inode)) 493 if (IS_ERR(root_inode))
494 return PTR_ERR(root_inode); 494 return PTR_ERR(root_inode);
495 495
496 if (AFFS_SB(sb)->s_flags & SF_INTL) 496 if (AFFS_SB(sb)->s_flags & AFFS_MOUNT_SF_INTL)
497 sb->s_d_op = &affs_intl_dentry_operations; 497 sb->s_d_op = &affs_intl_dentry_operations;
498 else 498 else
499 sb->s_d_op = &affs_dentry_operations; 499 sb->s_d_op = &affs_dentry_operations;