1 /* sec_posixacl.h: Internal definitions for POSIX ACLs.
3 This file is part of Cygwin.
5 This software is a copyrighted work licensed under the terms of the
6 Cygwin license. Please consult the file "CYGWIN_LICENSE" for
9 #include <cygwin/acl.h>
11 #include <acl/libacl.h>
13 /* Magic marker for acl_t. */
14 #define ACL_MAGIC (0xacdccdcadcaccacdULL)
16 /* Only used internally as a_type for deleted entries. */
17 #define ACL_DELETED_TAG (0xffff)
19 /* Only used internally from acl_to_text/acl_to_any_text. */
20 #define TEXT_END_SEPARATOR (0x1000)
21 #define TEXT_IS_POSIX (0x2000)
23 /* Internal ACL representation. */
26 uint64_t magic
; /* Must be ACL_MAGIC. */
27 uint16_t max_count
; /* Max. number of entries. */
28 uint16_t count
; /* Number of used entries. */
29 uint16_t deleted
; /* Number of used but deleted entries. */
30 uint16_t next
; /* Next entry to be returned by acl_get_entry. */
31 aclent_t
*entry
; /* Pointer to variable array of ACL entries. */
35 __to_entry (acl_t acl
, uint16_t idx
)
37 return ((uint64_t) idx
<< 48) | (uint64_t) ((uintptr_t) acl
);
39 #define __to_permset(a,i) ((acl_permset_t)__to_entry((a),(i)))
42 __from_entry (acl_entry_t entry_d
, uint16_t &idx
)
45 acl_t acl
= (acl_t
) (entry_d
& ~((uint64_t) 0xffff << 48));
46 if (acl
->magic
!= ACL_MAGIC
)
48 if (idx
>= acl
->count
)
50 if (acl
->entry
[idx
].a_type
== ACL_DELETED_TAG
)
54 #define __from_permset(p,i) __from_entry((acl_permset_t)(p),(i))
56 /* External (but opaque) ACL representation. */
59 uint16_t count
; /* Number of used entries. */
60 aclent_t entry
[0]; /* Variable array of ACL entries. */
63 /* Shared functions defined in sec_acl.cc. */
64 mode_t
__aclcalcmask (aclent_t
*, int);
65 int __aclsort (int, aclent_t
*);
66 int __aclcheck (aclent_t
*, int, int *, bool);
67 char *__acltotext (aclent_t
*, int, const char *, char, int);
68 void *__aclfromtext (const char *, int *, bool);