2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
20 * @APPLE_LICENSE_HEADER_END@
24 * attr.h - attribute data structures and interfaces
26 * Copyright (c) 1998, Apple Computer, Inc. All Rights Reserved.
33 #include <sys/types.h>
36 #include <sys/ucred.h>
39 #include <sys/mount.h>
45 #define FSOPT_NOFOLLOW 0x00000001
46 #define FSOPT_NOINMEMUPDATE 0x00000002
48 typedef u_int32_t text_encoding_t
;
50 typedef u_int32_t fsobj_type_t
;
52 typedef u_int32_t fsobj_tag_t
;
54 typedef u_int32_t fsfile_type_t
;
56 typedef u_int32_t fsvolid_t
;
58 typedef struct fsobj_id
{
60 u_int32_t fid_generation
;
63 typedef u_int32_t attrgroup_t
;
66 u_short bitmapcount
; /* number of attr. bit sets in list (should be 5) */
67 u_int16_t reserved
; /* (to maintain 4-byte alignment) */
68 attrgroup_t commonattr
; /* common attribute group */
69 attrgroup_t volattr
; /* Volume attribute group */
70 attrgroup_t dirattr
; /* directory attribute group */
71 attrgroup_t fileattr
; /* file attribute group */
72 attrgroup_t forkattr
; /* fork attribute group */
74 #define ATTR_BIT_MAP_COUNT 5
76 typedef struct attribute_set
{
77 attrgroup_t commonattr
; /* common attribute group */
78 attrgroup_t volattr
; /* Volume attribute group */
79 attrgroup_t dirattr
; /* directory attribute group */
80 attrgroup_t fileattr
; /* file attribute group */
81 attrgroup_t forkattr
; /* fork attribute group */
84 typedef struct attrreference
{
89 /* XXX PPD This is derived from HFSVolumePriv.h and should perhaps be referenced from there? */
92 u_int32_t startblock
; /* first block allocated */
93 u_int32_t blockcount
; /* number of blocks allocated */
96 typedef struct diskextent extentrecord
[8];
98 typedef u_int32_t vol_capabilities_set_t
[4];
100 #define VOL_CAPABILITIES_FORMAT 0
101 #define VOL_CAPABILITIES_INTERFACES 1
102 #define VOL_CAPABILITIES_RESERVED1 2
103 #define VOL_CAPABILITIES_RESERVED2 3
105 typedef struct vol_capabilities_attr
{
106 vol_capabilities_set_t capabilities
;
107 vol_capabilities_set_t valid
;
108 } vol_capabilities_attr_t
;
110 #define VOL_CAP_FMT_PERSISTENTOBJECTIDS 0x00000001
111 #define VOL_CAP_FMT_SYMBOLICLINKS 0x00000002
112 #define VOL_CAP_FMT_HARDLINKS 0x00000004
114 #define VOL_CAP_INT_SEARCHFS 0x00000001
115 #define VOL_CAP_INT_ATTRLIST 0x00000002
116 #define VOL_CAP_INT_NFSEXPORT 0x00000004
118 typedef struct vol_attributes_attr
{
119 attribute_set_t validattr
;
120 attribute_set_t nativeattr
;
121 } vol_attributes_attr_t
;
123 #define DIR_MNTSTATUS_MNTPOINT 0x00000001
125 #define ATTR_CMN_NAME 0x00000001
126 #define ATTR_CMN_DEVID 0x00000002
127 #define ATTR_CMN_FSID 0x00000004
128 #define ATTR_CMN_OBJTYPE 0x00000008
129 #define ATTR_CMN_OBJTAG 0x00000010
130 #define ATTR_CMN_OBJID 0x00000020
131 #define ATTR_CMN_OBJPERMANENTID 0x00000040
132 #define ATTR_CMN_PAROBJID 0x00000080
133 #define ATTR_CMN_SCRIPT 0x00000100
134 #define ATTR_CMN_CRTIME 0x00000200
135 #define ATTR_CMN_MODTIME 0x00000400
136 #define ATTR_CMN_CHGTIME 0x00000800
137 #define ATTR_CMN_ACCTIME 0x00001000
138 #define ATTR_CMN_BKUPTIME 0x00002000
139 #define ATTR_CMN_FNDRINFO 0x00004000
140 #define ATTR_CMN_OWNERID 0x00008000
141 #define ATTR_CMN_GRPID 0x00010000
142 #define ATTR_CMN_ACCESSMASK 0x00020000
143 #define ATTR_CMN_FLAGS 0x00040000
144 #define ATTR_CMN_NAMEDATTRCOUNT 0x00080000
145 #define ATTR_CMN_NAMEDATTRLIST 0x00100000
146 #define ATTR_CMN_USERACCESS 0x00200000
148 #define ATTR_CMN_VALIDMASK 0x003FFFFF
149 #define ATTR_CMN_SETMASK 0x0007FF00
150 #define ATTR_CMN_VOLSETMASK 0x00006700
152 #define ATTR_VOL_FSTYPE 0x00000001
153 #define ATTR_VOL_SIGNATURE 0x00000002
154 #define ATTR_VOL_SIZE 0x00000004
155 #define ATTR_VOL_SPACEFREE 0x00000008
156 #define ATTR_VOL_SPACEAVAIL 0x00000010
157 #define ATTR_VOL_MINALLOCATION 0x00000020
158 #define ATTR_VOL_ALLOCATIONCLUMP 0x00000040
159 #define ATTR_VOL_IOBLOCKSIZE 0x00000080
160 #define ATTR_VOL_OBJCOUNT 0x00000100
161 #define ATTR_VOL_FILECOUNT 0x00000200
162 #define ATTR_VOL_DIRCOUNT 0x00000400
163 #define ATTR_VOL_MAXOBJCOUNT 0x00000800
164 #define ATTR_VOL_MOUNTPOINT 0x00001000
165 #define ATTR_VOL_NAME 0x00002000
166 #define ATTR_VOL_MOUNTFLAGS 0x00004000
167 #define ATTR_VOL_MOUNTEDDEVICE 0x00008000
168 #define ATTR_VOL_ENCODINGSUSED 0x00010000
169 #define ATTR_VOL_CAPABILITIES 0x00020000
170 #define ATTR_VOL_ATTRIBUTES 0x40000000
171 #define ATTR_VOL_INFO 0x80000000
173 #define ATTR_VOL_VALIDMASK 0xC003FFFF
174 #define ATTR_VOL_SETMASK 0x80002000
177 /* File/directory attributes: */
178 #define ATTR_DIR_LINKCOUNT 0x00000001
179 #define ATTR_DIR_ENTRYCOUNT 0x00000002
180 #define ATTR_DIR_MOUNTSTATUS 0x00000004
182 #define ATTR_DIR_VALIDMASK 0x00000007
183 #define ATTR_DIR_SETMASK 0x00000000
185 #define ATTR_FILE_LINKCOUNT 0x00000001
186 #define ATTR_FILE_TOTALSIZE 0x00000002
187 #define ATTR_FILE_ALLOCSIZE 0x00000004
188 #define ATTR_FILE_IOBLOCKSIZE 0x00000008
189 #define ATTR_FILE_CLUMPSIZE 0x00000010
190 #define ATTR_FILE_DEVTYPE 0x00000020
191 #define ATTR_FILE_FILETYPE 0x00000040
192 #define ATTR_FILE_FORKCOUNT 0x00000080
193 #define ATTR_FILE_FORKLIST 0x00000100
194 #define ATTR_FILE_DATALENGTH 0x00000200
195 #define ATTR_FILE_DATAALLOCSIZE 0x00000400
196 #define ATTR_FILE_DATAEXTENTS 0x00000800
197 #define ATTR_FILE_RSRCLENGTH 0x00001000
198 #define ATTR_FILE_RSRCALLOCSIZE 0x00002000
199 #define ATTR_FILE_RSRCEXTENTS 0x00004000
201 #define ATTR_FILE_VALIDMASK 0x00007FFF
202 #define ATTR_FILE_SETMASK 0x00000020
204 #define ATTR_FORK_TOTALSIZE 0x00000001
205 #define ATTR_FORK_ALLOCSIZE 0x00000002
207 #define ATTR_FORK_VALIDMASK 0x00000003
208 #define ATTR_FORK_SETMASK 0x00000000
210 #define SRCHFS_START 0x00000001
211 #define SRCHFS_MATCHPARTIALNAMES 0x00000002
212 #define SRCHFS_MATCHDIRS 0x00000004
213 #define SRCHFS_MATCHFILES 0x00000008
214 #define SRCHFS_NEGATEPARAMS 0x80000000
215 #define SRCHFS_VALIDOPTIONSMASK 0x8000000F
217 struct fssearchblock
{
218 struct attrlist
*returnattrs
;
220 size_t returnbuffersize
;
222 struct timeval timelimit
;
224 size_t sizeofsearchparams1
;
226 size_t sizeofsearchparams2
;
227 struct attrlist searchattrs
;
232 u_char reserved
[556]; // sizeof( SearchState )
237 #define FST_EOF (-1) /* end-of-file offset */
240 /* XXX PPD This should be moved to dirent.h to be with getdirentries(2) et al. */
241 //int getdirentriesattr(int fd, const struct attrlist *attrspec, void *attrbuf, size_t bufsize, long //*cookie);
245 #endif /* !_SYS_ATTR_H_ */