diff options
Diffstat (limited to 'fs/affs/inode.c')
-rw-r--r-- | fs/affs/inode.c | 32 |
1 files changed, 18 insertions, 14 deletions
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 | } |