Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/v4l-dvb
[linux-2.6/mini2440.git] / fs / xfs / xfs_acl.h
blob34b7d3391299a02b3e76d8203b876a28b067cf54
1 /*
2 * Copyright (c) 2001-2005 Silicon Graphics, Inc.
3 * All Rights Reserved.
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation.
9 * This program is distributed in the hope that it would be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write the Free Software Foundation,
16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 #ifndef __XFS_ACL_H__
19 #define __XFS_ACL_H__
22 * Access Control Lists
24 typedef __uint16_t xfs_acl_perm_t;
25 typedef __int32_t xfs_acl_type_t;
26 typedef __int32_t xfs_acl_tag_t;
27 typedef __int32_t xfs_acl_id_t;
29 #define XFS_ACL_MAX_ENTRIES 25
30 #define XFS_ACL_NOT_PRESENT (-1)
32 typedef struct xfs_acl_entry {
33 xfs_acl_tag_t ae_tag;
34 xfs_acl_id_t ae_id;
35 xfs_acl_perm_t ae_perm;
36 } xfs_acl_entry_t;
38 typedef struct xfs_acl {
39 __int32_t acl_cnt;
40 xfs_acl_entry_t acl_entry[XFS_ACL_MAX_ENTRIES];
41 } xfs_acl_t;
43 /* On-disk XFS extended attribute names */
44 #define SGI_ACL_FILE "SGI_ACL_FILE"
45 #define SGI_ACL_DEFAULT "SGI_ACL_DEFAULT"
46 #define SGI_ACL_FILE_SIZE (sizeof(SGI_ACL_FILE)-1)
47 #define SGI_ACL_DEFAULT_SIZE (sizeof(SGI_ACL_DEFAULT)-1)
50 #ifdef CONFIG_XFS_POSIX_ACL
52 struct vattr;
53 struct xfs_inode;
55 extern struct kmem_zone *xfs_acl_zone;
56 #define xfs_acl_zone_init(zone, name) \
57 (zone) = kmem_zone_init(sizeof(xfs_acl_t), (name))
58 #define xfs_acl_zone_destroy(zone) kmem_zone_destroy(zone)
60 extern int xfs_acl_inherit(bhv_vnode_t *, mode_t mode, xfs_acl_t *);
61 extern int xfs_acl_iaccess(struct xfs_inode *, mode_t, cred_t *);
62 extern int xfs_acl_vtoacl(bhv_vnode_t *, xfs_acl_t *, xfs_acl_t *);
63 extern int xfs_acl_vhasacl_access(bhv_vnode_t *);
64 extern int xfs_acl_vhasacl_default(bhv_vnode_t *);
65 extern int xfs_acl_vset(bhv_vnode_t *, void *, size_t, int);
66 extern int xfs_acl_vget(bhv_vnode_t *, void *, size_t, int);
67 extern int xfs_acl_vremove(bhv_vnode_t *, int);
69 #define _ACL_TYPE_ACCESS 1
70 #define _ACL_TYPE_DEFAULT 2
71 #define _ACL_PERM_INVALID(perm) ((perm) & ~(ACL_READ|ACL_WRITE|ACL_EXECUTE))
73 #define _ACL_INHERIT(c,m,d) (xfs_acl_inherit(c,m,d))
74 #define _ACL_GET_ACCESS(pv,pa) (xfs_acl_vtoacl(pv,pa,NULL) == 0)
75 #define _ACL_GET_DEFAULT(pv,pd) (xfs_acl_vtoacl(pv,NULL,pd) == 0)
76 #define _ACL_ACCESS_EXISTS xfs_acl_vhasacl_access
77 #define _ACL_DEFAULT_EXISTS xfs_acl_vhasacl_default
78 #define _ACL_XFS_IACCESS(i,m,c) (XFS_IFORK_Q(i) ? xfs_acl_iaccess(i,m,c) : -1)
80 #define _ACL_ALLOC(a) ((a) = kmem_zone_alloc(xfs_acl_zone, KM_SLEEP))
81 #define _ACL_FREE(a) ((a)? kmem_zone_free(xfs_acl_zone, (a)):(void)0)
83 #else
84 #define xfs_acl_zone_init(zone,name)
85 #define xfs_acl_zone_destroy(zone)
86 #define xfs_acl_vset(v,p,sz,t) (-EOPNOTSUPP)
87 #define xfs_acl_vget(v,p,sz,t) (-EOPNOTSUPP)
88 #define xfs_acl_vremove(v,t) (-EOPNOTSUPP)
89 #define xfs_acl_vhasacl_access(v) (0)
90 #define xfs_acl_vhasacl_default(v) (0)
91 #define _ACL_ALLOC(a) (1) /* successfully allocate nothing */
92 #define _ACL_FREE(a) ((void)0)
93 #define _ACL_INHERIT(c,m,d) (0)
94 #define _ACL_GET_ACCESS(pv,pa) (0)
95 #define _ACL_GET_DEFAULT(pv,pd) (0)
96 #define _ACL_ACCESS_EXISTS (NULL)
97 #define _ACL_DEFAULT_EXISTS (NULL)
98 #define _ACL_XFS_IACCESS(i,m,c) (-1)
99 #endif
101 #endif /* __XFS_ACL_H__ */