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