]> git.saurik.com Git - apple/xnu.git/blob - bsd/sys/attr.h
xnu-6153.61.1.tar.gz
[apple/xnu.git] / bsd / sys / attr.h
1 /*
2 * Copyright (c) 2000-2018 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28
29 /*
30 * attr.h - attribute data structures and interfaces
31 *
32 * Copyright (c) 1998, Apple Computer, Inc. All Rights Reserved.
33 */
34
35 #ifndef _SYS_ATTR_H_
36 #define _SYS_ATTR_H_
37
38 #include <sys/appleapiopts.h>
39
40 #ifdef __APPLE_API_UNSTABLE
41 #include <sys/types.h>
42 #include <sys/ucred.h>
43 #include <sys/time.h>
44 #include <sys/cdefs.h>
45
46 #define FSOPT_NOFOLLOW 0x00000001
47 #define FSOPT_NOINMEMUPDATE 0x00000002
48 #define FSOPT_REPORT_FULLSIZE 0x00000004
49 /* The following option only valid when requesting ATTR_CMN_RETURNED_ATTRS */
50 #define FSOPT_PACK_INVAL_ATTRS 0x00000008
51
52 #ifdef PRIVATE
53 #define FSOPT_EXCHANGE_DATA_ONLY 0x0000010
54 #endif
55
56 #define FSOPT_ATTR_CMN_EXTENDED 0x00000020
57 #ifdef PRIVATE
58 #define FSOPT_LIST_SNAPSHOT 0x00000040
59 #ifndef FSOPT_NOFIRMLINKPATH /*a copy is in fsgetpath.h */
60 #define FSOPT_NOFIRMLINKPATH 0x00000080
61 #endif /* FSOPT_NOFIRMLINKPATH */
62 #define FSOPT_FOLLOW_FIRMLINK 0x00000100
63 #define FSOPT_RETURN_REALDEV 0x00000200
64 #ifndef FSOPT_ISREALFSID /*a copy is in fsgetpath.h */
65 #define FSOPT_ISREALFSID FSOPT_RETURN_REALDEV
66 #endif
67 #endif /* PRIVATE */
68
69 /* we currently aren't anywhere near this amount for a valid
70 * fssearchblock.sizeofsearchparams1 or fssearchblock.sizeofsearchparams2
71 * but we put a sanity check in to avoid abuse of the value passed in from
72 * user land.
73 */
74 #define SEARCHFS_MAX_SEARCHPARMS 4096
75
76 typedef u_int32_t text_encoding_t;
77
78 typedef u_int32_t fsobj_type_t;
79
80 typedef u_int32_t fsobj_tag_t;
81
82 typedef u_int32_t fsfile_type_t;
83
84 typedef u_int32_t fsvolid_t;
85
86 #include <sys/_types/_fsobj_id_t.h> /* file object id type */
87
88 typedef u_int32_t attrgroup_t;
89
90 struct attrlist {
91 u_short bitmapcount; /* number of attr. bit sets in list (should be 5) */
92 u_int16_t reserved; /* (to maintain 4-byte alignment) */
93 attrgroup_t commonattr; /* common attribute group */
94 attrgroup_t volattr; /* Volume attribute group */
95 attrgroup_t dirattr; /* directory attribute group */
96 attrgroup_t fileattr; /* file attribute group */
97 attrgroup_t forkattr; /* fork attribute group */
98 };
99 #define ATTR_BIT_MAP_COUNT 5
100
101 typedef struct attribute_set {
102 attrgroup_t commonattr; /* common attribute group */
103 attrgroup_t volattr; /* Volume attribute group */
104 attrgroup_t dirattr; /* directory attribute group */
105 attrgroup_t fileattr; /* file attribute group */
106 attrgroup_t forkattr; /* fork attribute group */
107 } attribute_set_t;
108
109 typedef struct attrreference {
110 int32_t attr_dataoffset;
111 u_int32_t attr_length;
112 } attrreference_t;
113
114 /* XXX PPD This is derived from HFSVolumePriv.h and should perhaps be referenced from there? */
115
116 struct diskextent {
117 u_int32_t startblock; /* first block allocated */
118 u_int32_t blockcount; /* number of blocks allocated */
119 };
120
121 typedef struct diskextent extentrecord[8];
122
123 typedef u_int32_t vol_capabilities_set_t[4];
124
125 #define VOL_CAPABILITIES_FORMAT 0
126 #define VOL_CAPABILITIES_INTERFACES 1
127 #define VOL_CAPABILITIES_RESERVED1 2
128 #define VOL_CAPABILITIES_RESERVED2 3
129
130 typedef struct vol_capabilities_attr {
131 vol_capabilities_set_t capabilities;
132 vol_capabilities_set_t valid;
133 } vol_capabilities_attr_t;
134
135 /*
136 * XXX this value needs to be raised - 3893388
137 */
138 #define ATTR_MAX_BUFFER 8192
139
140 /*
141 * VOL_CAP_FMT_PERSISTENTOBJECTIDS: When set, the volume has object IDs
142 * that are persistent (retain their values even when the volume is
143 * unmounted and remounted), and a file or directory can be looked up
144 * by ID. Volumes that support VolFS and can support Carbon File ID
145 * references should set this bit.
146 *
147 * VOL_CAP_FMT_SYMBOLICLINKS: When set, the volume supports symbolic
148 * links. The symlink(), readlink(), and lstat() calls all use this
149 * symbolic link.
150 *
151 * VOL_CAP_FMT_HARDLINKS: When set, the volume supports hard links.
152 * The link() call creates hard links.
153 *
154 * VOL_CAP_FMT_JOURNAL: When set, the volume is capable of supporting
155 * a journal used to speed recovery in case of unplanned shutdown
156 * (such as a power outage or crash). This bit does not necessarily
157 * mean the volume is actively using a journal for recovery.
158 *
159 * VOL_CAP_FMT_JOURNAL_ACTIVE: When set, the volume is currently using
160 * a journal for use in speeding recovery after an unplanned shutdown.
161 * This bit can be set only if VOL_CAP_FMT_JOURNAL is also set.
162 *
163 * VOL_CAP_FMT_NO_ROOT_TIMES: When set, the volume format does not
164 * store reliable times for the root directory, so you should not
165 * depend on them to detect changes, etc.
166 *
167 * VOL_CAP_FMT_SPARSE_FILES: When set, the volume supports sparse files.
168 * That is, files which can have "holes" that have never been written
169 * to, and are not allocated on disk. Sparse files may have an
170 * allocated size that is less than the file's logical length.
171 *
172 * VOL_CAP_FMT_ZERO_RUNS: For security reasons, parts of a file (runs)
173 * that have never been written to must appear to contain zeroes. When
174 * this bit is set, the volume keeps track of allocated but unwritten
175 * runs of a file so that it can substitute zeroes without actually
176 * writing zeroes to the media. This provides performance similar to
177 * sparse files, but not the space savings.
178 *
179 * VOL_CAP_FMT_CASE_SENSITIVE: When set, file and directory names are
180 * case sensitive (upper and lower case are different). When clear,
181 * an upper case character is equivalent to a lower case character,
182 * and you can't have two names that differ solely in the case of
183 * the characters.
184 *
185 * VOL_CAP_FMT_CASE_PRESERVING: When set, file and directory names
186 * preserve the difference between upper and lower case. If clear,
187 * the volume may change the case of some characters (typically
188 * making them all upper or all lower case). A volume that sets
189 * VOL_CAP_FMT_CASE_SENSITIVE should also set VOL_CAP_FMT_CASE_PRESERVING.
190 *
191 * VOL_CAP_FMT_FAST_STATFS: This bit is used as a hint to upper layers
192 * (especially Carbon) that statfs() is fast enough that its results
193 * need not be cached by those upper layers. A volume that caches
194 * the statfs information in its in-memory structures should set this bit.
195 * A volume that must always read from disk or always perform a network
196 * transaction should not set this bit.
197 *
198 * VOL_CAP_FMT_2TB_FILESIZE: If this bit is set the volume format supports
199 * file sizes larger than 4GB, and potentially up to 2TB; it does not
200 * indicate whether the filesystem supports files larger than that.
201 *
202 * VOL_CAP_FMT_OPENDENYMODES: When set, the volume supports open deny
203 * modes (e.g. "open for read write, deny write"; effectively, mandatory
204 * file locking based on open modes).
205 *
206 * VOL_CAP_FMT_HIDDEN_FILES: When set, the volume supports the UF_HIDDEN
207 * file flag, and the UF_HIDDEN flag is mapped to that volume's native
208 * "hidden" or "invisible" bit (which may be the invisible bit from the
209 * Finder Info extended attribute).
210 *
211 * VOL_CAP_FMT_PATH_FROM_ID: When set, the volume supports the ability
212 * to derive a pathname to the root of the file system given only the
213 * id of an object. This also implies that object ids on this file
214 * system are persistent and not recycled. This is a very specialized
215 * capability and it is assumed that most file systems will not support
216 * it. Its use is for legacy non-posix APIs like ResolveFileIDRef.
217 *
218 * VOL_CAP_FMT_NO_VOLUME_SIZES: When set, the volume does not support
219 * returning values for total data blocks, available blocks, or free blocks
220 * (as in f_blocks, f_bavail, or f_bfree in "struct statfs"). Historically,
221 * those values were set to 0xFFFFFFFF for volumes that did not support them.
222 *
223 * VOL_CAP_FMT_DECMPFS_COMPRESSION: When set, the volume supports transparent
224 * decompression of compressed files using decmpfs.
225 *
226 * VOL_CAP_FMT_64BIT_OBJECT_IDS: When set, the volume uses object IDs that
227 * are 64-bit. This means that ATTR_CMN_FILEID and ATTR_CMN_PARENTID are the
228 * only legitimate attributes for obtaining object IDs from this volume and the
229 * 32-bit fid_objno fields of the fsobj_id_t returned by ATTR_CMN_OBJID,
230 * ATTR_CMN_OBJPERMID, and ATTR_CMN_PAROBJID are undefined.
231 *
232 * VOL_CAP_FMT_DIR_HARDLINKS: When set, the volume supports directory
233 * hard links.
234 *
235 * VOL_CAP_FMT_DOCUMENT_ID: When set, the volume supports document IDs
236 * (an ID which persists across object ID changes) for document revisions.
237 *
238 * VOL_CAP_FMT_WRITE_GENERATION_COUNT: When set, the volume supports write
239 * generation counts (a count of how many times an object has been modified)
240 *
241 * VOL_CAP_FMT_NO_IMMUTABLE_FILES: When set, the volume does not support
242 * setting the UF_IMMUTABLE flag.
243 *
244 * VOL_CAP_FMT_NO_PERMISSIONS: When set, the volume does not support setting
245 * permissions.
246 *
247 * VOL_CAP_FMT_SHARED_SPACE: When set, the volume supports sharing space with
248 * other filesystems i.e. multiple logical filesystems can exist in the same
249 * "partition". An implication of this is that the filesystem which sets
250 * this capability treats waitfor arguments to VFS_SYNC as bit flags.
251 *
252 * VOL_CAP_FMT_VOL_GROUPS: When set, this volume is part of a volume-group
253 * that implies multiple volumes must be mounted in order to boot and root the
254 * operating system. Typically, this means a read-only system volume and a
255 * writable data volume.
256 */
257 #define VOL_CAP_FMT_PERSISTENTOBJECTIDS 0x00000001
258 #define VOL_CAP_FMT_SYMBOLICLINKS 0x00000002
259 #define VOL_CAP_FMT_HARDLINKS 0x00000004
260 #define VOL_CAP_FMT_JOURNAL 0x00000008
261 #define VOL_CAP_FMT_JOURNAL_ACTIVE 0x00000010
262 #define VOL_CAP_FMT_NO_ROOT_TIMES 0x00000020
263 #define VOL_CAP_FMT_SPARSE_FILES 0x00000040
264 #define VOL_CAP_FMT_ZERO_RUNS 0x00000080
265 #define VOL_CAP_FMT_CASE_SENSITIVE 0x00000100
266 #define VOL_CAP_FMT_CASE_PRESERVING 0x00000200
267 #define VOL_CAP_FMT_FAST_STATFS 0x00000400
268 #define VOL_CAP_FMT_2TB_FILESIZE 0x00000800
269 #define VOL_CAP_FMT_OPENDENYMODES 0x00001000
270 #define VOL_CAP_FMT_HIDDEN_FILES 0x00002000
271 #define VOL_CAP_FMT_PATH_FROM_ID 0x00004000
272 #define VOL_CAP_FMT_NO_VOLUME_SIZES 0x00008000
273 #define VOL_CAP_FMT_DECMPFS_COMPRESSION 0x00010000
274 #define VOL_CAP_FMT_64BIT_OBJECT_IDS 0x00020000
275 #define VOL_CAP_FMT_DIR_HARDLINKS 0x00040000
276 #define VOL_CAP_FMT_DOCUMENT_ID 0x00080000
277 #define VOL_CAP_FMT_WRITE_GENERATION_COUNT 0x00100000
278 #define VOL_CAP_FMT_NO_IMMUTABLE_FILES 0x00200000
279 #define VOL_CAP_FMT_NO_PERMISSIONS 0x00400000
280 #define VOL_CAP_FMT_SHARED_SPACE 0x00800000
281 #define VOL_CAP_FMT_VOL_GROUPS 0x01000000
282
283 /*
284 * VOL_CAP_INT_SEARCHFS: When set, the volume implements the
285 * searchfs() system call (the vnop_searchfs vnode operation).
286 *
287 * VOL_CAP_INT_ATTRLIST: When set, the volume implements the
288 * getattrlist() and setattrlist() system calls (vnop_getattrlist
289 * and vnop_setattrlist vnode operations) for the volume, files,
290 * and directories. The volume may or may not implement the
291 * readdirattr() system call. XXX Is there any minimum set
292 * of attributes that should be supported? To determine the
293 * set of supported attributes, get the ATTR_VOL_ATTRIBUTES
294 * attribute of the volume.
295 *
296 * VOL_CAP_INT_NFSEXPORT: When set, the volume implements exporting
297 * of NFS volumes.
298 *
299 * VOL_CAP_INT_READDIRATTR: When set, the volume implements the
300 * readdirattr() system call (vnop_readdirattr vnode operation).
301 *
302 * VOL_CAP_INT_EXCHANGEDATA: When set, the volume implements the
303 * exchangedata() system call (VNOP_EXCHANGE vnode operation).
304 *
305 * VOL_CAP_INT_COPYFILE: When set, the volume implements the
306 * VOP_COPYFILE vnode operation. (XXX There should be a copyfile()
307 * system call in <unistd.h>.)
308 *
309 * VOL_CAP_INT_ALLOCATE: When set, the volume implements the
310 * VNOP_ALLOCATE vnode operation, which means it implements the
311 * F_PREALLOCATE selector of fcntl(2).
312 *
313 * VOL_CAP_INT_VOL_RENAME: When set, the volume implements the
314 * ATTR_VOL_NAME attribute for both getattrlist() and setattrlist().
315 * The volume can be renamed by setting ATTR_VOL_NAME with setattrlist().
316 *
317 * VOL_CAP_INT_ADVLOCK: When set, the volume implements POSIX style
318 * byte range locks via vnop_advlock (accessible from fcntl(2)).
319 *
320 * VOL_CAP_INT_FLOCK: When set, the volume implements whole-file flock(2)
321 * style locks via vnop_advlock. This includes the O_EXLOCK and O_SHLOCK
322 * flags of the open(2) call.
323 *
324 * VOL_CAP_INT_EXTENDED_SECURITY: When set, the volume implements
325 * extended security (ACLs).
326 *
327 * VOL_CAP_INT_USERACCESS: When set, the volume supports the
328 * ATTR_CMN_USERACCESS attribute (used to get the user's access
329 * mode to the file).
330 *
331 * VOL_CAP_INT_MANLOCK: When set, the volume supports AFP-style
332 * mandatory byte range locks via an ioctl().
333 *
334 * VOL_CAP_INT_EXTENDED_ATTR: When set, the volume implements
335 * native extended attribues.
336 *
337 * VOL_CAP_INT_NAMEDSTREAMS: When set, the volume supports
338 * native named streams.
339 *
340 * VOL_CAP_INT_CLONE: When set, the volume supports clones.
341 *
342 * VOL_CAP_INT_SNAPSHOT: When set, the volume supports snapshots.
343 *
344 * VOL_CAP_INT_RENAME_SWAP: When set, the volume supports swapping
345 * file system objects.
346 *
347 * VOL_CAP_INT_RENAME_EXCL: When set, the volume supports an
348 * exclusive rename operation.
349 *
350 * VOL_CAP_INT_RENAME_OPENFAIL: When set, the volume may fail rename
351 * operations on files that are open.
352 */
353 #define VOL_CAP_INT_SEARCHFS 0x00000001
354 #define VOL_CAP_INT_ATTRLIST 0x00000002
355 #define VOL_CAP_INT_NFSEXPORT 0x00000004
356 #define VOL_CAP_INT_READDIRATTR 0x00000008
357 #define VOL_CAP_INT_EXCHANGEDATA 0x00000010
358 #define VOL_CAP_INT_COPYFILE 0x00000020
359 #define VOL_CAP_INT_ALLOCATE 0x00000040
360 #define VOL_CAP_INT_VOL_RENAME 0x00000080
361 #define VOL_CAP_INT_ADVLOCK 0x00000100
362 #define VOL_CAP_INT_FLOCK 0x00000200
363 #define VOL_CAP_INT_EXTENDED_SECURITY 0x00000400
364 #define VOL_CAP_INT_USERACCESS 0x00000800
365 #define VOL_CAP_INT_MANLOCK 0x00001000
366 #define VOL_CAP_INT_NAMEDSTREAMS 0x00002000
367 #define VOL_CAP_INT_EXTENDED_ATTR 0x00004000
368 #ifdef PRIVATE
369 /* Volume supports kqueue notifications for remote events */
370 #define VOL_CAP_INT_REMOTE_EVENT 0x00008000
371 #endif /* PRIVATE */
372 #define VOL_CAP_INT_CLONE 0x00010000
373 #define VOL_CAP_INT_SNAPSHOT 0x00020000
374 #define VOL_CAP_INT_RENAME_SWAP 0x00040000
375 #define VOL_CAP_INT_RENAME_EXCL 0x00080000
376 #define VOL_CAP_INT_RENAME_OPENFAIL 0x00100000
377
378 typedef struct vol_attributes_attr {
379 attribute_set_t validattr;
380 attribute_set_t nativeattr;
381 } vol_attributes_attr_t;
382
383 #define ATTR_CMN_NAME 0x00000001
384 #define ATTR_CMN_DEVID 0x00000002
385 #define ATTR_CMN_FSID 0x00000004
386 #define ATTR_CMN_OBJTYPE 0x00000008
387 #define ATTR_CMN_OBJTAG 0x00000010
388 #define ATTR_CMN_OBJID 0x00000020
389 #define ATTR_CMN_OBJPERMANENTID 0x00000040
390 #define ATTR_CMN_PAROBJID 0x00000080
391 #define ATTR_CMN_SCRIPT 0x00000100
392 #define ATTR_CMN_CRTIME 0x00000200
393 #define ATTR_CMN_MODTIME 0x00000400
394 #define ATTR_CMN_CHGTIME 0x00000800
395 #define ATTR_CMN_ACCTIME 0x00001000
396 #define ATTR_CMN_BKUPTIME 0x00002000
397 #define ATTR_CMN_FNDRINFO 0x00004000
398 #define ATTR_CMN_OWNERID 0x00008000
399 #define ATTR_CMN_GRPID 0x00010000
400 #define ATTR_CMN_ACCESSMASK 0x00020000
401 #define ATTR_CMN_FLAGS 0x00040000
402
403 /* The following were defined as: */
404 /* #define ATTR_CMN_NAMEDATTRCOUNT 0x00080000 */
405 /* #define ATTR_CMN_NAMEDATTRLIST 0x00100000 */
406 /* These bits have been salvaged for use as: */
407 /* #define ATTR_CMN_GEN_COUNT 0x00080000 */
408 /* #define ATTR_CMN_DOCUMENT_ID 0x00100000 */
409 /* They can only be used with the FSOPT_ATTR_CMN_EXTENDED */
410 /* option flag. */
411
412 #define ATTR_CMN_GEN_COUNT 0x00080000
413 #define ATTR_CMN_DOCUMENT_ID 0x00100000
414
415 #define ATTR_CMN_USERACCESS 0x00200000
416 #define ATTR_CMN_EXTENDED_SECURITY 0x00400000
417 #define ATTR_CMN_UUID 0x00800000
418 #define ATTR_CMN_GRPUUID 0x01000000
419 #define ATTR_CMN_FILEID 0x02000000
420 #define ATTR_CMN_PARENTID 0x04000000
421 #define ATTR_CMN_FULLPATH 0x08000000
422 #define ATTR_CMN_ADDEDTIME 0x10000000
423 #define ATTR_CMN_ERROR 0x20000000
424 #define ATTR_CMN_DATA_PROTECT_FLAGS 0x40000000
425
426 /*
427 * ATTR_CMN_RETURNED_ATTRS is only valid with getattrlist(2) and
428 * getattrlistbulk(2). It is always the first attribute in the return buffer.
429 */
430 #define ATTR_CMN_RETURNED_ATTRS 0x80000000
431
432 #define ATTR_CMN_VALIDMASK 0xFFFFFFFF
433 /*
434 * The settable ATTR_CMN_* attributes include the following:
435 * ATTR_CMN_SCRIPT
436 * ATTR_CMN_CRTIME
437 * ATTR_CMN_MODTIME
438 * ATTR_CMN_CHGTIME
439 *
440 * ATTR_CMN_ACCTIME
441 * ATTR_CMN_BKUPTIME
442 * ATTR_CMN_FNDRINFO
443 * ATTR_CMN_OWNERID
444 *
445 * ATTR_CMN_GRPID
446 * ATTR_CMN_ACCESSMASK
447 * ATTR_CMN_FLAGS
448 *
449 * ATTR_CMN_EXTENDED_SECURITY
450 * ATTR_CMN_UUID
451 *
452 * ATTR_CMN_GRPUUID
453 *
454 * ATTR_CMN_DATA_PROTECT_FLAGS
455 */
456 #define ATTR_CMN_SETMASK 0x51C7FF00
457 #define ATTR_CMN_VOLSETMASK 0x00006700
458
459 #define ATTR_VOL_FSTYPE 0x00000001
460 #define ATTR_VOL_SIGNATURE 0x00000002
461 #define ATTR_VOL_SIZE 0x00000004
462 #define ATTR_VOL_SPACEFREE 0x00000008
463 #define ATTR_VOL_SPACEAVAIL 0x00000010
464 #define ATTR_VOL_MINALLOCATION 0x00000020
465 #define ATTR_VOL_ALLOCATIONCLUMP 0x00000040
466 #define ATTR_VOL_IOBLOCKSIZE 0x00000080
467 #define ATTR_VOL_OBJCOUNT 0x00000100
468 #define ATTR_VOL_FILECOUNT 0x00000200
469 #define ATTR_VOL_DIRCOUNT 0x00000400
470 #define ATTR_VOL_MAXOBJCOUNT 0x00000800
471 #define ATTR_VOL_MOUNTPOINT 0x00001000
472 #define ATTR_VOL_NAME 0x00002000
473 #define ATTR_VOL_MOUNTFLAGS 0x00004000
474 #define ATTR_VOL_MOUNTEDDEVICE 0x00008000
475 #define ATTR_VOL_ENCODINGSUSED 0x00010000
476 #define ATTR_VOL_CAPABILITIES 0x00020000
477 #define ATTR_VOL_UUID 0x00040000
478 #define ATTR_VOL_QUOTA_SIZE 0x10000000
479 #define ATTR_VOL_RESERVED_SIZE 0x20000000
480 #define ATTR_VOL_ATTRIBUTES 0x40000000
481 #define ATTR_VOL_INFO 0x80000000
482
483 #define ATTR_VOL_VALIDMASK 0xF007FFFF
484
485 /*
486 * The list of settable ATTR_VOL_* attributes include the following:
487 * ATTR_VOL_NAME
488 * ATTR_VOL_INFO
489 */
490 #define ATTR_VOL_SETMASK 0x80002000
491
492
493 /* File/directory attributes: */
494 #define ATTR_DIR_LINKCOUNT 0x00000001
495 #define ATTR_DIR_ENTRYCOUNT 0x00000002
496 #define ATTR_DIR_MOUNTSTATUS 0x00000004
497 #define ATTR_DIR_ALLOCSIZE 0x00000008
498 #define ATTR_DIR_IOBLOCKSIZE 0x00000010
499 #define ATTR_DIR_DATALENGTH 0x00000020
500
501 /* ATTR_DIR_MOUNTSTATUS Flags: */
502 #define DIR_MNTSTATUS_MNTPOINT 0x00000001
503 #define DIR_MNTSTATUS_TRIGGER 0x00000002
504
505 #define ATTR_DIR_VALIDMASK 0x0000003f
506 #define ATTR_DIR_SETMASK 0x00000000
507
508 #define ATTR_FILE_LINKCOUNT 0x00000001
509 #define ATTR_FILE_TOTALSIZE 0x00000002
510 #define ATTR_FILE_ALLOCSIZE 0x00000004
511 #define ATTR_FILE_IOBLOCKSIZE 0x00000008
512 #define ATTR_FILE_DEVTYPE 0x00000020
513 #define ATTR_FILE_FORKCOUNT 0x00000080
514 #define ATTR_FILE_FORKLIST 0x00000100
515 #define ATTR_FILE_DATALENGTH 0x00000200
516 #define ATTR_FILE_DATAALLOCSIZE 0x00000400
517 #define ATTR_FILE_RSRCLENGTH 0x00001000
518 #define ATTR_FILE_RSRCALLOCSIZE 0x00002000
519
520 #define ATTR_FILE_VALIDMASK 0x000037FF
521 /*
522 * Settable ATTR_FILE_* attributes include:
523 * ATTR_FILE_DEVTYPE
524 */
525 #define ATTR_FILE_SETMASK 0x00000020
526
527 /* CMNEXT attributes extend the common attributes, but in the forkattr field */
528 #define ATTR_CMNEXT_RELPATH 0x00000004
529 #define ATTR_CMNEXT_PRIVATESIZE 0x00000008
530 #define ATTR_CMNEXT_LINKID 0x00000010
531 #define ATTR_CMNEXT_NOFIRMLINKPATH 0x00000020
532 #define ATTR_CMNEXT_REALDEVID 0x00000040
533 #define ATTR_CMNEXT_REALFSID 0x00000080
534
535 #define ATTR_CMNEXT_VALIDMASK 0x000000fc
536 #define ATTR_CMNEXT_SETMASK 0x00000000
537
538 /* Deprecated fork attributes */
539 #define ATTR_FORK_TOTALSIZE 0x00000001
540 #define ATTR_FORK_ALLOCSIZE 0x00000002
541 #define ATTR_FORK_RESERVED 0xffffffff
542
543 #define ATTR_FORK_VALIDMASK 0x00000003
544 #define ATTR_FORK_SETMASK 0x00000000
545
546 /* Obsolete, implemented, not supported */
547 #define ATTR_CMN_NAMEDATTRCOUNT 0x00080000
548 #define ATTR_CMN_NAMEDATTRLIST 0x00100000
549 #define ATTR_FILE_CLUMPSIZE 0x00000010 /* obsolete */
550 #define ATTR_FILE_FILETYPE 0x00000040 /* always zero */
551 #define ATTR_FILE_DATAEXTENTS 0x00000800 /* obsolete, HFS-specific */
552 #define ATTR_FILE_RSRCEXTENTS 0x00004000 /* obsolete, HFS-specific */
553
554 /* Required attributes for getattrlistbulk(2) */
555 #define ATTR_BULK_REQUIRED (ATTR_CMN_NAME | ATTR_CMN_RETURNED_ATTRS)
556
557 /*
558 * Searchfs
559 */
560 #define SRCHFS_START 0x00000001
561 #define SRCHFS_MATCHPARTIALNAMES 0x00000002
562 #define SRCHFS_MATCHDIRS 0x00000004
563 #define SRCHFS_MATCHFILES 0x00000008
564 #define SRCHFS_SKIPLINKS 0x00000010
565 #define SRCHFS_SKIPINVISIBLE 0x00000020
566 #define SRCHFS_SKIPPACKAGES 0x00000040
567 #define SRCHFS_SKIPINAPPROPRIATE 0x00000080
568
569 #define SRCHFS_NEGATEPARAMS 0x80000000
570 #define SRCHFS_VALIDOPTIONSMASK 0x800000FF
571
572 struct fssearchblock {
573 struct attrlist *returnattrs;
574 void *returnbuffer;
575 size_t returnbuffersize;
576 u_long maxmatches;
577 struct timeval timelimit;
578 void *searchparams1;
579 size_t sizeofsearchparams1;
580 void *searchparams2;
581 size_t sizeofsearchparams2;
582 struct attrlist searchattrs;
583 };
584
585 #ifdef KERNEL
586 /* LP64 version of fssearchblock. all pointers and longs
587 * grow when we're dealing with a 64-bit process.
588 * WARNING - keep in sync with fssearchblock
589 */
590
591 struct user64_fssearchblock {
592 user64_addr_t returnattrs;
593 user64_addr_t returnbuffer;
594 user64_size_t returnbuffersize;
595 user64_ulong_t maxmatches;
596 struct user64_timeval timelimit;
597 user64_addr_t searchparams1;
598 user64_size_t sizeofsearchparams1;
599 user64_addr_t searchparams2;
600 user64_size_t sizeofsearchparams2;
601 struct attrlist searchattrs;
602 };
603
604 struct user32_fssearchblock {
605 user32_addr_t returnattrs;
606 user32_addr_t returnbuffer;
607 user32_size_t returnbuffersize;
608 user32_ulong_t maxmatches;
609 struct user32_timeval timelimit;
610 user32_addr_t searchparams1;
611 user32_size_t sizeofsearchparams1;
612 user32_addr_t searchparams2;
613 user32_size_t sizeofsearchparams2;
614 struct attrlist searchattrs;
615 };
616
617 #endif /* KERNEL */
618
619 struct searchstate {
620 uint32_t ss_union_flags; // for SRCHFS_START
621 uint32_t ss_union_layer; // 0 = top
622 u_char ss_fsstate[548]; // fs private
623 } __attribute__((packed));
624
625 #define FST_EOF (-1) /* end-of-file offset */
626
627 #endif /* __APPLE_API_UNSTABLE */
628 #endif /* !_SYS_ATTR_H_ */