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