Blame view

include/linux/posix_acl.h 3.02 KB
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
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   Paul Gortmaker   BUG: headers with...
10
  #include <linux/bug.h>
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
11
  #include <linux/slab.h>
3567866bf   Al Viro   RCUify freeing ac...
12
  #include <linux/rcupdate.h>
bc8bcf3b1   Andreas Gruenbacher   posix_acl: uapi h...
13
  #include <uapi/linux/posix_acl.h>
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
14
15
16
17
  
  struct posix_acl_entry {
  	short			e_tag;
  	unsigned short		e_perm;
2f6f0654a   Eric W. Biederman   userns: Convert v...
18
19
20
  	union {
  		kuid_t		e_uid;
  		kgid_t		e_gid;
2f6f0654a   Eric W. Biederman   userns: Convert v...
21
  	};
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
22
23
24
  };
  
  struct posix_acl {
6d4e56ce9   Jeff Layton   posix_acl: de-uni...
25
26
  	atomic_t		a_refcount;
  	struct rcu_head		a_rcu;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
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   Al Viro   RCUify freeing ac...
53
  		kfree_rcu(acl, a_rcu);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
54
55
56
57
  }
  
  
  /* posix_acl.c */
f61f6da0d   Chuck Lever   NFS: Prevent memo...
58
  extern void posix_acl_init(struct posix_acl *, int);
dd0fc66fb   Al Viro   [PATCH] gfp flags...
59
  extern struct posix_acl *posix_acl_alloc(int, gfp_t);
0d4d717f2   Eric W. Biederman   vfs: Verify acls ...
60
  extern int posix_acl_valid(struct user_namespace *, const struct posix_acl *);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
61
  extern int posix_acl_permission(struct inode *, const struct posix_acl *, int);
3a5fba19b   Al Viro   switch posix_acl_...
62
  extern struct posix_acl *posix_acl_from_mode(umode_t, gfp_t);
d6952123b   Al Viro   switch posix_acl_...
63
  extern int posix_acl_equiv_mode(const struct posix_acl *, umode_t *);
37bc15392   Christoph Hellwig   fs: make posix_ac...
64
  extern int __posix_acl_create(struct posix_acl **, gfp_t, umode_t *);
5bf3258fd   Christoph Hellwig   fs: make posix_ac...
65
  extern int __posix_acl_chmod(struct posix_acl **, gfp_t, umode_t);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
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   Markus Trippelsdorf   inline functions ...
69
  #ifdef CONFIG_FS_POSIX_ACL
37bc15392   Christoph Hellwig   fs: make posix_ac...
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   Jan Kara   posix_acl: Clear ...
73
  extern int posix_acl_update_mode(struct inode *, umode_t *, struct posix_acl **);
5bf3258fd   Christoph Hellwig   fs: make posix_ac...
74

feda821e7   Christoph Hellwig   fs: remove generi...
75
76
  extern int simple_set_acl(struct inode *, struct posix_acl *, int);
  extern int simple_acl_create(struct inode *, struct inode *);
0afaa1204   Andrew Morton   posix_acl: uninli...
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   Al Viro   Get "no acls for ...
82
83
84
  
  static inline void cache_no_acl(struct inode *inode)
  {
72c04902d   Al Viro   Get "no acls for ...
85
86
  	inode->i_acl = NULL;
  	inode->i_default_acl = NULL;
72c04902d   Al Viro   Get "no acls for ...
87
  }
5bf3258fd   Christoph Hellwig   fs: make posix_ac...
88
  #else
37bc15392   Christoph Hellwig   fs: make posix_ac...
89
  static inline int posix_acl_chmod(struct inode *inode, umode_t mode)
5bf3258fd   Christoph Hellwig   fs: make posix_ac...
90
91
92
  {
  	return 0;
  }
feda821e7   Christoph Hellwig   fs: remove generi...
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   Christoph Hellwig   fs: make posix_ac...
99
100
101
  static inline void cache_no_acl(struct inode *inode)
  {
  }
37bc15392   Christoph Hellwig   fs: make posix_ac...
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   Christoph Hellwig   nfs: use generic ...
109
110
111
112
  
  static inline void forget_all_cached_acls(struct inode *inode)
  {
  }
5bf3258fd   Christoph Hellwig   fs: make posix_ac...
113
  #endif /* CONFIG_FS_POSIX_ACL */
72c04902d   Al Viro   Get "no acls for ...
114

2982baa2a   Christoph Hellwig   fs: add get_acl h...
115
  struct posix_acl *get_acl(struct inode *inode, int type);
72c04902d   Al Viro   Get "no acls for ...
116

1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
117
  #endif  /* __LINUX_POSIX_ACL_H */