Blame view
include/linux/posix_acl.h
3.02 KB
1da177e4c
|
1 2 3 4 5 6 7 8 9 |
/* File: linux/posix_acl.h (C) 2002 Andreas Gruenbacher, <a.gruenbacher@computer.org> */ #ifndef __LINUX_POSIX_ACL_H #define __LINUX_POSIX_ACL_H |
187f1882b
|
10 |
#include <linux/bug.h> |
1da177e4c
|
11 |
#include <linux/slab.h> |
3567866bf
|
12 |
#include <linux/rcupdate.h> |
bc8bcf3b1
|
13 |
#include <uapi/linux/posix_acl.h> |
1da177e4c
|
14 15 16 17 |
struct posix_acl_entry { short e_tag; unsigned short e_perm; |
2f6f0654a
|
18 19 20 |
union { kuid_t e_uid; kgid_t e_gid; |
2f6f0654a
|
21 |
}; |
1da177e4c
|
22 23 24 |
}; struct posix_acl { |
6d4e56ce9
|
25 26 |
atomic_t a_refcount; struct rcu_head a_rcu; |
1da177e4c
|
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
unsigned int a_count; struct posix_acl_entry a_entries[0]; }; #define FOREACH_ACL_ENTRY(pa, acl, pe) \ for(pa=(acl)->a_entries, pe=pa+(acl)->a_count; pa<pe; pa++) /* * Duplicate an ACL handle. */ static inline struct posix_acl * posix_acl_dup(struct posix_acl *acl) { if (acl) atomic_inc(&acl->a_refcount); return acl; } /* * Free an ACL handle. */ static inline void posix_acl_release(struct posix_acl *acl) { if (acl && atomic_dec_and_test(&acl->a_refcount)) |
3567866bf
|
53 |
kfree_rcu(acl, a_rcu); |
1da177e4c
|
54 55 56 57 |
} /* posix_acl.c */ |
f61f6da0d
|
58 |
extern void posix_acl_init(struct posix_acl *, int); |
dd0fc66fb
|
59 |
extern struct posix_acl *posix_acl_alloc(int, gfp_t); |
0d4d717f2
|
60 |
extern int posix_acl_valid(struct user_namespace *, const struct posix_acl *); |
1da177e4c
|
61 |
extern int posix_acl_permission(struct inode *, const struct posix_acl *, int); |
3a5fba19b
|
62 |
extern struct posix_acl *posix_acl_from_mode(umode_t, gfp_t); |
d6952123b
|
63 |
extern int posix_acl_equiv_mode(const struct posix_acl *, umode_t *); |
37bc15392
|
64 |
extern int __posix_acl_create(struct posix_acl **, gfp_t, umode_t *); |
5bf3258fd
|
65 |
extern int __posix_acl_chmod(struct posix_acl **, gfp_t, umode_t); |
1da177e4c
|
66 67 68 |
extern struct posix_acl *get_posix_acl(struct inode *, int); extern int set_posix_acl(struct inode *, int, struct posix_acl *); |
641cf4a66
|
69 |
#ifdef CONFIG_FS_POSIX_ACL |
37bc15392
|
70 71 72 |
extern int posix_acl_chmod(struct inode *, umode_t); extern int posix_acl_create(struct inode *, umode_t *, struct posix_acl **, struct posix_acl **); |
073931017
|
73 |
extern int posix_acl_update_mode(struct inode *, umode_t *, struct posix_acl **); |
5bf3258fd
|
74 |
|
feda821e7
|
75 76 |
extern int simple_set_acl(struct inode *, struct posix_acl *, int); extern int simple_acl_create(struct inode *, struct inode *); |
0afaa1204
|
77 78 79 80 81 |
struct posix_acl *get_cached_acl(struct inode *inode, int type); struct posix_acl *get_cached_acl_rcu(struct inode *inode, int type); void set_cached_acl(struct inode *inode, int type, struct posix_acl *acl); void forget_cached_acl(struct inode *inode, int type); void forget_all_cached_acls(struct inode *inode); |
72c04902d
|
82 83 84 |
static inline void cache_no_acl(struct inode *inode) { |
72c04902d
|
85 86 |
inode->i_acl = NULL; inode->i_default_acl = NULL; |
72c04902d
|
87 |
} |
5bf3258fd
|
88 |
#else |
37bc15392
|
89 |
static inline int posix_acl_chmod(struct inode *inode, umode_t mode) |
5bf3258fd
|
90 91 92 |
{ return 0; } |
feda821e7
|
93 94 95 96 97 98 |
#define simple_set_acl NULL static inline int simple_acl_create(struct inode *dir, struct inode *inode) { return 0; } |
5bf3258fd
|
99 100 101 |
static inline void cache_no_acl(struct inode *inode) { } |
37bc15392
|
102 103 104 105 106 107 108 |
static inline int posix_acl_create(struct inode *inode, umode_t *mode, struct posix_acl **default_acl, struct posix_acl **acl) { *default_acl = *acl = NULL; return 0; } |
013cdf108
|
109 110 111 112 |
static inline void forget_all_cached_acls(struct inode *inode) { } |
5bf3258fd
|
113 |
#endif /* CONFIG_FS_POSIX_ACL */ |
72c04902d
|
114 |
|
2982baa2a
|
115 |
struct posix_acl *get_acl(struct inode *inode, int type); |
72c04902d
|
116 |
|
1da177e4c
|
117 |
#endif /* __LINUX_POSIX_ACL_H */ |