154803Srwatson/*-
285584Srwatson * Copyright (c) 1999-2001 Robert N. M. Watson
3192652Strasz * Copyright (c) 2008 Edward Tomasz Napiera��a <trasz@FreeBSD.org>
454803Srwatson * All rights reserved.
554803Srwatson *
685845Srwatson * This software was developed by Robert Watson for the TrustedBSD Project.
785845Srwatson *
854803Srwatson * Redistribution and use in source and binary forms, with or without
954803Srwatson * modification, are permitted provided that the following conditions
1054803Srwatson * are met:
1154803Srwatson * 1. Redistributions of source code must retain the above copyright
1254803Srwatson *    notice, this list of conditions and the following disclaimer.
1354803Srwatson * 2. Redistributions in binary form must reproduce the above copyright
1454803Srwatson *    notice, this list of conditions and the following disclaimer in the
1554803Srwatson *    documentation and/or other materials provided with the distribution.
1654803Srwatson *
1754803Srwatson * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1854803Srwatson * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1954803Srwatson * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2054803Srwatson * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
2154803Srwatson * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2254803Srwatson * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2354803Srwatson * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2454803Srwatson * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2554803Srwatson * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2654803Srwatson * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2754803Srwatson * SUCH DAMAGE.
2854803Srwatson *
2954803Srwatson * $FreeBSD: releng/10.3/sys/sys/acl.h 290893 2015-11-15 23:54:34Z ngie $
3054803Srwatson */
3154803Srwatson/*
3273890Srwatson * Developed by the TrustedBSD Project.
33192652Strasz * Support for POSIX.1e and NFSv4 access control lists.
3454803Srwatson */
3554803Srwatson
36129096Srwatson#ifndef _SYS_ACL_H_
37129096Srwatson#define	_SYS_ACL_H_
3854803Srwatson
39149811Scsjp#include <sys/param.h>
40149811Scsjp#include <sys/queue.h>
41149811Scsjp#include <vm/uma.h>
42149811Scsjp
4354803Srwatson/*
44192652Strasz * POSIX.1e and NFSv4 ACL types and related constants.
4554803Srwatson */
4654803Srwatson
47192586Strasztypedef uint32_t	acl_tag_t;
48192586Strasztypedef uint32_t	acl_perm_t;
49192586Strasztypedef uint16_t	acl_entry_type_t;
50192586Strasztypedef uint16_t	acl_flag_t;
51192586Strasztypedef int		acl_type_t;
52192586Strasztypedef int		*acl_permset_t;
53192586Strasztypedef uint16_t	*acl_flagset_t;
54192586Strasz
55192586Strasz/*
56192586Strasz * With 254 entries, "struct acl_t_struct" is exactly one 4kB page big.
57192652Strasz * Note that with NFSv4 ACLs, the maximum number of ACL entries one
58192586Strasz * may set on file or directory is about half of ACL_MAX_ENTRIES.
59192586Strasz *
60192586Strasz * If you increase this, you might also need to increase
61192586Strasz * _ACL_T_ALIGNMENT_BITS in lib/libc/posix1e/acl_support.h.
62192586Strasz *
63192586Strasz * The maximum number of POSIX.1e ACLs is controlled
64192586Strasz * by OLDACL_MAX_ENTRIES.  Changing that one will break binary
65192586Strasz * compatibility with pre-8.0 userland and change on-disk ACL layout.
66192586Strasz */
67192586Strasz#define	ACL_MAX_ENTRIES				254
68192586Strasz
69192586Strasz#if defined(_KERNEL) || defined(_ACL_PRIVATE)
70192586Strasz
7174273Srwatson#define	POSIX1E_ACL_ACCESS_EXTATTR_NAMESPACE	EXTATTR_NAMESPACE_SYSTEM
7274273Srwatson#define	POSIX1E_ACL_ACCESS_EXTATTR_NAME		"posix1e.acl_access"
7374273Srwatson#define	POSIX1E_ACL_DEFAULT_EXTATTR_NAMESPACE	EXTATTR_NAMESPACE_SYSTEM
7474273Srwatson#define	POSIX1E_ACL_DEFAULT_EXTATTR_NAME	"posix1e.acl_default"
75192586Strasz#define	NFS4_ACL_EXTATTR_NAMESPACE		EXTATTR_NAMESPACE_SYSTEM
76192586Strasz#define	NFS4_ACL_EXTATTR_NAME			"nfs4.acl"
77192586Strasz#define	OLDACL_MAX_ENTRIES			32
7854803Srwatson
79192586Strasz/*
80192586Strasz * "struct oldacl" is used in compatibility ACL syscalls and for on-disk
81192586Strasz * storage of POSIX.1e ACLs.
82192586Strasz */
83192586Strasztypedef int	oldacl_tag_t;
84192586Strasztypedef mode_t	oldacl_perm_t;
8554803Srwatson
86192586Straszstruct oldacl_entry {
87192586Strasz	oldacl_tag_t	ae_tag;
88192586Strasz	uid_t		ae_id;
89192586Strasz	oldacl_perm_t	ae_perm;
90192586Strasz};
91192586Strasztypedef struct oldacl_entry	*oldacl_entry_t;
92192586Strasz
93192586Straszstruct oldacl {
94192586Strasz	int			acl_cnt;
95192586Strasz	struct oldacl_entry	acl_entry[OLDACL_MAX_ENTRIES];
96192586Strasz};
97192586Strasz
98192586Strasz/*
99192586Strasz * Current "struct acl".
100192586Strasz */
10154803Srwatsonstruct acl_entry {
102200829Strasz	acl_tag_t		ae_tag;
103200829Strasz	uid_t			ae_id;
104200829Strasz	acl_perm_t		ae_perm;
105200829Strasz	/* NFSv4 entry type, "allow" or "deny".  Unused in POSIX.1e ACLs. */
106192586Strasz	acl_entry_type_t	ae_entry_type;
107200829Strasz	/* NFSv4 ACL inheritance.  Unused in POSIX.1e ACLs. */
108200829Strasz	acl_flag_t		ae_flags;
10954803Srwatson};
11054803Srwatsontypedef struct acl_entry	*acl_entry_t;
11154803Srwatson
112192586Strasz/*
113192586Strasz * Internal ACL structure, used in libc, kernel APIs and for on-disk
114192652Strasz * storage of NFSv4 ACLs.  POSIX.1e ACLs use "struct oldacl" for on-disk
115192586Strasz * storage.
116192586Strasz */
11754803Srwatsonstruct acl {
118192586Strasz	unsigned int		acl_maxcnt;
119192586Strasz	unsigned int		acl_cnt;
120192586Strasz	/* Will be required e.g. to implement NFSv4.1 ACL inheritance. */
121192586Strasz	int			acl_spare[4];
12256272Srwatson	struct acl_entry	acl_entry[ACL_MAX_ENTRIES];
12354803Srwatson};
12454803Srwatson
125192586Strasz/*
126192586Strasz * ACL structure internal to libc.
127192586Strasz */
12875928Sjedgarstruct acl_t_struct {
12975928Sjedgar	struct acl		ats_acl;
13075928Sjedgar	int			ats_cur_entry;
131194955Strasz	/*
132194955Strasz	 * ats_brand is for libc internal bookkeeping only.
133194955Strasz	 * Applications should use acl_get_brand_np(3).
134194955Strasz	 * Kernel code should use the "type" argument passed
135194955Strasz	 * to VOP_SETACL, VOP_GETACL or VOP_ACLCHECK calls;
136194955Strasz	 * ACL_TYPE_ACCESS or ACL_TYPE_DEFAULT mean POSIX.1e
137194955Strasz	 * ACL, ACL_TYPE_NFS4 means NFSv4 ACL.
138194955Strasz	 */
139194955Strasz	int			ats_brand;
14075928Sjedgar};
14175928Sjedgartypedef struct acl_t_struct *acl_t;
14275928Sjedgar
143192586Strasz#else /* _KERNEL || _ACL_PRIVATE */
144192586Strasz
145192586Strasztypedef void *acl_entry_t;
146192586Strasztypedef void *acl_t;
147192586Strasz
148192586Strasz#endif /* !_KERNEL && !_ACL_PRIVATE */
149192586Strasz
15054803Srwatson/*
151194955Strasz * Possible valid values for ats_brand field.
152194955Strasz */
153194955Strasz#define	ACL_BRAND_UNKNOWN	0
154194955Strasz#define	ACL_BRAND_POSIX		1
155194955Strasz#define	ACL_BRAND_NFS4		2
156194955Strasz
157194955Strasz/*
158192586Strasz * Possible valid values for ae_tag field.  For explanation, see acl(9).
15954803Srwatson */
16075490Sjedgar#define	ACL_UNDEFINED_TAG	0x00000000
16175490Sjedgar#define	ACL_USER_OBJ		0x00000001
16275490Sjedgar#define	ACL_USER		0x00000002
16375490Sjedgar#define	ACL_GROUP_OBJ		0x00000004
16475490Sjedgar#define	ACL_GROUP		0x00000008
16575490Sjedgar#define	ACL_MASK		0x00000010
16675490Sjedgar#define	ACL_OTHER		0x00000020
16775490Sjedgar#define	ACL_OTHER_OBJ		ACL_OTHER
168192652Strasz#define	ACL_EVERYONE		0x00000040
16954803Srwatson
17056753Srwatson/*
171192652Strasz * Possible valid values for ae_entry_type field, valid only for NFSv4 ACLs.
172192652Strasz */
173192652Strasz#define	ACL_ENTRY_TYPE_ALLOW	0x0100
174192652Strasz#define	ACL_ENTRY_TYPE_DENY	0x0200
175192652Strasz#define	ACL_ENTRY_TYPE_AUDIT	0x0400
176192652Strasz#define	ACL_ENTRY_TYPE_ALARM	0x0800
177192652Strasz
178192652Strasz/*
179192586Strasz * Possible valid values for acl_type_t arguments.  First two
180192586Strasz * are provided only for backwards binary compatibility.
18156753Srwatson */
182192586Strasz#define	ACL_TYPE_ACCESS_OLD	0x00000000
183192586Strasz#define	ACL_TYPE_DEFAULT_OLD	0x00000001
184192586Strasz#define	ACL_TYPE_ACCESS		0x00000002
185192586Strasz#define	ACL_TYPE_DEFAULT	0x00000003
186192652Strasz#define	ACL_TYPE_NFS4		0x00000004
18754803Srwatson
18854803Srwatson/*
189192652Strasz * Possible bits in ae_perm field for POSIX.1e ACLs.  Note
190192586Strasz * that ACL_EXECUTE may be used in both NFSv4 and POSIX.1e ACLs.
19154803Srwatson */
19275404Sjedgar#define	ACL_EXECUTE		0x0001
19375404Sjedgar#define	ACL_WRITE		0x0002
19475404Sjedgar#define	ACL_READ		0x0004
19575404Sjedgar#define	ACL_PERM_NONE		0x0000
19675404Sjedgar#define	ACL_PERM_BITS		(ACL_EXECUTE | ACL_WRITE | ACL_READ)
19775404Sjedgar#define	ACL_POSIX1E_BITS	(ACL_EXECUTE | ACL_WRITE | ACL_READ)
19854803Srwatson
19975490Sjedgar/*
200192652Strasz * Possible bits in ae_perm field for NFSv4 ACLs.
201192652Strasz */
202192652Strasz#define	ACL_READ_DATA		0x00000008
203192652Strasz#define	ACL_LIST_DIRECTORY	0x00000008
204192652Strasz#define	ACL_WRITE_DATA		0x00000010
205192652Strasz#define	ACL_ADD_FILE		0x00000010
206192652Strasz#define	ACL_APPEND_DATA		0x00000020
207192652Strasz#define	ACL_ADD_SUBDIRECTORY	0x00000020
208192652Strasz#define	ACL_READ_NAMED_ATTRS	0x00000040
209192652Strasz#define	ACL_WRITE_NAMED_ATTRS	0x00000080
210192652Strasz/* ACL_EXECUTE is defined above. */
211192652Strasz#define	ACL_DELETE_CHILD	0x00000100
212192652Strasz#define	ACL_READ_ATTRIBUTES	0x00000200
213192652Strasz#define	ACL_WRITE_ATTRIBUTES	0x00000400
214192652Strasz#define	ACL_DELETE		0x00000800
215192652Strasz#define	ACL_READ_ACL		0x00001000
216192652Strasz#define	ACL_WRITE_ACL		0x00002000
217192652Strasz#define	ACL_WRITE_OWNER		0x00004000
218192652Strasz#define	ACL_SYNCHRONIZE		0x00008000
219192652Strasz
220220465Strasz#define	ACL_FULL_SET		(ACL_READ_DATA | ACL_WRITE_DATA | \
221192652Strasz    ACL_APPEND_DATA | ACL_READ_NAMED_ATTRS | ACL_WRITE_NAMED_ATTRS | \
222192652Strasz    ACL_EXECUTE | ACL_DELETE_CHILD | ACL_READ_ATTRIBUTES | \
223192652Strasz    ACL_WRITE_ATTRIBUTES | ACL_DELETE | ACL_READ_ACL | ACL_WRITE_ACL | \
224192652Strasz    ACL_WRITE_OWNER | ACL_SYNCHRONIZE)
225192652Strasz
226220465Strasz#define	ACL_MODIFY_SET		(ACL_FULL_SET & \
227220465Strasz    ~(ACL_WRITE_ACL | ACL_WRITE_OWNER))
228220465Strasz
229220465Strasz#define	ACL_READ_SET		(ACL_READ_DATA | ACL_READ_NAMED_ATTRS | \
230220465Strasz    ACL_READ_ATTRIBUTES | ACL_READ_ACL)
231220465Strasz
232220465Strasz#define	ACL_WRITE_SET		(ACL_WRITE_DATA | ACL_APPEND_DATA | \
233220465Strasz    ACL_WRITE_NAMED_ATTRS | ACL_WRITE_ATTRIBUTES)
234220465Strasz
235220465Strasz#define	ACL_NFS4_PERM_BITS	ACL_FULL_SET
236220465Strasz
237192652Strasz/*
238192586Strasz * Possible entry_id values for acl_get_entry(3).
23975490Sjedgar */
24075800Sjedgar#define	ACL_FIRST_ENTRY		0
24175800Sjedgar#define	ACL_NEXT_ENTRY		1
24275490Sjedgar
24375490Sjedgar/*
244192652Strasz * Possible values in ae_flags field; valid only for NFSv4 ACLs.
245192652Strasz */
246192652Strasz#define	ACL_ENTRY_FILE_INHERIT		0x0001
247192652Strasz#define	ACL_ENTRY_DIRECTORY_INHERIT	0x0002
248192652Strasz#define	ACL_ENTRY_NO_PROPAGATE_INHERIT	0x0004
249192652Strasz#define	ACL_ENTRY_INHERIT_ONLY		0x0008
250192652Strasz#define	ACL_ENTRY_SUCCESSFUL_ACCESS	0x0010
251192652Strasz#define	ACL_ENTRY_FAILED_ACCESS		0x0020
252290893Sngie#define	ACL_ENTRY_INHERITED		0x0080
253192652Strasz
254192652Strasz#define	ACL_FLAGS_BITS			(ACL_ENTRY_FILE_INHERIT | \
255192652Strasz    ACL_ENTRY_DIRECTORY_INHERIT | ACL_ENTRY_NO_PROPAGATE_INHERIT | \
256192652Strasz    ACL_ENTRY_INHERIT_ONLY | ACL_ENTRY_SUCCESSFUL_ACCESS | \
257290893Sngie    ACL_ENTRY_FAILED_ACCESS | ACL_ENTRY_INHERITED)
258192652Strasz
259192652Strasz/*
260192586Strasz * Undefined value in ae_id field.  ae_id should be set to this value
261192586Strasz * iff ae_tag is ACL_USER_OBJ, ACL_GROUP_OBJ, ACL_OTHER or ACL_EVERYONE.
26275490Sjedgar */
26375800Sjedgar#define	ACL_UNDEFINED_ID	((uid_t)-1)
26475490Sjedgar
265194955Strasz/*
266194955Strasz * Possible values for _flags parameter in acl_to_text_np(3).
267194955Strasz */
268194955Strasz#define	ACL_TEXT_VERBOSE	0x01
269194955Strasz#define	ACL_TEXT_NUMERIC_IDS	0x02
270194955Strasz#define	ACL_TEXT_APPEND_ID	0x04
27156272Srwatson
27254803Srwatson/*
273167635Srwatson * POSIX.1e ACLs are capable of expressing the read, write, and execute bits
274167635Srwatson * of the POSIX mode field.  We provide two masks: one that defines the bits
275167635Srwatson * the ACL will replace in the mode, and the other that defines the bits that
276167635Srwatson * must be preseved when an ACL is updating a mode.
277118407Srwatson */
278118407Srwatson#define	ACL_OVERRIDE_MASK	(S_IRWXU | S_IRWXG | S_IRWXO)
279118407Srwatson#define	ACL_PRESERVE_MASK	(~ACL_OVERRIDE_MASK)
280118407Srwatson
281194955Strasz#ifdef _KERNEL
282194955Strasz
283118407Srwatson/*
284192586Strasz * Filesystem-independent code to move back and forth between POSIX mode and
285167635Srwatson * POSIX.1e ACL representations.
286118407Srwatson */
287118407Srwatsonacl_perm_t		acl_posix1e_mode_to_perm(acl_tag_t tag, mode_t mode);
28892719Salfredstruct acl_entry	acl_posix1e_mode_to_entry(acl_tag_t tag, uid_t uid,
289118407Srwatson			    gid_t gid, mode_t mode);
290118407Srwatsonmode_t			acl_posix1e_perms_to_mode(
291118407Srwatson			    struct acl_entry *acl_user_obj_entry,
292118407Srwatson			    struct acl_entry *acl_group_obj_entry,
293118407Srwatson			    struct acl_entry *acl_other_entry);
294118407Srwatsonmode_t			acl_posix1e_acl_to_mode(struct acl *acl);
295118407Srwatsonmode_t			acl_posix1e_newfilemode(mode_t cmode,
296118407Srwatson			    struct acl *dacl);
297191249Straszstruct acl		*acl_alloc(int flags);
298191249Straszvoid			acl_free(struct acl *aclp);
299194955Strasz
300194955Straszvoid			acl_nfs4_sync_acl_from_mode(struct acl *aclp,
301194955Strasz			    mode_t mode, int file_owner_id);
302194955Straszvoid			acl_nfs4_sync_mode_from_acl(mode_t *mode,
303194955Strasz			    const struct acl *aclp);
304194955Straszint			acl_nfs4_is_trivial(const struct acl *aclp,
305194955Strasz			    int file_owner_id);
306194955Straszvoid			acl_nfs4_compute_inherited_acl(
307194955Strasz			    const struct acl *parent_aclp,
308194955Strasz			    struct acl *child_aclp, mode_t mode,
309194955Strasz			    int file_owner_id, int is_directory);
310192586Straszint			acl_copy_oldacl_into_acl(const struct oldacl *source,
311192586Strasz			    struct acl *dest);
312192586Straszint			acl_copy_acl_into_oldacl(const struct acl *source,
313192586Strasz			    struct oldacl *dest);
31473890Srwatson
315118407Srwatson/*
316192586Strasz * To allocate 'struct acl', use acl_alloc()/acl_free() instead of this.
317118407Srwatson */
318192586StraszMALLOC_DECLARE(M_ACL);
319192586Strasz/*
320192586Strasz * Filesystem-independent syntax check for a POSIX.1e ACL.
321192586Strasz */
322118407Srwatsonint			acl_posix1e_check(struct acl *acl);
323194955Straszint 			acl_nfs4_check(const struct acl *aclp, int is_directory);
324118407Srwatson
32556272Srwatson#else /* !_KERNEL */
32654803Srwatson
327192586Strasz#if defined(_ACL_PRIVATE)
328192586Strasz
32954803Srwatson/*
330167635Srwatson * Syscall interface -- use the library calls instead as the syscalls have
331192586Strasz * strict ACL entry ordering requirements.
33254803Srwatson */
33356272Srwatson__BEGIN_DECLS
33456753Srwatsonint	__acl_aclcheck_fd(int _filedes, acl_type_t _type, struct acl *_aclp);
33556753Srwatsonint	__acl_aclcheck_file(const char *_path, acl_type_t _type,
33656753Srwatson	    struct acl *_aclp);
337108408Srwatsonint	__acl_aclcheck_link(const char *_path, acl_type_t _type,
338108408Srwatson	    struct acl *_aclp);
33956753Srwatsonint	__acl_delete_fd(int _filedes, acl_type_t _type);
34056753Srwatsonint	__acl_delete_file(const char *_path_p, acl_type_t _type);
341108408Srwatsonint	__acl_delete_link(const char *_path_p, acl_type_t _type);
34256753Srwatsonint	__acl_get_fd(int _filedes, acl_type_t _type, struct acl *_aclp);
34356753Srwatsonint	__acl_get_file(const char *_path, acl_type_t _type, struct acl *_aclp);
344108408Srwatsonint	__acl_get_link(const char *_path, acl_type_t _type, struct acl *_aclp);
34556753Srwatsonint	__acl_set_fd(int _filedes, acl_type_t _type, struct acl *_aclp);
34656753Srwatsonint	__acl_set_file(const char *_path, acl_type_t _type, struct acl *_aclp);
347108408Srwatsonint	__acl_set_link(const char *_path, acl_type_t _type, struct acl *_aclp);
34856272Srwatson__END_DECLS
34954803Srwatson
350192586Strasz#endif /* _ACL_PRIVATE */
351192586Strasz
35254803Srwatson/*
353167635Srwatson * Supported POSIX.1e ACL manipulation and assignment/retrieval API _np calls
354167635Srwatson * are local extensions that reflect an environment capable of opening file
355167635Srwatson * descriptors of directories, and allowing additional ACL type for different
356167635Srwatson * filesystems (i.e., AFS).
35754803Srwatson */
35856272Srwatson__BEGIN_DECLS
359194955Straszint	acl_add_flag_np(acl_flagset_t _flagset_d, acl_flag_t _flag);
36074667Sjedgarint	acl_add_perm(acl_permset_t _permset_d, acl_perm_t _perm);
36175928Sjedgarint	acl_calc_mask(acl_t *_acl_p);
362194955Straszint	acl_clear_flags_np(acl_flagset_t _flagset_d);
36374667Sjedgarint	acl_clear_perms(acl_permset_t _permset_d);
36474667Sjedgarint	acl_copy_entry(acl_entry_t _dest_d, acl_entry_t _src_d);
36574667Sjedgarssize_t	acl_copy_ext(void *_buf_p, acl_t _acl, ssize_t _size);
36674667Sjedgaracl_t	acl_copy_int(const void *_buf_p);
36774667Sjedgarint	acl_create_entry(acl_t *_acl_p, acl_entry_t *_entry_p);
368194955Straszint	acl_create_entry_np(acl_t *_acl_p, acl_entry_t *_entry_p, int _index);
369108408Srwatsonint	acl_delete_entry(acl_t _acl, acl_entry_t _entry_d);
370194955Straszint	acl_delete_entry_np(acl_t _acl, int _index);
37156753Srwatsonint	acl_delete_fd_np(int _filedes, acl_type_t _type);
37256753Srwatsonint	acl_delete_file_np(const char *_path_p, acl_type_t _type);
373108408Srwatsonint	acl_delete_link_np(const char *_path_p, acl_type_t _type);
37456753Srwatsonint	acl_delete_def_file(const char *_path_p);
375108408Srwatsonint	acl_delete_def_link_np(const char *_path_p);
376194955Straszint	acl_delete_flag_np(acl_flagset_t _flagset_d, acl_flag_t _flag);
37774667Sjedgarint	acl_delete_perm(acl_permset_t _permset_d, acl_perm_t _perm);
37856753Srwatsonacl_t	acl_dup(acl_t _acl);
37956753Srwatsonint	acl_free(void *_obj_p);
38056753Srwatsonacl_t	acl_from_text(const char *_buf_p);
381194955Straszint	acl_get_brand_np(acl_t _acl, int *_brand_p);
38274667Sjedgarint	acl_get_entry(acl_t _acl, int _entry_id, acl_entry_t *_entry_p);
38356753Srwatsonacl_t	acl_get_fd(int _fd);
38456753Srwatsonacl_t	acl_get_fd_np(int fd, acl_type_t _type);
38556753Srwatsonacl_t	acl_get_file(const char *_path_p, acl_type_t _type);
386194955Straszint	acl_get_entry_type_np(acl_entry_t _entry_d, acl_entry_type_t *_entry_type_p);
387108408Srwatsonacl_t	acl_get_link_np(const char *_path_p, acl_type_t _type);
38874667Sjedgarvoid	*acl_get_qualifier(acl_entry_t _entry_d);
389194955Straszint	acl_get_flag_np(acl_flagset_t _flagset_d, acl_flag_t _flag);
39075492Sjedgarint	acl_get_perm_np(acl_permset_t _permset_d, acl_perm_t _perm);
391194955Straszint	acl_get_flagset_np(acl_entry_t _entry_d, acl_flagset_t *_flagset_p);
39274667Sjedgarint	acl_get_permset(acl_entry_t _entry_d, acl_permset_t *_permset_p);
39374667Sjedgarint	acl_get_tag_type(acl_entry_t _entry_d, acl_tag_t *_tag_type_p);
39456753Srwatsonacl_t	acl_init(int _count);
39556753Srwatsonint	acl_set_fd(int _fd, acl_t _acl);
39656753Srwatsonint	acl_set_fd_np(int _fd, acl_t _acl, acl_type_t _type);
39756753Srwatsonint	acl_set_file(const char *_path_p, acl_type_t _type, acl_t _acl);
398194955Straszint	acl_set_entry_type_np(acl_entry_t _entry_d, acl_entry_type_t _entry_type);
399108408Srwatsonint	acl_set_link_np(const char *_path_p, acl_type_t _type, acl_t _acl);
400194955Straszint	acl_set_flagset_np(acl_entry_t _entry_d, acl_flagset_t _flagset_d);
40174667Sjedgarint	acl_set_permset(acl_entry_t _entry_d, acl_permset_t _permset_d);
40274667Sjedgarint	acl_set_qualifier(acl_entry_t _entry_d, const void *_tag_qualifier_p);
40374667Sjedgarint	acl_set_tag_type(acl_entry_t _entry_d, acl_tag_t _tag_type);
40474667Sjedgarssize_t	acl_size(acl_t _acl);
40556753Srwatsonchar	*acl_to_text(acl_t _acl, ssize_t *_len_p);
406194955Straszchar	*acl_to_text_np(acl_t _acl, ssize_t *_len_p, int _flags);
40756753Srwatsonint	acl_valid(acl_t _acl);
40856753Srwatsonint	acl_valid_fd_np(int _fd, acl_type_t _type, acl_t _acl);
40956753Srwatsonint	acl_valid_file_np(const char *_path_p, acl_type_t _type, acl_t _acl);
410108408Srwatsonint	acl_valid_link_np(const char *_path_p, acl_type_t _type, acl_t _acl);
411194955Straszint	acl_is_trivial_np(const acl_t _acl, int *_trivialp);
412194955Straszacl_t	acl_strip_np(const acl_t _acl, int recalculate_mask);
41356272Srwatson__END_DECLS
41454803Srwatson
41556272Srwatson#endif /* !_KERNEL */
41656312Srwatson
417129096Srwatson#endif /* !_SYS_ACL_H_ */
418