diff options
Diffstat (limited to 'include/linux/posix_acl.h')
-rw-r--r-- | include/linux/posix_acl.h | 100 |
1 files changed, 33 insertions, 67 deletions
diff --git a/include/linux/posix_acl.h b/include/linux/posix_acl.h index 7931efe71175..3e96a6a76103 100644 --- a/include/linux/posix_acl.h +++ b/include/linux/posix_acl.h | |||
@@ -39,9 +39,6 @@ struct posix_acl_entry { | |||
39 | union { | 39 | union { |
40 | kuid_t e_uid; | 40 | kuid_t e_uid; |
41 | kgid_t e_gid; | 41 | kgid_t e_gid; |
42 | #ifndef CONFIG_UIDGID_STRICT_TYPE_CHECKS | ||
43 | unsigned int e_id; | ||
44 | #endif | ||
45 | }; | 42 | }; |
46 | }; | 43 | }; |
47 | 44 | ||
@@ -88,91 +85,60 @@ extern int posix_acl_valid(const struct posix_acl *); | |||
88 | extern int posix_acl_permission(struct inode *, const struct posix_acl *, int); | 85 | extern int posix_acl_permission(struct inode *, const struct posix_acl *, int); |
89 | extern struct posix_acl *posix_acl_from_mode(umode_t, gfp_t); | 86 | extern struct posix_acl *posix_acl_from_mode(umode_t, gfp_t); |
90 | extern int posix_acl_equiv_mode(const struct posix_acl *, umode_t *); | 87 | extern int posix_acl_equiv_mode(const struct posix_acl *, umode_t *); |
91 | extern int posix_acl_create(struct posix_acl **, gfp_t, umode_t *); | 88 | extern int __posix_acl_create(struct posix_acl **, gfp_t, umode_t *); |
92 | extern int posix_acl_chmod(struct posix_acl **, gfp_t, umode_t); | 89 | extern int __posix_acl_chmod(struct posix_acl **, gfp_t, umode_t); |
93 | 90 | ||
94 | extern struct posix_acl *get_posix_acl(struct inode *, int); | 91 | extern struct posix_acl *get_posix_acl(struct inode *, int); |
95 | extern int set_posix_acl(struct inode *, int, struct posix_acl *); | 92 | extern int set_posix_acl(struct inode *, int, struct posix_acl *); |
96 | 93 | ||
97 | #ifdef CONFIG_FS_POSIX_ACL | 94 | #ifdef CONFIG_FS_POSIX_ACL |
98 | static inline struct posix_acl **acl_by_type(struct inode *inode, int type) | 95 | extern int posix_acl_chmod(struct inode *, umode_t); |
96 | extern int posix_acl_create(struct inode *, umode_t *, struct posix_acl **, | ||
97 | struct posix_acl **); | ||
98 | |||
99 | extern int simple_set_acl(struct inode *, struct posix_acl *, int); | ||
100 | extern int simple_acl_create(struct inode *, struct inode *); | ||
101 | |||
102 | struct posix_acl **acl_by_type(struct inode *inode, int type); | ||
103 | struct posix_acl *get_cached_acl(struct inode *inode, int type); | ||
104 | struct posix_acl *get_cached_acl_rcu(struct inode *inode, int type); | ||
105 | void set_cached_acl(struct inode *inode, int type, struct posix_acl *acl); | ||
106 | void forget_cached_acl(struct inode *inode, int type); | ||
107 | void forget_all_cached_acls(struct inode *inode); | ||
108 | |||
109 | static inline void cache_no_acl(struct inode *inode) | ||
99 | { | 110 | { |
100 | switch (type) { | 111 | inode->i_acl = NULL; |
101 | case ACL_TYPE_ACCESS: | 112 | inode->i_default_acl = NULL; |
102 | return &inode->i_acl; | ||
103 | case ACL_TYPE_DEFAULT: | ||
104 | return &inode->i_default_acl; | ||
105 | default: | ||
106 | BUG(); | ||
107 | } | ||
108 | } | 113 | } |
109 | 114 | #else | |
110 | static inline struct posix_acl *get_cached_acl(struct inode *inode, int type) | 115 | static inline int posix_acl_chmod(struct inode *inode, umode_t mode) |
111 | { | 116 | { |
112 | struct posix_acl **p = acl_by_type(inode, type); | 117 | return 0; |
113 | struct posix_acl *acl = ACCESS_ONCE(*p); | ||
114 | if (acl) { | ||
115 | spin_lock(&inode->i_lock); | ||
116 | acl = *p; | ||
117 | if (acl != ACL_NOT_CACHED) | ||
118 | acl = posix_acl_dup(acl); | ||
119 | spin_unlock(&inode->i_lock); | ||
120 | } | ||
121 | return acl; | ||
122 | } | 118 | } |
123 | 119 | ||
124 | static inline struct posix_acl *get_cached_acl_rcu(struct inode *inode, int type) | 120 | #define simple_set_acl NULL |
121 | |||
122 | static inline int simple_acl_create(struct inode *dir, struct inode *inode) | ||
125 | { | 123 | { |
126 | return rcu_dereference(*acl_by_type(inode, type)); | 124 | return 0; |
127 | } | 125 | } |
128 | 126 | static inline void cache_no_acl(struct inode *inode) | |
129 | static inline void set_cached_acl(struct inode *inode, | ||
130 | int type, | ||
131 | struct posix_acl *acl) | ||
132 | { | 127 | { |
133 | struct posix_acl **p = acl_by_type(inode, type); | ||
134 | struct posix_acl *old; | ||
135 | spin_lock(&inode->i_lock); | ||
136 | old = *p; | ||
137 | rcu_assign_pointer(*p, posix_acl_dup(acl)); | ||
138 | spin_unlock(&inode->i_lock); | ||
139 | if (old != ACL_NOT_CACHED) | ||
140 | posix_acl_release(old); | ||
141 | } | 128 | } |
142 | 129 | ||
143 | static inline void forget_cached_acl(struct inode *inode, int type) | 130 | static inline int posix_acl_create(struct inode *inode, umode_t *mode, |
131 | struct posix_acl **default_acl, struct posix_acl **acl) | ||
144 | { | 132 | { |
145 | struct posix_acl **p = acl_by_type(inode, type); | 133 | *default_acl = *acl = NULL; |
146 | struct posix_acl *old; | 134 | return 0; |
147 | spin_lock(&inode->i_lock); | ||
148 | old = *p; | ||
149 | *p = ACL_NOT_CACHED; | ||
150 | spin_unlock(&inode->i_lock); | ||
151 | if (old != ACL_NOT_CACHED) | ||
152 | posix_acl_release(old); | ||
153 | } | 135 | } |
154 | 136 | ||
155 | static inline void forget_all_cached_acls(struct inode *inode) | 137 | static inline void forget_all_cached_acls(struct inode *inode) |
156 | { | 138 | { |
157 | struct posix_acl *old_access, *old_default; | ||
158 | spin_lock(&inode->i_lock); | ||
159 | old_access = inode->i_acl; | ||
160 | old_default = inode->i_default_acl; | ||
161 | inode->i_acl = inode->i_default_acl = ACL_NOT_CACHED; | ||
162 | spin_unlock(&inode->i_lock); | ||
163 | if (old_access != ACL_NOT_CACHED) | ||
164 | posix_acl_release(old_access); | ||
165 | if (old_default != ACL_NOT_CACHED) | ||
166 | posix_acl_release(old_default); | ||
167 | } | 139 | } |
168 | #endif | 140 | #endif /* CONFIG_FS_POSIX_ACL */ |
169 | 141 | ||
170 | static inline void cache_no_acl(struct inode *inode) | 142 | struct posix_acl *get_acl(struct inode *inode, int type); |
171 | { | ||
172 | #ifdef CONFIG_FS_POSIX_ACL | ||
173 | inode->i_acl = NULL; | ||
174 | inode->i_default_acl = NULL; | ||
175 | #endif | ||
176 | } | ||
177 | 143 | ||
178 | #endif /* __LINUX_POSIX_ACL_H */ | 144 | #endif /* __LINUX_POSIX_ACL_H */ |