Source
36
36
37
37
struct posix_acl *get_cached_acl(struct inode *inode, int type)
38
38
{
39
39
struct posix_acl **p = acl_by_type(inode, type);
40
40
struct posix_acl *acl;
41
41
42
42
for (;;) {
43
43
rcu_read_lock();
44
44
acl = rcu_dereference(*p);
45
45
if (!acl || is_uncached_acl(acl) ||
46
-
atomic_inc_not_zero(&acl->a_refcount))
46
+
refcount_inc_not_zero(&acl->a_refcount))
47
47
break;
48
48
rcu_read_unlock();
49
49
cpu_relax();
50
50
}
51
51
rcu_read_unlock();
52
52
return acl;
53
53
}
54
54
EXPORT_SYMBOL(get_cached_acl);
55
55
56
56
struct posix_acl *get_cached_acl_rcu(struct inode *inode, int type)
157
157
return acl;
158
158
}
159
159
EXPORT_SYMBOL(get_acl);
160
160
161
161
/*
162
162
* Init a fresh posix_acl
163
163
*/
164
164
void
165
165
posix_acl_init(struct posix_acl *acl, int count)
166
166
{
167
-
atomic_set(&acl->a_refcount, 1);
167
+
refcount_set(&acl->a_refcount, 1);
168
168
acl->a_count = count;
169
169
}
170
170
EXPORT_SYMBOL(posix_acl_init);
171
171
172
172
/*
173
173
* Allocate a new ACL with the specified number of entries.
174
174
*/
175
175
struct posix_acl *
176
176
posix_acl_alloc(int count, gfp_t flags)
177
177
{
190
190
static struct posix_acl *
191
191
posix_acl_clone(const struct posix_acl *acl, gfp_t flags)
192
192
{
193
193
struct posix_acl *clone = NULL;
194
194
195
195
if (acl) {
196
196
int size = sizeof(struct posix_acl) + acl->a_count *
197
197
sizeof(struct posix_acl_entry);
198
198
clone = kmemdup(acl, size, flags);
199
199
if (clone)
200
-
atomic_set(&clone->a_refcount, 1);
200
+
refcount_set(&clone->a_refcount, 1);
201
201
}
202
202
return clone;
203
203
}
204
204
205
205
/*
206
206
* Check if an acl is valid. Returns 0 if it is, or -E... otherwise.
207
207
*/
208
208
int
209
209
posix_acl_valid(struct user_namespace *user_ns, const struct posix_acl *acl)
210
210
{