aboutsummaryrefslogtreecommitdiffstats
path: root/fs/hfsplus/ioctl.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/hfsplus/ioctl.c')
-rw-r--r--fs/hfsplus/ioctl.c25
1 files changed, 11 insertions, 14 deletions
diff --git a/fs/hfsplus/ioctl.c b/fs/hfsplus/ioctl.c
index c9ac443d202a..80eb5b3a5edd 100644
--- a/fs/hfsplus/ioctl.c
+++ b/fs/hfsplus/ioctl.c
@@ -26,9 +26,9 @@ static int hfsplus_ioctl_getflags(struct file *file, int __user *user_flags)
26 struct hfsplus_inode_info *hip = HFSPLUS_I(inode); 26 struct hfsplus_inode_info *hip = HFSPLUS_I(inode);
27 unsigned int flags = 0; 27 unsigned int flags = 0;
28 28
29 if (hip->rootflags & HFSPLUS_FLG_IMMUTABLE) 29 if (inode->i_flags & S_IMMUTABLE)
30 flags |= FS_IMMUTABLE_FL; 30 flags |= FS_IMMUTABLE_FL;
31 if (hip->rootflags & HFSPLUS_FLG_APPEND) 31 if (inode->i_flags |= S_APPEND)
32 flags |= FS_APPEND_FL; 32 flags |= FS_APPEND_FL;
33 if (hip->userflags & HFSPLUS_FLG_NODUMP) 33 if (hip->userflags & HFSPLUS_FLG_NODUMP)
34 flags |= FS_NODUMP_FL; 34 flags |= FS_NODUMP_FL;
@@ -59,8 +59,8 @@ static int hfsplus_ioctl_setflags(struct file *file, int __user *user_flags)
59 59
60 mutex_lock(&inode->i_mutex); 60 mutex_lock(&inode->i_mutex);
61 61
62 if (flags & (FS_IMMUTABLE_FL|FS_APPEND_FL) || 62 if ((flags & (FS_IMMUTABLE_FL|FS_APPEND_FL)) ||
63 hip->rootflags & (HFSPLUS_FLG_IMMUTABLE|HFSPLUS_FLG_APPEND)) { 63 inode->i_flags & (S_IMMUTABLE|S_APPEND)) {
64 if (!capable(CAP_LINUX_IMMUTABLE)) { 64 if (!capable(CAP_LINUX_IMMUTABLE)) {
65 err = -EPERM; 65 err = -EPERM;
66 goto out_unlock_inode; 66 goto out_unlock_inode;
@@ -72,20 +72,17 @@ static int hfsplus_ioctl_setflags(struct file *file, int __user *user_flags)
72 err = -EOPNOTSUPP; 72 err = -EOPNOTSUPP;
73 goto out_unlock_inode; 73 goto out_unlock_inode;
74 } 74 }
75 if (flags & FS_IMMUTABLE_FL) { 75
76 if (flags & FS_IMMUTABLE_FL)
76 inode->i_flags |= S_IMMUTABLE; 77 inode->i_flags |= S_IMMUTABLE;
77 hip->rootflags |= HFSPLUS_FLG_IMMUTABLE; 78 else
78 } else {
79 inode->i_flags &= ~S_IMMUTABLE; 79 inode->i_flags &= ~S_IMMUTABLE;
80 hip->rootflags &= ~HFSPLUS_FLG_IMMUTABLE; 80
81 } 81 if (flags & FS_APPEND_FL)
82 if (flags & FS_APPEND_FL) {
83 inode->i_flags |= S_APPEND; 82 inode->i_flags |= S_APPEND;
84 hip->rootflags |= HFSPLUS_FLG_APPEND; 83 else
85 } else {
86 inode->i_flags &= ~S_APPEND; 84 inode->i_flags &= ~S_APPEND;
87 hip->rootflags &= ~HFSPLUS_FLG_APPEND; 85
88 }
89 if (flags & FS_NODUMP_FL) 86 if (flags & FS_NODUMP_FL)
90 hip->userflags |= HFSPLUS_FLG_NODUMP; 87 hip->userflags |= HFSPLUS_FLG_NODUMP;
91 else 88 else