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