]> git.saurik.com Git - apple/xnu.git/blob - bsd/sys/attr.h
732410ea685af70e79ce71c6adf4aabab5d9feda
[apple/xnu.git] / bsd / sys / attr.h
1 /*
2 * Copyright (c) 2000-2002 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
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.
11 *
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
18 * under the License.
19 *
20 * @APPLE_LICENSE_HEADER_END@
21 */
22
23 /*
24 * attr.h - attribute data structures and interfaces
25 *
26 * Copyright (c) 1998, Apple Computer, Inc. All Rights Reserved.
27 */
28
29 #ifndef _SYS_ATTR_H_
30 #define _SYS_ATTR_H_
31
32 #include <sys/appleapiopts.h>
33
34 #ifdef __APPLE_API_UNSTABLE
35 #ifndef _SYS_TYPES_H_
36 #include <sys/types.h>
37 #endif
38 #ifndef _SYS_UCRED_H
39 #include <sys/ucred.h>
40 #endif
41 #ifndef _SYS_MOUNT_H_
42 #include <sys/mount.h>
43 #endif
44 #ifndef _SYS_TIME_H_
45 #include <sys/time.h>
46 #endif
47
48 #define FSOPT_NOFOLLOW 0x00000001
49 #define FSOPT_NOINMEMUPDATE 0x00000002
50
51 typedef u_int32_t text_encoding_t;
52
53 typedef u_int32_t fsobj_type_t;
54
55 typedef u_int32_t fsobj_tag_t;
56
57 typedef u_int32_t fsfile_type_t;
58
59 typedef u_int32_t fsvolid_t;
60
61 typedef struct fsobj_id {
62 u_int32_t fid_objno;
63 u_int32_t fid_generation;
64 } fsobj_id_t;
65
66 typedef u_int32_t attrgroup_t;
67
68 struct attrlist {
69 u_short bitmapcount; /* number of attr. bit sets in list (should be 5) */
70 u_int16_t reserved; /* (to maintain 4-byte alignment) */
71 attrgroup_t commonattr; /* common attribute group */
72 attrgroup_t volattr; /* Volume attribute group */
73 attrgroup_t dirattr; /* directory attribute group */
74 attrgroup_t fileattr; /* file attribute group */
75 attrgroup_t forkattr; /* fork attribute group */
76 };
77 #define ATTR_BIT_MAP_COUNT 5
78
79 typedef struct attribute_set {
80 attrgroup_t commonattr; /* common attribute group */
81 attrgroup_t volattr; /* Volume attribute group */
82 attrgroup_t dirattr; /* directory attribute group */
83 attrgroup_t fileattr; /* file attribute group */
84 attrgroup_t forkattr; /* fork attribute group */
85 } attribute_set_t;
86
87 typedef struct attrreference {
88 long attr_dataoffset;
89 size_t attr_length;
90 } attrreference_t;
91
92 /* XXX PPD This is derived from HFSVolumePriv.h and should perhaps be referenced from there? */
93
94 struct diskextent {
95 u_int32_t startblock; /* first block allocated */
96 u_int32_t blockcount; /* number of blocks allocated */
97 };
98
99 typedef struct diskextent extentrecord[8];
100
101 typedef u_int32_t vol_capabilities_set_t[4];
102
103 #define VOL_CAPABILITIES_FORMAT 0
104 #define VOL_CAPABILITIES_INTERFACES 1
105 #define VOL_CAPABILITIES_RESERVED1 2
106 #define VOL_CAPABILITIES_RESERVED2 3
107
108 typedef struct vol_capabilities_attr {
109 vol_capabilities_set_t capabilities;
110 vol_capabilities_set_t valid;
111 } vol_capabilities_attr_t;
112
113 #define VOL_CAP_FMT_PERSISTENTOBJECTIDS 0x00000001
114 #define VOL_CAP_FMT_SYMBOLICLINKS 0x00000002
115 #define VOL_CAP_FMT_HARDLINKS 0x00000004
116
117 #define VOL_CAP_INT_SEARCHFS 0x00000001
118 #define VOL_CAP_INT_ATTRLIST 0x00000002
119 #define VOL_CAP_INT_NFSEXPORT 0x00000004
120 #define VOL_CAP_INT_READDIRATTR 0x00000008
121
122 typedef struct vol_attributes_attr {
123 attribute_set_t validattr;
124 attribute_set_t nativeattr;
125 } vol_attributes_attr_t;
126
127 #define DIR_MNTSTATUS_MNTPOINT 0x00000001
128
129 #define ATTR_CMN_NAME 0x00000001
130 #define ATTR_CMN_DEVID 0x00000002
131 #define ATTR_CMN_FSID 0x00000004
132 #define ATTR_CMN_OBJTYPE 0x00000008
133 #define ATTR_CMN_OBJTAG 0x00000010
134 #define ATTR_CMN_OBJID 0x00000020
135 #define ATTR_CMN_OBJPERMANENTID 0x00000040
136 #define ATTR_CMN_PAROBJID 0x00000080
137 #define ATTR_CMN_SCRIPT 0x00000100
138 #define ATTR_CMN_CRTIME 0x00000200
139 #define ATTR_CMN_MODTIME 0x00000400
140 #define ATTR_CMN_CHGTIME 0x00000800
141 #define ATTR_CMN_ACCTIME 0x00001000
142 #define ATTR_CMN_BKUPTIME 0x00002000
143 #define ATTR_CMN_FNDRINFO 0x00004000
144 #define ATTR_CMN_OWNERID 0x00008000
145 #define ATTR_CMN_GRPID 0x00010000
146 #define ATTR_CMN_ACCESSMASK 0x00020000
147 #define ATTR_CMN_FLAGS 0x00040000
148 #define ATTR_CMN_NAMEDATTRCOUNT 0x00080000
149 #define ATTR_CMN_NAMEDATTRLIST 0x00100000
150 #define ATTR_CMN_USERACCESS 0x00200000
151
152 #define ATTR_CMN_VALIDMASK 0x003FFFFF
153 #define ATTR_CMN_SETMASK 0x0007FF00
154 #define ATTR_CMN_VOLSETMASK 0x00006700
155
156 #define ATTR_VOL_FSTYPE 0x00000001
157 #define ATTR_VOL_SIGNATURE 0x00000002
158 #define ATTR_VOL_SIZE 0x00000004
159 #define ATTR_VOL_SPACEFREE 0x00000008
160 #define ATTR_VOL_SPACEAVAIL 0x00000010
161 #define ATTR_VOL_MINALLOCATION 0x00000020
162 #define ATTR_VOL_ALLOCATIONCLUMP 0x00000040
163 #define ATTR_VOL_IOBLOCKSIZE 0x00000080
164 #define ATTR_VOL_OBJCOUNT 0x00000100
165 #define ATTR_VOL_FILECOUNT 0x00000200
166 #define ATTR_VOL_DIRCOUNT 0x00000400
167 #define ATTR_VOL_MAXOBJCOUNT 0x00000800
168 #define ATTR_VOL_MOUNTPOINT 0x00001000
169 #define ATTR_VOL_NAME 0x00002000
170 #define ATTR_VOL_MOUNTFLAGS 0x00004000
171 #define ATTR_VOL_MOUNTEDDEVICE 0x00008000
172 #define ATTR_VOL_ENCODINGSUSED 0x00010000
173 #define ATTR_VOL_CAPABILITIES 0x00020000
174 #define ATTR_VOL_ATTRIBUTES 0x40000000
175 #define ATTR_VOL_INFO 0x80000000
176
177 #define ATTR_VOL_VALIDMASK 0xC003FFFF
178 #define ATTR_VOL_SETMASK 0x80002000
179
180
181 /* File/directory attributes: */
182 #define ATTR_DIR_LINKCOUNT 0x00000001
183 #define ATTR_DIR_ENTRYCOUNT 0x00000002
184 #define ATTR_DIR_MOUNTSTATUS 0x00000004
185
186 #define ATTR_DIR_VALIDMASK 0x00000007
187 #define ATTR_DIR_SETMASK 0x00000000
188
189 #define ATTR_FILE_LINKCOUNT 0x00000001
190 #define ATTR_FILE_TOTALSIZE 0x00000002
191 #define ATTR_FILE_ALLOCSIZE 0x00000004
192 #define ATTR_FILE_IOBLOCKSIZE 0x00000008
193 #define ATTR_FILE_CLUMPSIZE 0x00000010
194 #define ATTR_FILE_DEVTYPE 0x00000020
195 #define ATTR_FILE_FILETYPE 0x00000040
196 #define ATTR_FILE_FORKCOUNT 0x00000080
197 #define ATTR_FILE_FORKLIST 0x00000100
198 #define ATTR_FILE_DATALENGTH 0x00000200
199 #define ATTR_FILE_DATAALLOCSIZE 0x00000400
200 #define ATTR_FILE_DATAEXTENTS 0x00000800
201 #define ATTR_FILE_RSRCLENGTH 0x00001000
202 #define ATTR_FILE_RSRCALLOCSIZE 0x00002000
203 #define ATTR_FILE_RSRCEXTENTS 0x00004000
204
205 #define ATTR_FILE_VALIDMASK 0x00007FFF
206 #define ATTR_FILE_SETMASK 0x00000020
207
208 #define ATTR_FORK_TOTALSIZE 0x00000001
209 #define ATTR_FORK_ALLOCSIZE 0x00000002
210
211 #define ATTR_FORK_VALIDMASK 0x00000003
212 #define ATTR_FORK_SETMASK 0x00000000
213
214 #define SRCHFS_START 0x00000001
215 #define SRCHFS_MATCHPARTIALNAMES 0x00000002
216 #define SRCHFS_MATCHDIRS 0x00000004
217 #define SRCHFS_MATCHFILES 0x00000008
218 #define SRCHFS_NEGATEPARAMS 0x80000000
219 #define SRCHFS_VALIDOPTIONSMASK 0x8000000F
220
221 struct fssearchblock {
222 struct attrlist *returnattrs;
223 void *returnbuffer;
224 size_t returnbuffersize;
225 u_long maxmatches;
226 struct timeval timelimit;
227 void *searchparams1;
228 size_t sizeofsearchparams1;
229 void *searchparams2;
230 size_t sizeofsearchparams2;
231 struct attrlist searchattrs;
232 };
233
234
235 struct searchstate {
236 u_char reserved[556]; // sizeof( SearchState )
237 };
238
239
240 #define FST_EOF (-1) /* end-of-file offset */
241
242 #endif /* __APPLE_API_UNSTABLE */
243 #endif /* !_SYS_ATTR_H_ */