aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/posix_acl.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /include/linux/posix_acl.h
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'include/linux/posix_acl.h')
-rw-r--r--include/linux/posix_acl.h86
1 files changed, 86 insertions, 0 deletions
diff --git a/include/linux/posix_acl.h b/include/linux/posix_acl.h
new file mode 100644
index 000000000000..4caedddaa033
--- /dev/null
+++ b/include/linux/posix_acl.h
@@ -0,0 +1,86 @@
1/*
2 File: linux/posix_acl.h
3
4 (C) 2002 Andreas Gruenbacher, <a.gruenbacher@computer.org>
5*/
6
7
8#ifndef __LINUX_POSIX_ACL_H
9#define __LINUX_POSIX_ACL_H
10
11#include <linux/slab.h>
12
13#define ACL_UNDEFINED_ID (-1)
14
15/* a_type field in acl_user_posix_entry_t */
16#define ACL_TYPE_ACCESS (0x8000)
17#define ACL_TYPE_DEFAULT (0x4000)
18
19/* e_tag entry in struct posix_acl_entry */
20#define ACL_USER_OBJ (0x01)
21#define ACL_USER (0x02)
22#define ACL_GROUP_OBJ (0x04)
23#define ACL_GROUP (0x08)
24#define ACL_MASK (0x10)
25#define ACL_OTHER (0x20)
26
27/* permissions in the e_perm field */
28#define ACL_READ (0x04)
29#define ACL_WRITE (0x02)
30#define ACL_EXECUTE (0x01)
31//#define ACL_ADD (0x08)
32//#define ACL_DELETE (0x10)
33
34struct posix_acl_entry {
35 short e_tag;
36 unsigned short e_perm;
37 unsigned int e_id;
38};
39
40struct posix_acl {
41 atomic_t a_refcount;
42 unsigned int a_count;
43 struct posix_acl_entry a_entries[0];
44};
45
46#define FOREACH_ACL_ENTRY(pa, acl, pe) \
47 for(pa=(acl)->a_entries, pe=pa+(acl)->a_count; pa<pe; pa++)
48
49
50/*
51 * Duplicate an ACL handle.
52 */
53static inline struct posix_acl *
54posix_acl_dup(struct posix_acl *acl)
55{
56 if (acl)
57 atomic_inc(&acl->a_refcount);
58 return acl;
59}
60
61/*
62 * Free an ACL handle.
63 */
64static inline void
65posix_acl_release(struct posix_acl *acl)
66{
67 if (acl && atomic_dec_and_test(&acl->a_refcount))
68 kfree(acl);
69}
70
71
72/* posix_acl.c */
73
74extern struct posix_acl *posix_acl_alloc(int, unsigned int __nocast);
75extern struct posix_acl *posix_acl_clone(const struct posix_acl *, unsigned int __nocast);
76extern int posix_acl_valid(const struct posix_acl *);
77extern int posix_acl_permission(struct inode *, const struct posix_acl *, int);
78extern struct posix_acl *posix_acl_from_mode(mode_t, unsigned int __nocast);
79extern int posix_acl_equiv_mode(const struct posix_acl *, mode_t *);
80extern int posix_acl_create_masq(struct posix_acl *, mode_t *);
81extern int posix_acl_chmod_masq(struct posix_acl *, mode_t);
82
83extern struct posix_acl *get_posix_acl(struct inode *, int);
84extern int set_posix_acl(struct inode *, int, struct posix_acl *);
85
86#endif /* __LINUX_POSIX_ACL_H */