1.\" Copyright (c) 2003 Apple Computer, Inc. All rights reserved. 2.\" 3.\" The contents of this file constitute Original Code as defined in and 4.\" are subject to the Apple Public Source License Version 1.1 (the 5.\" "License"). You may not use this file except in compliance with the 6.\" License. Please obtain a copy of the License at 7.\" http://www.apple.com/publicsource and read it before using this file. 8.\" 9.\" This Original Code and all software distributed under the License are 10.\" distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER 11.\" EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 12.\" INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 13.\" FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the 14.\" License for the specific language governing rights and limitations 15.\" under the License. 16.\" 17.\" @(#)getattrlist.2 18. 19.Dd July 28, 2022 20.Dt GETATTRLIST 2 21.Os Darwin 22.Sh NAME 23.Nm getattrlist , 24.Nm fgetattrlist , 25.Nm getattrlistat 26.Nd get file system attributes 27.Sh SYNOPSIS 28.Fd #include <sys/attr.h> 29.Fd #include <unistd.h> 30.Ft int 31.Fn getattrlist "const char* path" "struct attrlist * attrList" "void * attrBuf" "size_t attrBufSize" "unsigned long options" 32. 33.Ft int 34.Fn fgetattrlist "int fd" "struct attrlist * attrList" "void * attrBuf" "size_t attrBufSize" "unsigned long options" 35.Ft int 36.Fo getattrlistat 37.Fa "int fd" "const char *path" "struct attrlist * attrList" "void * attrBuf" 38.Fa "size_t attrBufSize" "unsigned long options" 39.Fc 40.Sh DESCRIPTION 41The 42.Fn getattrlist 43function returns attributes (that is, metadata) of file system objects. 44.Fn getattrlist 45works on the file system object named by 46.Fa path , 47while 48.Fn fgetattrlist 49works on the provided file descriptor 50.Fa fd . 51.Pp 52The 53.Fn getattrlistat 54system call is equivalent to 55.Fn getattrlist 56except in the case where 57.Fa path 58specifies a relative path. 59In this case the attributes are returned for the file system object named by 60path relative to the directory associated with the file descriptor 61.Fa fd 62instead of the current working directory. 63If 64.Fn getattrlistat 65is passed the special value 66.Dv AT_FDCWD 67in the 68.Fa fd 69parameter, the current working directory is used and the behavior is 70identical to a call to 71.Fn getattrlist . 72.Pp 73You can think of 74.Fn getattrlist 75as a seriously enhanced version of 76.Xr stat 2 . 77The functions return attributes about the specified file system object 78into the buffer specified by 79.Fa attrBuf 80and 81.Fa attrBufSize . 82The 83.Fa attrList 84parameter determines what attributes are returned. 85The 86.Fa options 87parameter lets you control specific aspects of the function's behavior. 88.Pp 89. 90Not all volumes support all attributes. 91See the discussion of 92.Dv ATTR_VOL_ATTRIBUTES 93for a discussion of how to determine whether a particular volume supports a 94particular attribute. 95.Pp 96Furthermore, you should only request the attributes that you need. 97Some attributes are expensive to calculate on some volume formats. 98For example, 99.Dv ATTR_DIR_ENTRYCOUNT 100is usually expensive to calculate on non-HFS [Plus] volumes. 101If you don't need a particular attribute, you should not ask for it. 102.Pp 103. 104.\" path parameter 105. 106The 107.Fa path 108parameter must reference a valid file system object. 109Read, write or execute permission of the object itself is not required, but 110all directories listed in the path name leading to the object must be 111searchable. 112.Pp 113. 114.\" attrList parameter 115. 116The 117.Fa attrList 118parameter is a pointer to an 119.Vt attrlist 120structure, as defined by 121.Aq Pa sys/attr.h 122(shown below). 123It determines what attributes are returned by the function. 124You are responsible for filling out all fields of this structure before calling the function. 125.Bd -literal 126typedef u_int32_t attrgroup_t; 127.Pp 128struct attrlist { 129 u_short bitmapcount; /* number of attr. bit sets in list */ 130 u_int16_t reserved; /* (to maintain 4-byte alignment) */ 131 attrgroup_t commonattr; /* common attribute group */ 132 attrgroup_t volattr; /* volume attribute group */ 133 attrgroup_t dirattr; /* directory attribute group */ 134 attrgroup_t fileattr; /* file attribute group */ 135 attrgroup_t forkattr; /* fork attribute group */ 136}; 137#define ATTR_BIT_MAP_COUNT 5 138.Ed 139.Pp 140. 141.\" attrlist elements 142. 143The fields of the 144.Vt attrlist 145structure are defined as follows. 146.Bl -tag -width XXXbitmapcount 147. 148.It bitmapcount 149Number of attribute bit sets in the structure. 150In current systems you must set this to 151.Dv ATTR_BIT_MAP_COUNT . 152. 153.It reserved 154Reserved. 155You must set this to 0. 156. 157.It commonattr 158A bit set that specifies the common attributes that you require. 159Common attributes relate to all types of file system objects. 160See below for a description of these attributes. 161. 162.It volattr 163A bit set that specifies the volume attributes that you require. 164Volume attributes relate to volumes (that is, mounted file systems). 165See below for a description of these attributes. 166You must set ATTR_VOL_INFO in the volattr field if you request any 167other volume attributes. 168In addition, you can't request volume attributes if you also request 169file, directory, fork or extended common attributes. 170In addition, you can't request volume attributes if you also request the common 171attributes ATTR_CMN_EXTENDED_SECURITY, ATTR_CMN_UUID, ATTR_CMN_GRPUUID, 172ATTR_CMN_FILEID, or ATTR_CMN_PARENTID. 173. 174.It dirattr 175A bit set that specifies the directory attributes that you require. 176See below for a description of these attributes. 177. 178.It fileattr 179A bit set that specifies the file attributes that you require. 180See below for a description of these attributes. 181. 182.It forkattr 183A bit set that specifies the fork attributes that you require. 184Fork attributes relate to the actual data in the file, 185which can be held in multiple named contiguous ranges, or forks. 186See below for a description of these attributes. 187If the FSOPT_ATTR_CMN_EXTENDED option is given, this bit set is reinterpreted 188as extended common attributes attributes, also described below. 189. 190.El 191.Pp 192. 193Unless otherwise noted in the lists below, attributes are read-only. 194Attributes labelled as read/write can be set using 195.Xr setattrlist 2 . 196.Pp 197. 198.\" attrBuf and attrBufSize parameters 199. 200The 201.Fa attrBuf 202and 203.Fa attrBufSize 204parameters specify a buffer into which the function places attribute values. 205The format of this buffer is sufficiently complex that its description 206requires a separate section (see below). 207The initial contents of this buffer are ignored. 208.Pp 209. 210.\" option parameter 211. 212The 213.Fa options 214parameter is a bit set that controls the behaviour of 215the functions. 216The following option bits are defined. 217. 218.Bl -tag -width FSOPT_PACK_INVAL_ATTRS 219. 220.It FSOPT_NOFOLLOW 221If this bit is set, 222.Fn getattrlist 223will not follow a symlink if it occurs as 224the last component of 225.Fa path . 226. 227.It FSOPT_NOFOLLOW_ANY 228If this bit is set, 229.Fn getattrlist 230will not follow a symlink if it occurs as 231the last component of 232.Fa path . 233In addition an error is returned if a symlink 234is encountered before the last component of 235.Fa path . 236. 237.It FSOPT_REPORT_FULLSIZE 238The size of the attributes reported (in the first 239.Vt u_int32_t 240field in the attribute buffer) will be the size needed to hold all the 241requested attributes; if not set, only the attributes actually returned 242will be reported. This allows the caller to determine if any truncation 243occurred. 244. 245.It FSOPT_PACK_INVAL_ATTRS 246If this is bit is set, then all requested attributes, even ones that are 247not supported by the object or file system, will be returned. Default values 248will be used for the invalid ones. Requires that 249.Dv ATTR_CMN_RETURNED_ATTRS 250be requested. 251. 252.It FSOPT_ATTR_CMN_EXTENDED 253If this is bit is set, then 254.Dv ATTR_CMN_GEN_COUNT 255and 256.Dv ATTR_CMN_DOCUMENT_ID 257can be requested. When this option is used, forkattrs are reinterpreted as a 258set of extended common attributes. 259. 260.It FSOPT_RETURN_REALDEV 261If this is bit is set, then ATTR_CMN_DEVID and ATTR_CMN_FSID will return 262the values corresponding to the physical volume they are on. When a 263filesystem supports VOL_CAP_INT_VOLUME_GROUPS, it is possible that the 264filesystem may return a common logical value for these attributes otherwise. 265. 266.El 267. 268.Sh ATTRIBUTE BUFFER 269. 270The data returned in the buffer described by 271.Fa attrBuf 272and 273.Fa attrBufSize 274is formatted as follows. 275.Pp 276. 277.Bl -enum 278. 279.It 280The first element of the buffer is a 281.Vt u_int32_t 282that contains the overall length, in bytes, of the attributes returned. 283This size includes the length field itself. 284. 285.It 286Following the length field is a list of attributes. 287Each attribute is represented by a field of its type, 288where the type is given as part of the attribute description (below). 289. 290.It 291The attributes are placed into the attribute buffer in the order 292that they are described below. 293. 294.It 295Each attribute is aligned to a 4-byte boundary (including 64-bit data types). 296.El 297.Pp 298. 299If the attribute is of variable length, it is represented 300in the list by an 301.Vt attrreference 302structure, as defined by 303.Aq Pa sys/attr.h 304(shown below). 305. 306.Bd -literal 307typedef struct attrreference { 308 int32_t attr_dataoffset; 309 u_int32_t attr_length; 310} attrreference_t; 311.Ed 312.Pp 313. 314This structure contains a 'pointer' to the variable length attribute data. 315The 316.Fa attr_length 317field is the length of the attribute data (in bytes). 318The 319.Fa attr_dataoffset 320field is the offset in bytes from the 321.Vt attrreference 322structure 323to the attribute data. 324This offset will always be a multiple of sizeof(u_int32_t) bytes, 325so you can safely access common data types without fear of alignment 326exceptions. 327.Pp 328. 329The 330.Fn getattrlist 331function will silently truncate attribute data if 332.Fa attrBufSize 333is too small. 334The length field at the front of the attribute list always represents 335the length of the data actually copied into the attribute buffer. 336If the data is truncated, there is no easy way to determine the 337buffer size that's required to get all of the requested attributes. 338You should always pass an 339.Fa attrBufSize 340that is large enough to accommodate the known size of the attributes 341in the attribute list (including the leading length field). 342.Pp 343. 344Because the returned attributes are simply truncated if the buffer is 345too small, it's possible for a variable length attribute to reference 346data beyond the end of the attribute buffer. That is, it's possible 347for the attribute data to start beyond the end of the attribute buffer 348(that is, if 349.Fa attrRef 350is a pointer to the 351.Vt attrreference_t , 352( ( (char *) 353.Fa attrRef 354) + 355.Fa attr_dataoffset 356) > ( ( (char *) 357.Fa attrBuf 358) + 359.Fa attrSize 360) ) or, indeed, for the attribute data to extend beyond the end of the attribute buffer (that is, 361( ( (char *) 362.Fa attrRef 363) + 364.Fa attr_dataoffset 365+ 366.Fa attr_datalength 367) > ( ( (char *) 368.Fa attrBuf 369) + 370.Fa attrSize 371) ). 372If this happens you must increase the size of the buffer and call 373.Fn getattrlist 374to get an accurate copy of the attribute. 375. 376.Sh COMMON ATTRIBUTES 377. 378Common attributes relate to all types of file system objects. 379The following common attributes are defined. 380. 381.Bl -tag -width ATTR_VOL_ALLOCATIONCLUMP 382. 383.It ATTR_CMN_RETURNED_ATTRS 384An 385.Vt attribute_set_t 386structure which is used to report which of the requested attributes 387were actually returned. This attribute, when requested, will always 388be the first attribute returned. By default, unsupported attributes 389will be skipped (i.e. not packed into the output buffer). This behavior 390can be over-ridden using the FSOPT_PACK_INVAL_ATTRS option flag. Both 391.Xr getattrlist 2 and 392.Xr getatttrlistbulk 2 support this attribute while 393.Xr searchfs 2 does not. 394. 395.It ATTR_CMN_NAME 396An 397.Vt attrreference 398structure containing the name of the file system object as 399UTF-8 encoded, null terminated C string. 400The attribute data length will not be greater than 401.Dv NAME_MAX 402+ 1 characters, which is 403.Dv NAME_MAX 404* 3 + 1 bytes (as one UTF-8-encoded character may 405take up to three bytes). 406.Pp 407. 408.It ATTR_CMN_DEVID 409A 410.Vt dev_t 411containing the device number of the device on which this 412file system object's volume is mounted. 413Equivalent to the 414.Fa st_dev 415field of the 416.Vt stat 417structure returned by 418.Xr stat 2 . 419. 420.It ATTR_CMN_FSID 421An 422.Vt fsid_t 423structure containing the file system identifier for the volume on which 424the file system object resides. 425Equivalent to the 426.Fa f_fsid 427field of the 428.Vt statfs 429structure returned by 430.Xr statfs 2 . 431. 432.It ATTR_CMN_OBJTYPE 433An 434.Vt fsobj_type_t 435that identifies the type of file system object. 436The values are taken from 437.Vt enum vtype 438in 439.Aq Pa sys/vnode.h . 440. 441.It ATTR_CMN_OBJTAG 442An 443.Vt fsobj_tag_t 444that identifies the type of file system containing the object. 445The values are taken from 446.Vt enum vtagtype 447in 448.Aq Pa sys/vnode.h . 449. 450.It ATTR_CMN_OBJID 451An 452.Vt fsobj_id_t 453structure that uniquely identifies the file system object within a mounted 454volume for the duration of its mount; this identifier is not guaranteed to be 455persistent for the volume and may change every time the volume is mounted. 456.Pp 457On HFS+ volumes, the ATTR_CMN_OBJID of a file system object is distinct from 458the ATTR_CMN_OBJID of any hard link to that file system object. Although the 459ATTR_CMN_OBJID of a file system object may appear similar (in whole 460or in part) to it's ATTR_CMN_FILEID (see description of ATTR_CMN_FILEID below), 461\fBno relation between the two attributes should ever be implied.\fP 462.Pp 463ATTR_CMN_OBJID is deprecated sarting with macOS 10.13, iOS 11.0, watchOS 4.0 and 464tvOS 11.0 and ATTR_CMNEXT_LINKID should be used in its place. 465ATTR_CMN_OBJID can only be used on older operating systems only if the file 466system doesn't 64 bit IDs. See the 467.Fn getLinkIDInfo 468function in the EXAMPLES section. 469. 470.It ATTR_CMN_OBJPERMANENTID 471An 472.Vt fsobj_id_t 473structure that uniquely and persistently identifies the file system object 474within its volume; persistence implies that this attribute is unaffected by 475mount/unmount operations on the volume. 476.Pp 477Some file systems can not return this attribute when the volume is mounted 478read-only and will fail the request with error 479.Dv EROFS. 480.br 481(e.g. original HFS modifies on disk structures to generate persistent 482identifiers, and hence cannot do so if the volume is mounted read only.) 483. 484.It ATTR_CMN_PAROBJID 485An 486.Vt fsobj_id_t 487structure that uniquely identifies the parent directory of the file system 488object within a mounted volume, for the duration of the volume mount; this 489identifier is not guaranteed to be persistent for the volume and may change 490every time the volume is mounted. 491.Pp 492. 493If a file system object is hard linked from multiple directories, the parent 494directory returned for this attribute is non deterministic; it can be any one 495of the parent directories of this object. 496. 497For some volume formats the computing cost for this attribute is significant; 498developers are advised to request this attribute sparingly. 499. 500.It ATTR_CMN_SCRIPT 501(read/write) A 502.Vt text_encoding_t 503containing a text encoding hint for 504the file system object's name. 505It is included to facilitate the lossless round trip conversion of names between 506Unicode and traditional Mac OS script encodings. 507File systems that do not have an appropriate text encoding value should return 508kTextEncodingMacUnicode. 509. 510.It ATTR_CMN_CRTIME 511(read/write) A 512.Vt timespec 513structure containing the time that the file system object 514was created. 515. 516.It ATTR_CMN_MODTIME 517(read/write) A 518.Vt timespec 519structure containing the time that the file system object 520was last modified. 521Equivalent to the 522.Fa st_mtimespec 523field of the 524.Vt stat 525structure returned by 526.Xr stat 2 . 527. 528.It ATTR_CMN_CHGTIME 529A 530.Vt timespec 531structure containing the time that the file system object's 532attributes were last modified. 533Equivalent to the 534.Fa st_ctimespec 535field of the 536.Vt stat 537structure returned by 538.Xr stat 2 . 539. 540.It ATTR_CMN_ACCTIME 541(read/write) A 542.Vt timespec 543structure containing the time that the file system object 544was last accessed. 545Equivalent to the 546.Fa st_atimespec 547field of the 548.Vt stat 549structure returned by 550.Xr stat 2 . 551. 552.It ATTR_CMN_BKUPTIME 553(read/write) A 554.Vt timespec 555structure containing the time that the file system object was 556last backed up. 557This value is for use by backup utilities. 558The file system stores but does not interpret the value. 559. 560.It ATTR_CMN_FNDRINFO 561(read/write) 32 bytes of data for use by the Finder. 562Equivalent to the concatenation of a 563.Vt FileInfo 564structure and an 565.Vt ExtendedFileInfo 566structure 567(or, for directories, a 568.Vt FolderInfo 569structure and an 570.Vt ExtendedFolderInfo 571structure). 572.Pp 573This attribute is not byte swapped by the file system. 574The value of multibyte fields on disk is always big endian. 575When running on a little endian system (such as Darwin on x86), 576you must byte swap any multibyte fields. 577. 578.It ATTR_CMN_OWNERID 579(read/write) A 580.Vt uid_t 581containing the owner of the file system object. 582Equivalent to the 583.Fa st_uid 584field of the 585.Vt stat 586structure returned by 587.Xr stat 2 . 588. 589.It ATTR_CMN_GRPID 590(read/write) A 591.Vt gid_t 592containing the group of the file system object. 593Equivalent to the 594.Fa st_gid 595field of the 596.Vt stat 597structure returned by 598.Xr stat 2 . 599. 600.It ATTR_CMN_ACCESSMASK 601(read/write) A 602.Vt u_int32_t 603containing the access permissions of the file system object. 604Equivalent to the 605.Fa st_mode 606field of the 607.Vt stat 608structure returned by 609.Xr stat 2 . 610Only the permission bits of 611.Fa st_mode 612are valid; other bits should be ignored, 613e.g., by masking with 614.Dv ~S_IFMT . 615. 616.It ATTR_CMN_FLAGS 617(read/write) A 618.Vt u_int32_t 619containing file flags. 620Equivalent to the 621.Fa st_flags 622field of the 623.Vt stat 624structure returned by 625.Xr stat 2 . 626For more information about these flags, see 627.Xr chflags 2 . 628. 629.It ATTR_CMN_GEN_COUNT 630A 631.Vt u_int32_t 632containing a non zero monotonically increasing generation 633count for this file system object. The generation count tracks 634the number of times the data in a file system object has been 635modified. No meaning can be implied from its value. The 636value of the generation count for a file system object can 637be compared against a previous value of the same file system 638object for equality; i.e. an unchanged generation 639count indicates identical data. Requesting this attribute requires the 640FSOPT_ATTR_CMN_EXTENDED option flag. 641.Pp 642. 643A generation count value of 0 is invalid and cannot be used to 644determine data change. 645.Pp 646The generation count is invalid while a file is mmap'ed. An invalid 647generation count value of 0 will be returned for mmap'ed files. 648. 649.It ATTR_CMN_DOCUMENT_ID 650A 651.Vt u_int32_t 652containing the document id. The document id is a value assigned 653by the kernel to a document (which can be a file or directory) 654and is used to track the data regardless of where it gets moved. 655The document id survives safe saves; i.e it is sticky to the path it 656was assigned to. Requesting this attribute requires the 657FSOPT_ATTR_CMN_EXTENDED option flag. 658.Pp 659A document id of 0 is invalid. 660. 661.It ATTR_CMN_USERACCESS 662A 663.Vt u_int32_t 664containing the effective permissions of the current user 665(the calling process's effective UID) for this file system object. 666You can test for read, write, and execute permission using 667.Dv R_OK , 668.Dv W_OK , 669and 670.Dv X_OK , 671respectively. 672See 673.Xr access 2 674for more details. 675. 676.It ATTR_CMN_EXTENDED_SECURITY 677A variable-length object (thus an 678.Vt attrreference 679structure) containing a 680.Vt kauth_filesec 681structure, of which only the ACL entry is used. 682. 683.It ATTR_CMN_UUID 684A 685.Vt guid_t 686of the owner of the file system object. Analoguous to 687.Dv ATTR_CMN_OWNERID . 688. 689.It ATTR_CMN_GRPUUID 690A 691.Vt guid_t 692of the group to which the file system object belongs. 693Analoguous to 694.Dv ATTR_CMN_GRPID . 695. 696.It ATTR_CMN_FILEID 697A 698.Vt u_int64_t 699that uniquely identifies the file system object within its mounted volume. 700Equivalent to 701.Fa st_ino 702field of the 703.Vt stat 704structure returned by 705.Xr stat 2 . 706. 707.It ATTR_CMN_PARENTID 708A 709.Vt u_int64_t 710that identifies the parent directory of the file system object. 711. 712.It ATTR_CMN_FULLPATH 713An 714.Vt attrreference 715structure containing the full path (resolving all symlinks) to 716the file system object as 717a UTF-8 encoded, null terminated C string. 718The attribute data length will not be greater than 719.Dv PATH_MAX. 720Inconsistent behavior may be observed when this attribute is requested on 721hard-linked items, particularly when the file system does not support ATTR_CMN_PARENTID 722natively. Callers should be aware of this when requesting the full path of a hard-linked item. 723. 724.It ATTR_CMN_ADDEDTIME 725A 726.Vt timespec 727that contains the time that the file system object was created or renamed into 728its containing directory. Note that inconsistent behavior may be observed 729when this attribute is requested on hard-linked items. 730. 731.It ATTR_CMN_DATA_PROTECT_FLAGS 732A 733.Vt u_int32_t 734that contains the file or directory's data protection class. 735.Pp 736. 737.El 738. 739.Sh VOLUME ATTRIBUTES 740. 741Volume attributes relate to volumes (that is, mounted file systems). 742The following volume attributes are defined. 743. 744.Bl -tag -width ATTR_VOL_ALLOCATIONCLUMP 745. 746.It ATTR_VOL_INFO 747For historical reasons you must set 748.Dv ATTR_VOL_INFO 749in the 750.Fa volattr 751field if you request any other volume attributes. 752. 753.It ATTR_VOL_FSTYPE 754A 755.Vt u_int32_t 756containing the file system type. 757Equivalent to the 758.Fa f_type 759field of the 760.Vt statfs 761structure returned by 762.Xr statfs 2 . 763Generally not a useful value. 764. 765.It ATTR_VOL_SIGNATURE 766A 767.Vt u_int32_t 768containing the volume signature word. 769This value is unique within a given file system type and lets you 770distinguish between different volume formats handled by the same file system. 771. 772.It ATTR_VOL_SIZE 773An 774.Vt off_t 775containing the total size of the volume in bytes. 776. 777.It ATTR_VOL_SPACEFREE 778An 779.Vt off_t 780containing the free space on the volume in bytes. 781. 782.It ATTR_VOL_SPACEAVAIL 783An 784.Vt off_t 785containing the space, in bytes, on the volume available to non-privileged processes. 786This is the free space minus the amount of space reserved by the system to prevent critical 787disk exhaustion errors. 788Non-privileged programs, like a disk management tool, should use this value to display the 789space available to the user. 790.Pp 791.Dv ATTR_VOL_SPACEAVAIL 792is to 793.Dv ATTR_VOL_SPACEFREE 794as 795.Fa f_bavail 796is to 797.Fa f_bfree 798in 799.Xr statfs 2 . 800. 801.It ATTR_VOL_SPACEUSED 802An 803.Vt off_t 804containing the total space used on the volume in bytes. 805On space sharing volumes, this value may not be identical to the difference 806between the volume's size and its free space. 807. 808.It ATTR_VOL_MINALLOCATION 809An 810.Vt off_t 811containing the minimum allocation size on the volume in bytes. 812If you create a file containing one byte, it will consume this much space. 813. 814.It ATTR_VOL_ALLOCATIONCLUMP 815An 816.Vt off_t 817containing the allocation clump size on the volume, in bytes. 818As a file is extended, the file system will attempt to allocate 819this much space each time in order to reduce fragmentation. 820. 821.It ATTR_VOL_IOBLOCKSIZE 822A 823.Vt u_int32_t 824containing the optimal block size when reading or writing data. 825Equivalent to the 826.Fa f_iosize 827field of the 828.Vt statfs 829structure returned by 830.Xr statfs 2 . 831. 832.It ATTR_VOL_OBJCOUNT 833A 834.Vt u_int32_t 835containing the number of file system objects on the volume. 836. 837.It ATTR_VOL_FILECOUNT 838A 839.Vt u_int32_t 840containing the number of files on the volume. 841. 842.It ATTR_VOL_DIRCOUNT 843A 844.Vt u_int32_t 845containing the number of directories on the volume. 846. 847.It ATTR_VOL_MAXOBJCOUNT 848A 849.Vt u_int32_t 850containing the maximum number of file system objects that can be stored on the volume. 851. 852.It ATTR_VOL_MOUNTPOINT 853An 854.Vt attrreference 855structure containing the path to the volume's mount point as a 856UTF-8 encoded, null terminated C string. 857The attribute data length will not be greater than 858.Dv MAXPATHLEN . 859Equivalent to the 860.Fa f_mntonname 861field of the 862.Vt statfs 863structure returned by 864.Xr statfs 2 . 865. 866.It ATTR_VOL_NAME 867(read/write) An 868.Vt attrreference 869structure containing the name of the volume as a 870UTF-8 encoded, null terminated C string. 871The attribute data length will not be greater than 872.Dv NAME_MAX + 8731. 874.Pp 875. 876This attribute is only read/write if the 877.Dv VOL_CAP_INT_VOL_RENAME 878bit is set in the volume capabilities (see below). 879.Pp 880. 881.It ATTR_VOL_MOUNTFLAGS 882A 883.Vt u_int32_t 884containing the volume mount flags. 885This is a copy of the value passed to the 886.Fa flags 887parameter of 888.Xr mount 2 889when the volume was mounted. 890Equivalent to the 891.Fa f_flags 892field of the 893.Vt statfs 894structure returned by 895.Xr statfs 2 . 896. 897.It ATTR_VOL_MOUNTEDDEVICE 898An 899.Vt attrreference 900structure that returns the same value as the 901.Fa f_mntfromname 902field of the 903.Vt statfs 904structure returned by 905.Xr statfs 2 . 906For local volumes this is the path to the device on which the volume is mounted as a 907UTF-8 encoded, null terminated C string. 908For network volumes, this is a unique string that identifies the mount. 909The attribute data length will not be greater than 910.Dv MAXPATHLEN . 911.Pp 912. 913.It ATTR_VOL_ENCODINGSUSED 914An 915.Vt unsigned long long 916containing a bitmap of the text encodings used on this volume. 917For more information about this, see the discussion of 918.Fa encodingsBitmap 919in DTS Technote 1150 "HFS Plus Volume Format". 920. 921.It ATTR_VOL_CAPABILITIES 922A 923.Vt vol_capabilities_attr_t 924structure describing the optional features supported by this volume. 925See below for a discussion of volume capabilities. 926. 927.It ATTR_VOL_UUID 928A 929.Vt uuid_t 930containing the file system UUID. Typically this will be a 931version 5 UUID. 932. 933.It ATTR_VOL_QUOTA_SIZE 934An 935.Vt off_t 936containing the maximum size of the volume in bytes. 937. 938.It ATTR_VOL_RESERVED_SIZE 939An 940.Vt off_t 941containing the minimum size of the volume in bytes. 942. 943.It ATTR_VOL_ATTRIBUTES 944A 945.Vt vol_attributes_attr_t 946structure describing the attributes supported by this volume. 947This structure is discussed below, along with volume capabilities. 948. 949.It ATTR_VOL_FSTYPENAME 950An 951.Vt attrreference 952structure containing the file system type name as a 953UTF-8 encoded, null terminated C string. 954The attribute data length will not be greater than 955.Dv MFSTYPENAMELEN . 956. 957.It ATTR_VOL_FSSUBTYPE 958A 959.Vt u_int32_t 960containing the file system sub-type. 961Equivalent to the 962.Fa f_fssubtype 963field of the 964.Vt statfs 965structure returned by 966.Xr statfs 2 . 967. 968.El 969. 970.Sh DIRECTORY ATTRIBUTES 971. 972The following directory attributes are defined. 973. 974.Bl -tag -width ATTR_VOL_ALLOCATIONCLUMP 975. 976.It ATTR_DIR_LINKCOUNT 977A 978.Vt u_int32_t 979containing the number of hard links to the directory; 980this does not include the historical "." and ".." entries. 981For file systems that do not support hard links to directories, 982this value will be 1. 983. 984.It ATTR_DIR_ENTRYCOUNT 985A 986.Vt u_int32_t 987containing the number of file system objects in the directory, not including 988any synthetic items. The historical "." and ".." entries are also 989excluded from this count. 990. 991.It ATTR_DIR_MOUNTSTATUS 992A 993.Vt u_int32_t 994containing flags describing what's mounted on the directory. 995Currently the only flag defined is 996.Dv DIR_MNTSTATUS_MNTPOINT, 997which indicates that there is a file system mounted on this directory. 998. 999.It ATTR_DIR_ALLOCSIZE 1000An 1001.Vt off_t 1002containing the number of bytes on disk used by the directory 1003(the physical size). 1004. 1005.It ATTR_DIR_IOBLOCKSIZE 1006A 1007.Vt u_int32_t 1008containing the optimal block size when reading or writing data. 1009. 1010.It ATTR_DIR_DATALENGTH 1011An 1012.Vt off_t 1013containing the length of the directory in bytes (the logical size). 1014.El 1015. 1016.Pp 1017Requested directory attributes are not returned for file system objects that 1018are not directories. 1019. 1020.Sh FILE ATTRIBUTES 1021. 1022The following file attributes are defined. 1023. 1024.Bl -tag -width ATTR_VOL_ALLOCATIONCLUMP 1025. 1026.It ATTR_FILE_LINKCOUNT 1027A 1028.Vt u_int32_t 1029containing the number of hard links to this file. 1030Equivalent to the 1031.Fa st_nlink 1032field of the 1033.Vt stat 1034structure returned by 1035.Xr stat 2 . 1036. 1037.It ATTR_FILE_TOTALSIZE 1038An 1039.Vt off_t 1040containing the total number of bytes in all forks of the file (the logical size). 1041. 1042.It ATTR_FILE_ALLOCSIZE 1043An 1044.Vt off_t 1045containing a count of the bytes on disk used by all of the file's forks (the physical size). 1046. 1047.It ATTR_FILE_IOBLOCKSIZE 1048A 1049.Vt u_int32_t 1050containing the optimal block size when reading or writing this file's data. 1051. 1052.It ATTR_FILE_CLUMPSIZE 1053A 1054.Vt u_int32_t 1055containing the allocation clump size for this file, in bytes. 1056As the file is extended, the file system will attempt to allocate 1057this much space each time in order to reduce fragmentation. 1058This value applies to the data fork. 1059. 1060.It ATTR_FILE_DEVTYPE 1061(read/write) A 1062.Vt u_int32_t 1063containing the device type for a special device file. 1064Equivalent to the 1065.Fa st_rdev 1066field of the 1067.Vt stat 1068structure returned by 1069.Xr stat 2 . 1070. 1071.It ATTR_FILE_FILETYPE 1072A 1073.Vt u_int32_t 1074that whose value is reserved. 1075Clients should ignore its value. 1076New volume format implementations should not support this attribute. 1077. 1078.It ATTR_FILE_FORKCOUNT 1079A 1080.Vt u_int32_t 1081containing the number of forks in the file. 1082No built-in file systems on Mac OS X currently support forks other 1083than the data and resource fork. 1084. 1085.It ATTR_FILE_FORKLIST 1086An 1087.Vt attrreference 1088structure containing a list of named forks of the file. 1089No built-in file systems on Mac OS X currently support forks 1090other than the data and resource fork. 1091Because of this, the structure of this attribute's value is not yet defined. 1092. 1093.It ATTR_FILE_DATALENGTH 1094An 1095.Vt off_t 1096containing the length of the data fork in bytes (the logical size). 1097. 1098.It ATTR_FILE_DATAALLOCSIZE 1099An 1100.Vt off_t 1101containing a count of the bytes on disk used by the data fork (the physical size). 1102. 1103.It ATTR_FILE_DATAEXTENTS 1104An 1105.Vt extentrecord 1106array for the data fork. 1107The array contains eight 1108.Vt diskextent 1109structures which represent the first 1110eight extents of the fork. 1111.Pp 1112This attributes exists for compatibility reasons. 1113New clients should not use this attribute. 1114Rather, they should use the 1115.Dv F_LOG2PHYS 1116command in 1117.Xr fcntl 2 . 1118.Pp 1119. 1120In current implementations the value may not be entirely accurate for 1121a variety of reasons. 1122. 1123.It ATTR_FILE_RSRCLENGTH 1124An 1125.Vt off_t 1126containing the length of the resource fork in bytes (the logical size). 1127. 1128.It ATTR_FILE_RSRCALLOCSIZE 1129An 1130.Vt off_t 1131containing a count of the bytes on disk used by the resource fork (the physical size). 1132. 1133.It ATTR_FILE_RSRCEXTENTS 1134An 1135.Vt extentrecord 1136array for the resource fork. 1137The array contains eight 1138.Vt diskextent 1139structures which represent the first 1140eight extents of the fork. 1141.Pp 1142See also 1143.Dv ATTR_FILE_DATAEXTENTS . 1144. 1145.El 1146. 1147.Pp 1148File attributes are used for any file system object that is not a directory, 1149not just ordinary files. 1150Requested file attributes are not returned for file system objects that 1151are directories. 1152. 1153.Sh FORK ATTRIBUTES 1154. 1155Fork attributes relate to the actual data in the file, 1156which can be held in multiple named contiguous ranges, or forks. 1157These cannot be used if the FSOPT_ATTR_CMN_EXTENDED is given. 1158The following fork attributes are defined. 1159. 1160.Bl -tag -width ATTR_VOL_ALLOCATIONCLUMP 1161. 1162.It ATTR_FORK_TOTALSIZE 1163Deprecated. 1164An 1165.Vt off_t 1166containing the length of the fork in bytes (the logical size). 1167. 1168.It ATTR_FORK_ALLOCSIZE 1169Deprecated. 1170An 1171.Vt off_t 1172containing a count of the bytes on disk used by the fork (the physical size). 1173. 1174.It ATTR_FORK_RESERVED 1175Reserved. 1176You must set this to 0. 1177. 1178.El 1179.Pp 1180. 1181Fork attributes are deprecated and all bits are reserved. 1182They are not properly implemented by any current Mac OS X 1183volume format implementation. 1184We strongly recommend that client programs do not request fork attributes. 1185If you are implementing a volume format, you should not support these attributes. 1186. 1187.Sh COMMON EXTENDED ATTRIBUTES 1188. 1189Common extended attributes are like common attributes except that they are set 1190in the forkattr field and can only be used if the FSOPT_ATTR_CMN_EXTENDED 1191option is given. Use of these attributes is mutually exclusive with the above 1192fork attributes. 1193. 1194.Bl -tag -width ATTR_CMNEXT_RECURSIVE_GENCOUNT 1195. 1196.It ATTR_CMNEXT_RELPATH 1197An 1198.Vt attrreference 1199structure containing the mount-relative path of 1200the file system object as 1201a UTF-8 encoded, null terminated C string. 1202The attribute data length will not be greater than 1203.Dv PATH_MAX. 1204Inconsistent behavior may be observed when this attribute is requested on 1205hard-linked items, particularly when the file system does not support 1206ATTR_CMN_PARENTID natively. Callers should be aware of this when requesting the 1207relative path of a hard-linked item. 1208. 1209.It ATTR_CMNEXT_PRIVATESIZE 1210An 1211.Vt off_t 1212containing the number of bytes that are \fBnot\fP trapped inside a clone 1213or snapshot, and which would be freed immediately if the file were deleted. 1214. 1215.It ATTR_CMNEXT_LINKID 1216A 1217.Vt u_int64_t 1218that uniquely identifies the file system object within a mounted volume for the 1219duration of its mount. 1220.Pp 1221On HFS+ and APFS volumes, the ATTR_CMNEXT_LINKID of a file system 1222object is distinct from the ATTR_CMNEXT_LINKID of any hard link to that file 1223system object. Although the ATTR_CMNEXT_LINKID of a file system object may appear 1224similar (in whole or in part) to its ATTR_CMN_FILEID (see description of 1225ATTR_CMN_FILEID above), \fBno relation between the two attributes should ever be implied.\fP 1226. 1227.It ATTR_CMNEXT_NOFIRMLINKPATH 1228An 1229.Vt attrreference 1230structure containing a path that does not have firmlinks of 1231the file system object as 1232a UTF-8 encoded, null terminated C string. 1233The attribute data length will not be greater than 1234.Dv PATH_MAX. 1235Inconsistent behavior may be observed when this attribute is requested on 1236hard-linked items, particularly when the file system does not support 1237ATTR_CMN_PARENTID natively. Callers should be aware of this when requesting the 1238canonical path of a hard-linked item. 1239.It ATTR_CMNEXT_REALDEVID 1240A 1241.Vt dev_t 1242containing the real device number of the device on which this 1243file system object's volume is mounted. 1244Equivalent to the 1245.Fa st_dev 1246field of the 1247.Vt stat 1248structure returned by 1249.Xr stat 2 . 1250. 1251.It ATTR_CMNEXT_REALFSID 1252An 1253.Vt fsid_t 1254structure containing the real file system identifier for the volume on which 1255the file system object resides. 1256Equivalent to the 1257.Fa f_fsid 1258field of the 1259.Vt statfs 1260structure returned by 1261.Xr statfs 2 . 1262. 1263.It ATTR_CMNEXT_CLONEID 1264A 1265.Vt u_int64_t 1266that uniquely identifies the data stream associated with the file 1267system object. Useful for finding which files are pure clones of each 1268other (as they will have the same clone-id). 1269. 1270.It ATTR_CMNEXT_EXT_FLAGS 1271A 1272.Vt u_int64_t 1273that contains additional flags with information about the file. The 1274flags are: 1275. 1276.Bl -tag -width EF_SHARES_ALL_BLOCKS 1277. 1278.It EF_MAY_SHARE_BLOCKS 1279If this bit is set then the file may share blocks with another file 1280(i.e. it may be a clone of another file). 1281. 1282.It EF_NO_XATTRS 1283If this bit is set then the file has no extended attributes. Useful 1284for avoiding a call to listxattr(). 1285. 1286.It EF_IS_SYNC_ROOT 1287If this bit is set the directory is a "sync root". This bit will 1288never be set for regular files. 1289. 1290.It EF_IS_PURGEABLE 1291If this bit is set the item is a "purgeable" item that can be deleted 1292by the file system when asked to free space. 1293. 1294.It EF_IS_SPARSE 1295If this bit is set the item has sparse regions. 1296. 1297.It EF_IS_SYNTHETIC 1298If this bit is set the item is a synthetic directory/symlink. 1299. 1300.It EF_SHARES_ALL_BLOCKS 1301If this bit is set then the file shares all of its blocks with another 1302file (i.e. it is a full clone of another file). For compatibility reasons, 1303EF_SHARES_ALL_BLOCKS means EF_MAY_SHARE_BLOCKS as well. 1304. 1305.El 1306. 1307.It ATTR_CMNEXT_RECURSIVE_GENCOUNT 1308A 1309.Vt u_int64_t 1310that represents the recursive generation count of a directory that has 1311been marked as maintain-dir-stats in an apfs file system. This 1312gencount is updated any time any child is modified (as part of the 1313contract that a maintain-dir-stats directory manages). If the 1314directory is not marked maintain-dir-stats, a zero is returned. 1315. 1316.It ATTR_CMNEXT_ATTRIBUTION_TAG 1317An optional 1318.Vt u_int64_t 1319id that represents the bundle id (owner) assoicated with the file 1320(zero means the file isn't attributed yet) 1321. 1322.It ATTR_CMNEXT_CLONE_REFCNT 1323A 1324.Vt u_int32_t 1325that represents the number of full clones 1326(each shares all of its blocks with this file). 1327. 1328.El 1329.Pp 1330. 1331.Sh VOLUME CAPABILITIES 1332. 1333.\" vol_capabilities_attr_t 1334. 1335Not all volumes support all features. 1336The 1337.Dv ATTR_VOL_CAPABILITIES 1338attribute returns a 1339.Vt vol_capabilities_attr_t 1340structure (shown below) that indicates which features are supported by the volume. 1341. 1342.Bd -literal 1343typedef u_int32_t vol_capabilities_set_t[4]; 1344.Pp 1345. 1346#define VOL_CAPABILITIES_FORMAT 0 1347#define VOL_CAPABILITIES_INTERFACES 1 1348#define VOL_CAPABILITIES_RESERVED1 2 1349#define VOL_CAPABILITIES_RESERVED2 3 1350.Pp 1351. 1352typedef struct vol_capabilities_attr { 1353 vol_capabilities_set_t capabilities; 1354 vol_capabilities_set_t valid; 1355} vol_capabilities_attr_t; 1356.Ed 1357.Pp 1358. 1359The structure contains two fields, 1360.Fa capabilities 1361and 1362.Fa valid . 1363Each consists of an array of four elements. 1364The arrays are indexed by the following values. 1365. 1366.Bl -tag -width VOL_CAP_FMT_PERSISTENTOBJECTIDS 1367. 1368.It VOL_CAPABILITIES_FORMAT 1369This element contains information about the volume format. 1370See 1371.Dv VOL_CAP_FMT_PERSISTENTOBJECTIDS 1372and so on, below. 1373. 1374.It VOL_CAPABILITIES_INTERFACES 1375This element contains information about which optional functions are 1376supported by the volume format implementation. 1377See 1378.Dv VOL_CAP_INT_SEARCHFS 1379and so on, below. 1380. 1381.It VOL_CAPABILITIES_RESERVED1 1382Reserved. 1383A file system implementation should set this element to zero. 1384A client program should ignore this element. 1385. 1386.It VOL_CAPABILITIES_RESERVED2 1387Reserved. 1388A file system implementation should set this element to zero. 1389A client program should ignore this element. 1390. 1391.El 1392.Pp 1393. 1394The 1395.Fa valid 1396field contains bit sets that indicate which flags are known to the volume format 1397implementation. 1398Each bit indicates whether the contents of the corresponding bit in the 1399.Fa capabilities 1400field is valid. 1401.Pp 1402. 1403The 1404.Fa capabilities 1405field contains bit sets that indicate whether a particular feature is implemented 1406by this volume format. 1407.Pp 1408. 1409The following bits are defined in the first element (indexed by 1410.Dv VOL_CAPABILITIES_FORMAT ) 1411of the 1412.Fa capabilities 1413and 1414.Fa valid 1415fields of the 1416.Vt vol_capabilities_attr_t 1417structure. 1418. 1419.Bl -tag -width VOL_CAP_FMT_PERSISTENTOBJECTIDS 1420. 1421.It VOL_CAP_FMT_PERSISTENTOBJECTIDS 1422If this bit is set the volume format supports persistent object identifiers 1423and can look up file system objects by their IDs. 1424See 1425.Dv ATTR_CMN_OBJPERMANENTID 1426for details about how to obtain these identifiers. 1427. 1428.It VOL_CAP_FMT_SYMBOLICLINKS 1429If this bit is set the volume format supports symbolic links. 1430. 1431.It VOL_CAP_FMT_HARDLINKS 1432If this bit is set the volume format supports hard links. 1433. 1434.It VOL_CAP_FMT_JOURNAL 1435If this bit is set the volume format supports a journal used to 1436speed recovery in case of unplanned restart (such as a power outage 1437or crash). 1438This does not necessarily mean the volume is actively using a journal. 1439.Pp 1440Introduced with Darwin 7.0 (Mac OS X version 10.3). 1441. 1442.It VOL_CAP_FMT_JOURNAL_ACTIVE 1443If this bit is set the volume is currently using a journal for 1444speedy recovery after an unplanned restart. 1445This bit can be set only if 1446.Dv VOL_CAP_FMT_JOURNAL 1447is also set. 1448.Pp 1449Introduced with Darwin 7.0 (Mac OS X version 10.3). 1450. 1451.It VOL_CAP_FMT_NO_ROOT_TIMES 1452If this bit is set the volume format does not store reliable times for 1453the root directory, so you should not depend on them to detect changes, 1454identify volumes across unmount/mount, and so on. 1455.Pp 1456Introduced with Darwin 7.0 (Mac OS X version 10.3). 1457. 1458.It VOL_CAP_FMT_SPARSE_FILES 1459If this bit is set the volume format supports sparse files, 1460that is, files which can have 'holes' that have never been written 1461to, and thus do not consume space on disk. 1462A sparse file may have an allocated size on disk that is less than its logical length (that is, 1463.Dv ATTR_FILE_ALLOCSIZE 1464< 1465.Dv ATTR_FILE_TOTALSIZE ). 1466. 1467.Pp 1468Introduced with Darwin 7.0 (Mac OS X version 10.3). 1469. 1470.It VOL_CAP_FMT_ZERO_RUNS 1471For security reasons, parts of a file (runs) that have never been 1472written to must appear to contain zeroes. 1473When this bit is set, the volume keeps track of allocated but unwritten 1474runs of a file so that it can substitute zeroes without actually 1475writing zeroes to the media. 1476This provides performance similar to sparse files, but not the space savings. 1477.Pp 1478Introduced with Darwin 7.0 (Mac OS X version 10.3). 1479. 1480.It VOL_CAP_FMT_CASE_SENSITIVE 1481If this bit is set the volume format treats upper and lower case 1482characters in file and directory names as different. 1483Otherwise an upper case character is equivalent to a lower case character, 1484and you can't have two names that differ solely in the case of 1485the characters. 1486.Pp 1487Introduced with Darwin 7.0 (Mac OS X version 10.3). 1488. 1489.It VOL_CAP_FMT_CASE_PRESERVING 1490If this bit is set the volume format preserves the case of 1491file and directory names. 1492Otherwise the volume may change the case of some characters 1493(typically making them all upper or all lower case). 1494A volume that sets 1495.Dv VOL_CAP_FMT_CASE_SENSITIVE 1496must also set 1497.Dv VOL_CAP_FMT_CASE_PRESERVING . 1498.Pp 1499Introduced with Darwin 7.0 (Mac OS X version 10.3). 1500. 1501.It VOL_CAP_FMT_FAST_STATFS 1502This bit is used as a hint to upper layers to 1503indicate that 1504.Xr statfs 2 1505is fast enough that its results need not be cached by the caller. 1506A volume format implementation that caches the 1507.Xr statfs 2 1508information in memory should set this bit. 1509An implementation that must always read from disk or always perform a network 1510transaction to satisfy 1511.Xr statfs 2 1512should not set this bit. 1513.Pp 1514Introduced with Darwin 7.0 (Mac OS X version 10.3). 1515. 1516.It VOL_CAP_FMT_2TB_FILESIZE 1517If this bit is set the volume format supports file sizes larger 1518than 4GB, and potentially up to 2TB; it does not indicate 1519whether the file system supports files larger than that. 1520.Pp 1521Introduced with Darwin 8.0 (Mac OS X version 10.4). 1522. 1523.It VOL_CAP_FMT_OPENDENYMODES 1524If this bit is set, the volume format supports open deny modes 1525(e.g., "open for read write, deny write"). 1526. 1527.It VOL_CAP_FMT_HIDDEN_FILES 1528If this bit is set, the volume format supports the 1529.Dv UF_HIDDEN 1530file flag, and the 1531.Dv UF_HIDDEN 1532flag is mapped to that volume's native "hidden" or "invisible" 1533bit (e.g., the invisible bit from the Finder Info extended attribute). 1534. 1535.It VOL_CAP_FMT_PATH_FROM_ID 1536If this bit is set, the volume format supports the ability to derive a pathname 1537to the root of the file system given only the ID of an object. This also 1538implies that object IDs on this file system are persistent and not recycled. 1539Most file systems will not support this capability. 1540. 1541.It VOL_CAP_FMT_NO_VOLUME_SIZES 1542If this bit is set the volume format does not support 1543determining values for total data blocks, available blocks, or free blocks, as in 1544.Fa f_blocks, 1545.Fa f_bavail, 1546and 1547.Fa f_bfree 1548in the 1549.Fa struct statfs 1550returned by 1551.Xr statfs 2 . 1552Historically, those values were set to 0xFFFFFFFF for volumes 1553that did not support them. 1554.Pp 1555Introduced with Darwin 10.0 (Mac OS X version 10.6). 1556. 1557.It VOL_CAP_FMT_64BIT_OBJECT_IDS 1558If this bit is set, the volume format uses object IDs that are 64-bit. 1559This means that ATTR_CMN_FILEID and ATTR_CMN_PARENTID are the primary means of 1560obtaining object IDs from this volume. The values returned by ATTR_CMN_OBJID, 1561ATTR_CMN_OBJPERMANENTID, and ATTR_CMN_PAROBJID can be interpreted as 64-bit 1562object IDs instead of fsobj_id_t. 1563. 1564.It VOL_CAP_FMT_DOCUMENT_ID 1565If this bit is set, the volume format supports document IDs 1566(an ID which persists across object ID changes) for document revisions. 1567.It VOL_CAP_FMT_NO_IMMUTABLE_FILES 1568If this bit is set, the volume format does not support setting the UF_IMMUTABLE 1569flag. 1570See ATTR_CMN_FLAGS for more details. 1571.It VOL_CAP_FMT_NO_PERMISSIONS 1572If this bit is set, the volume format does not support setting file 1573permissions. 1574See ATTR_CMN_USERACCESS for more details. 1575.It VOL_CAP_FMT_SHARED_SPACE 1576If this bit is set, the volume format supports having multiple logical filesystems 1577in a single "partition" which share space. 1578.It VOL_CAP_FMT_VOL_GROUPS 1579If this bit is set, the volume format supports having multiple logical filesystems 1580which may be mounted and unmounted together and may present common filesystem 1581identifier information. 1582.It VOL_CAP_FMT_SEALED 1583If this bit is set, the volume is cryptographically sealed and any modifications 1584may render the volume unusable. 1585. 1586. 1587.El 1588.Pp 1589. 1590The following bits are defined in the second element (indexed by 1591.Dv VOL_CAPABILITIES_INTERFACES ) 1592of the 1593.Fa capabilities 1594and 1595.Fa valid 1596fields of the 1597.Vt vol_capabilities_attr_t 1598structure. 1599. 1600.Bl -tag -width VOL_CAP_FMT_PERSISTENTOBJECTIDS 1601. 1602.It VOL_CAP_INT_SEARCHFS 1603If this bit is set the volume format implementation supports 1604.Xr searchfs 2 . 1605. 1606.It VOL_CAP_INT_ATTRLIST 1607If this bit is set the volume format implementation supports 1608.Fn getattrlist 1609and 1610.Xr setattrlist 2 . 1611. 1612.It VOL_CAP_INT_NFSEXPORT 1613If this bit is set the volume format implementation allows this volume to be exported via NFS. 1614. 1615.It VOL_CAP_INT_READDIRATTR 1616If this bit is set the volume format implementation supports 1617.Xr getdirentriesattr 2 . 1618. 1619.It VOL_CAP_INT_EXCHANGEDATA 1620If this bit is set the volume format implementation supports 1621.Xr exchangedata 2 . 1622.Pp 1623Introduced with Darwin 7.0 (Mac OS X version 10.3). 1624. 1625.It VOL_CAP_INT_COPYFILE 1626If this bit is set the volume format implementation supports the (private and undocumented) 1627copyfile() function. 1628(This is not the 1629.Xr copyfile 3 1630function.) 1631.Pp 1632Introduced with Darwin 7.0 (Mac OS X version 10.3). 1633. 1634.It VOL_CAP_INT_ALLOCATE 1635If this bit is set the volume format implementation supports the 1636.Dv F_PREALLOCATE 1637selector of 1638.Xr fcntl 2 . 1639.Pp 1640Introduced with Darwin 7.0 (Mac OS X version 10.3). 1641. 1642.It VOL_CAP_INT_VOL_RENAME 1643If this bit is set the volume format implementation allows you to 1644modify the volume name using 1645.Xr setattrlist 2 . 1646.Pp 1647Introduced with Darwin 7.0 (Mac OS X version 10.3). 1648. 1649.It VOL_CAP_INT_ADVLOCK 1650If this bit is set the volume format implementation supports 1651advisory locking, that is, the 1652.Dv F_GETLK , 1653.Dv F_SETLK , 1654and 1655.Dv F_SETLKW 1656selectors to 1657.Xr fcntl 2 . 1658.Pp 1659Introduced with Darwin 7.0 (Mac OS X version 10.3). 1660. 1661.It VOL_CAP_INT_FLOCK 1662If this bit is set the volume format implementation supports 1663whole file locks. 1664This includes 1665.Xr flock 2 1666and the 1667.Dv O_EXLOCK 1668and 1669.Dv O_SHLOCK 1670flags to 1671.Xr open 2 . 1672.Pp 1673Introduced with Darwin 7.0 (Mac OS X version 10.3). 1674. 1675.It VOL_CAP_INT_EXTENDED_SECURITY 1676If this bit is set the volume format implementation supports 1677extended security controls (ACLs). 1678.Pp 1679Introduced with Darwin 8.0 (Mac OS X version 10.4). 1680. 1681.It VOL_CAP_INT_USERACCESS 1682If this bit is set the volume format implementation supports the 1683ATTR_CMN_USERACCESS attribute. 1684.Pp 1685Introduced with Darwin 8.0 (Mac OS X version 10.4). 1686. 1687.It VOL_CAP_INT_MANLOCK 1688If this bit is set, the volume format implementation supports 1689AFP-style mandatory byte range locks via 1690.Xr ioctl 2 . 1691. 1692.It VOL_CAP_INT_EXTENDED_ATTR 1693If this bit is set, the volume format implementation supports 1694native extended attributes (see 1695.Xr setxattr 2 Ns ). 1696. 1697.It VOL_CAP_INT_CLONE 1698If this bit is set, the file system supports cloning files and directories. 1699See 1700.Xr clonefileat 2 1701for more details. 1702. 1703.It VOL_CAP_INT_SNAPSHOT 1704If this bit is set, the file system supports snapshots. 1705See 1706.Xr fs_snapshot_create 2 1707for more details. 1708. 1709.It VOL_CAP_INT_NAMEDSTREAMS 1710If this bit is set, the volume format implementation supports 1711native named streams. 1712. 1713.It VOL_CAP_INT_RENAME_SWAP 1714If this bit is set, the file system supports swapping file system 1715objects. See 1716.Xr rename 2 1717for more details. 1718. 1719.It VOL_CAP_INT_RENAME_EXCL 1720If this bit is set, the file system supports an exclusive rename 1721operation. See 1722.Xr rename 2 1723for more details. 1724. 1725.It VOL_CAP_INT_RENAME_OPENFAIL 1726If this bit is set, the file system may fail a rename operation 1727of a directory if one of its descendents is open. 1728See 1729.Xr rename 2 1730for more details. 1731. 1732.El 1733.Pp 1734. 1735.\" vol_attributes_attr_t 1736. 1737A volume can also report which attributes it supports. 1738This information is returned by the 1739.Dv ATTR_VOL_ATTRIBUTES 1740attribute, which returns a 1741.Vt vol_attributes_attr_t 1742structure (shown below). 1743. 1744.Bd -literal 1745typedef struct attribute_set { 1746 attrgroup_t commonattr; /* common attribute group */ 1747 attrgroup_t volattr; /* volume attribute group */ 1748 attrgroup_t dirattr; /* directory attribute group */ 1749 attrgroup_t fileattr; /* file attribute group */ 1750 attrgroup_t forkattr; /* fork attribute group */ 1751} attribute_set_t; 1752.Pp 1753. 1754typedef struct vol_attributes_attr { 1755 attribute_set_t validattr; 1756 attribute_set_t nativeattr; 1757} vol_attributes_attr_t; 1758.Ed 1759.Pp 1760. 1761The 1762.Fa validattr 1763field consists of a number of bit sets that indicate whether an attribute is 1764supported by the volume format implementation. 1765The 1766.Fa nativeattr 1767is similar except that the bit sets indicate whether an attribute is supported 1768natively by the volume format. 1769An attribute is supported natively if the volume format implementation does not have to do 1770any complex conversions to access the attribute. 1771For example, a volume format might support persistent object identifiers, but 1772doing so requires a complex table lookup that is not part of the core volume 1773format. 1774In that case, the 1775.Dv ATTR_VOL_ATTRIBUTES 1776attribute would return 1777.Dv ATTR_CMN_OBJPERMANENTID 1778set in the 1779.Fa validattr 1780field of the 1781.Vt vol_attributes_attr_t , 1782but not in the 1783.Fa nativeattr 1784field. 1785. 1786.Sh RETURN VALUES 1787Upon successful completion a value of 0 is returned. 1788Otherwise, a value of -1 is returned and 1789.Va errno 1790is set to indicate the error. 1791. 1792.Sh COMPATIBILITY 1793Not all volumes support 1794.Fn getattrlist . 1795The best way to test whether a volume supports this function is to 1796simply call it and check the error result. 1797.Fn getattrlist 1798will return 1799.Dv ENOTSUP 1800if it is not supported on a particular volume. 1801.Pp 1802. 1803The 1804.Fn getattrlist 1805function has been undocumented for more than two years. 1806In that time a number of volume format implementations have been created without 1807a proper specification for the behaviour of this routine. 1808You may encounter volume format implementations with slightly different 1809behaviour than what is described here. 1810Your program is expected to be tolerant of this variant behaviour. 1811.Pp 1812. 1813If you're implementing a volume format that supports 1814.Fn getattrlist , 1815you should be careful to support the behaviour specified by this document. 1816. 1817.Sh ERRORS 1818.Fn getattrlist 1819and 1820.Fn fgetattrlist 1821will fail if: 1822.Bl -tag -width Er 1823. 1824.It Bq Er ENOTSUP 1825The volume does not support the query. 1826. 1827.It Bq Er ENOTDIR 1828A component of the path prefix for 1829.Fn getattrlist 1830is not a directory. 1831. 1832.It Bq Er ENAMETOOLONG 1833A component of a path name for 1834.Fn getattrlist 1835exceeded 1836.Dv NAME_MAX 1837characters, or an entire path name exceeded 1838.Dv PATH_MAX 1839characters. 1840. 1841.It Bq Er ENOENT 1842The file system object for 1843.Fn getattrlist 1844does not exist. 1845. 1846.It Bq Er EBADF 1847The file descriptor argument for 1848.Fn fgetattrlist 1849is not a valid file descriptor. 1850. 1851.It Bq Er EACCES 1852Search permission is denied for a component of the path prefix for 1853.Fn getattrlist . 1854. 1855.It Bq Er ELOOP 1856Too many symbolic links were encountered in translating the pathname 1857for 1858.Fn getattrlist . 1859. 1860.It Bq Er ELOOP 1861FSOPT_NOFOLLOW_ANY was passed and a symbolic link was encountered in 1862translating the pathname for 1863.Fn getattrlist . 1864. 1865.It Bq Er EFAULT 1866.Fa path , 1867.Fa attrList 1868or 1869.Em attrBuf 1870points to an invalid address. 1871. 1872.It Bq Er ERANGE 1873.Fa attrBufSize 1874is too small to hold a u_int32_t. 1875. 1876.It Bq Er EINVAL 1877The 1878.Fa bitmapcount 1879field of 1880.Fa attrList 1881is not 1882.Dv ATTR_BIT_MAP_COUNT . 1883. 1884.It Bq Er EINVAL 1885You requested an invalid attribute. 1886. 1887.It Bq Er EINVAL 1888You requested an attribute that is not supported for this file system object. 1889. 1890.It Bq Er EINVAL 1891You requested volume attributes and directory or file attributes. 1892. 1893.It Bq Er EINVAL 1894You requested volume attributes but 1895.Fa path 1896does not reference the root of the volume. 1897. 1898.It Bq Er EROFS 1899The volume is read-only but must be modified in order to return this attribute. 1900. 1901.It Bq Er EIO 1902An I/O error occurred while reading from or writing to the file system. 1903.El 1904.Pp 1905In addition to the errors returned by the 1906.Fn getattrlist , 1907the 1908.Fn getattrlistat 1909function may fail if: 1910.Bl -tag -width Er 1911.It Bq Er EBADF 1912The 1913.Fa path 1914argument does not specify an absolute path and the 1915.Fa fd 1916argument is neither 1917.Dv AT_FDCWD 1918nor a valid file descriptor open for searching. 1919.It Bq Er ENOTDIR 1920The 1921.Fa path 1922argument is not an absolute path and 1923.Fa fd 1924is neither 1925.Dv AT_FDCWD 1926nor a file descriptor associated with a directory. 1927.El 1928.Pp 1929. 1930.Sh CAVEATS 1931. 1932If you request any volume attributes, you must set 1933.Dv ATTR_VOL_INFO 1934in the 1935.Fa volattr 1936field, even though it generates no result in the attribute buffer. 1937.Pp 1938. 1939The order that attributes are stored in the attribute buffer almost 1940invariably matches the order of attribute mask bit values. 1941For example, 1942.Dv ATTR_CMN_NAME 1943(0x00000001) comes before 1944.Dv ATTR_CMN_DEVID 1945(0x00000002) because its value is smaller. 1946When ordering attributes, you should always use the order in which they 1947are described above. 1948.Pp 1949. 1950The 1951.Vt timespec 1952structure is 64-bits (two 32-bit elements) in 32-bit code, and 1953128-bits (two 64-bit elements) in 64-bit code; however, it is aligned 1954on a 4-byte (32-bit) boundary, even in 64-bit code. 1955.Pp 1956If you use a structure 1957for the attribute data, it must be correctly packed and aligned (see 1958examples). 1959.Pp 1960. 1961Inconsistent behavior may be observed when the ATTR_CMN_FULLPATH attribute is requested on 1962hard-linked items, particularly when the file system does not support ATTR_CMN_PARENTID 1963natively. Callers should be aware of this when requesting the full path of a hard-linked item, especially 1964if the full path crosses mount points. 1965.Pp 1966. 1967For more caveats, see also the compatibility notes above. 1968. 1969.Sh EXAMPLES 1970. 1971The following code prints the file type and creator of a file, 1972assuming that the volume supports the required attributes. 1973. 1974.Bd -literal 1975#include <assert.h> 1976#include <stdio.h> 1977#include <string.h> 1978#include <sys/attr.h> 1979#include <sys/errno.h> 1980#include <unistd.h> 1981#include <sys/vnode.h> 1982.Pp 1983. 1984typedef struct attrlist attrlist_t; 1985.Pp 1986. 1987struct FInfoAttrBuf { 1988 u_int32_t length; 1989 fsobj_type_t objType; 1990 char finderInfo[32]; 1991} __attribute__((aligned(4), packed)); 1992typedef struct FInfoAttrBuf FInfoAttrBuf; 1993.Pp 1994. 1995static int FInfoDemo(const char *path) 1996{ 1997 int err; 1998 attrlist_t attrList; 1999 FInfoAttrBuf attrBuf; 2000.Pp 2001. 2002 memset(&attrList, 0, sizeof(attrList)); 2003 attrList.bitmapcount = ATTR_BIT_MAP_COUNT; 2004 attrList.commonattr = ATTR_CMN_OBJTYPE | ATTR_CMN_FNDRINFO; 2005.Pp 2006 2007 err = getattrlist(path, &attrList, &attrBuf, sizeof(attrBuf), 0); 2008 if (err != 0) { 2009 err = errno; 2010 } 2011.Pp 2012 2013 if (err == 0) { 2014 assert(attrBuf.length == sizeof(attrBuf)); 2015.Pp 2016 2017 printf("Finder information for %s:\en", path); 2018 switch (attrBuf.objType) { 2019 case VREG: 2020 printf("file type = '%.4s'\en", &attrBuf.finderInfo[0]); 2021 printf("file creator = '%.4s'\en", &attrBuf.finderInfo[4]); 2022 break; 2023 case VDIR: 2024 printf("directory\en"); 2025 break; 2026 default: 2027 printf("other object type, %d\en", attrBuf.objType); 2028 break; 2029 } 2030 } 2031.Pp 2032. 2033 return err; 2034} 2035.Ed 2036.Pp 2037. 2038The following code is an alternative implementation that uses nested structures 2039to group the related attributes. 2040. 2041.Bd -literal 2042#include <assert.h> 2043#include <stdio.h> 2044#include <stddef.h> 2045#include <string.h> 2046#include <sys/attr.h> 2047#include <sys/errno.h> 2048#include <unistd.h> 2049#include <sys/vnode.h> 2050.Pp 2051. 2052typedef struct attrlist attrlist_t; 2053.Pp 2054. 2055struct FInfo2CommonAttrBuf { 2056 fsobj_type_t objType; 2057 char finderInfo[32]; 2058} __attribute__((aligned(4), packed)); 2059typedef struct FInfo2CommonAttrBuf FInfo2CommonAttrBuf; 2060.Pp 2061. 2062struct FInfo2AttrBuf { 2063 u_int32_t length; 2064 FInfo2CommonAttrBuf common; 2065} __attribute__((aligned(4), packed));; 2066typedef struct FInfo2AttrBuf FInfo2AttrBuf; 2067.Pp 2068. 2069static int FInfo2Demo(const char *path) 2070{ 2071 int err; 2072 attrlist_t attrList; 2073 FInfo2AttrBuf attrBuf; 2074.Pp 2075. 2076 memset(&attrList, 0, sizeof(attrList)); 2077 attrList.bitmapcount = ATTR_BIT_MAP_COUNT; 2078 attrList.commonattr = ATTR_CMN_OBJTYPE | ATTR_CMN_FNDRINFO; 2079.Pp 2080. 2081 err = getattrlist(path, &attrList, &attrBuf, sizeof(attrBuf), 0); 2082 if (err != 0) { 2083 err = errno; 2084 } 2085.Pp 2086. 2087 if (err == 0) { 2088 assert(attrBuf.length == sizeof(attrBuf)); 2089.Pp 2090. 2091 printf("Finder information for %s:\en", path); 2092 switch (attrBuf.common.objType) { 2093 case VREG: 2094 printf( 2095 "file type = '%.4s'\en", 2096 &attrBuf.common.finderInfo[0] 2097 ); 2098 printf( 2099 "file creator = '%.4s'\en", 2100 &attrBuf.common.finderInfo[4] 2101 ); 2102 break; 2103 case VDIR: 2104 printf("directory\en"); 2105 break; 2106 default: 2107 printf( 2108 "other object type, %d\en", 2109 attrBuf.common.objType 2110 ); 2111 break; 2112 } 2113 } 2114.Pp 2115. 2116 return err; 2117} 2118.Ed 2119.Pp 2120. 2121The following example shows how to deal with variable length attributes. 2122It assumes that the volume specified by 2123.Fa path 2124supports the necessary attributes. 2125. 2126.Bd -literal 2127#include <assert.h> 2128#include <stdio.h> 2129#include <stddef.h> 2130#include <string.h> 2131#include <sys/attr.h> 2132#include <sys/errno.h> 2133#include <unistd.h> 2134#include <sys/vnode.h> 2135.Pp 2136. 2137typedef struct attrlist attrlist_t; 2138.Pp 2139. 2140struct VolAttrBuf { 2141 u_int32_t length; 2142 u_int32_t fileCount; 2143 u_int32_t dirCount; 2144 attrreference_t mountPointRef; 2145 attrreference_t volNameRef; 2146 char mountPointSpace[MAXPATHLEN]; 2147 char volNameSpace[MAXPATHLEN]; 2148} __attribute__((aligned(4), packed)); 2149typedef struct VolAttrBuf VolAttrBuf; 2150.Pp 2151. 2152static int VolDemo(const char *path) 2153{ 2154 int err; 2155 attrlist_t attrList; 2156 VolAttrBuf attrBuf; 2157.Pp 2158. 2159 memset(&attrList, 0, sizeof(attrList)); 2160 attrList.bitmapcount = ATTR_BIT_MAP_COUNT; 2161 attrList.volattr = ATTR_VOL_INFO 2162 | ATTR_VOL_FILECOUNT 2163 | ATTR_VOL_DIRCOUNT 2164 | ATTR_VOL_MOUNTPOINT 2165 | ATTR_VOL_NAME; 2166.Pp 2167 2168 err = getattrlist(path, &attrList, &attrBuf, sizeof(attrBuf), 0); 2169 if (err != 0) { 2170 err = errno; 2171 } 2172.Pp 2173 2174 if (err == 0) { 2175 assert(attrBuf.length > offsetof(VolAttrBuf, mountPointSpace)); 2176 assert(attrBuf.length <= sizeof(attrBuf)); 2177.Pp 2178 2179 printf("Volume information for %s:\en", path); 2180 printf("ATTR_VOL_FILECOUNT: %u\en", attrBuf.fileCount); 2181 printf("ATTR_VOL_DIRCOUNT: %u\en", attrBuf.dirCount); 2182 printf( 2183 "ATTR_VOL_MOUNTPOINT: %.*s\en", 2184 (int) attrBuf.mountPointRef.attr_length, 2185 ( ((char *) &attrBuf.mountPointRef) 2186 + attrBuf.mountPointRef.attr_dataoffset ) 2187 ); 2188 printf( 2189 "ATTR_VOL_NAME: %.*s\en", 2190 (int) attrBuf.volNameRef.attr_length, 2191 ( ((char *) &attrBuf.volNameRef) 2192 + attrBuf.volNameRef.attr_dataoffset ) 2193 ); 2194 } 2195.Pp 2196. 2197 return err; 2198} 2199.Ed 2200.Pp 2201The following sample demonstrates the need to use packing and alignment 2202controls; without the attribute, in 64-bit code, the fields of the structure are not 2203placed at the locations that the kernel expects. 2204. 2205.Bd -literal 2206#include <stdio.h> 2207#include <stdlib.h> 2208#include <unistd.h> 2209#include <string.h> 2210#include <err.h> 2211#include <time.h> 2212#include <sys/attr.h> 2213.Pp 2214/* The alignment and packing attribute is necessary in 64-bit code */ 2215struct AttrListTimes { 2216 u_int32_t length; 2217 struct timespec st_crtime; 2218 struct timespec st_modtime; 2219} __attribute__((aligned(4), packed)); 2220.Pp 2221main(int argc, char **argv) 2222{ 2223 int rv; 2224 int i; 2225.Pp 2226 for (i = 1; i < argc; i++) { 2227 struct attrlist attrList; 2228 struct AttrListTimes myStat = {0}; 2229 char *path = argv[i]; 2230.Pp 2231 memset(&attrList, 0, sizeof(attrList)); 2232 attrList.bitmapcount = ATTR_BIT_MAP_COUNT; 2233 attrList.commonattr = ATTR_CMN_CRTIME | 2234 ATTR_CMN_MODTIME; 2235.Pp 2236 rv = getattrlist(path, &attrList, &myStat, sizeof(myStat), 0); 2237.Pp 2238 if (rv == -1) { 2239 warn("getattrlist(%s)", path); 2240 continue; 2241 } 2242 printf("%s: Modification time = %s", argv[i], ctime(&myStat.st_modtime.tv_sec)); 2243 } 2244 return 0; 2245} 2246.Ed 2247.Pp 2248 The getLinkIDInfo() function determines if ATTR_CMNEXT_LINKID and ATTR_CMN_OBJID 2249 are valid to use on the file system specified by path. 2250. 2251.Bd -literal 2252int getLinkIDInfo(const char *path, bool *cmnExtLinkIDValid, bool *cmnObjIDValid) 2253{ 2254 int result; 2255 struct statfs statfsBuf; 2256 struct attrlist attrList; 2257 struct volAttrsBuf { 2258 u_int32_t length; 2259 vol_capabilities_attr_t capabilities; 2260 vol_attributes_attr_t attributes; 2261 } __attribute__((aligned(4), packed)); 2262 struct volAttrsBuf volAttrs; 2263.Pp 2264 memset(&attrList, 0, sizeof(attrList)); 2265 attrList.bitmapcount = ATTR_BIT_MAP_COUNT; 2266 attrList.volattr = ATTR_VOL_INFO | ATTR_VOL_CAPABILITIES | ATTR_VOL_ATTRIBUTES; 2267 // get the file system's mount point path for the input path 2268 result = statfs(path, &statfsBuf); 2269 if ( result == 0 ) { 2270 // get the supported capabilities and attributes 2271 result = getattrlist(statfsBuf.f_mntonname, &attrList, &volAttrs, sizeof(volAttrs), FSOPT_ATTR_CMN_EXTENDED); 2272 if ( result == 0 ) { 2273 if ( volAttrs.attributes.validattr.forkattr & ATTR_CMNEXT_LINKID ) { 2274 // ATTR_CMNEXT_LINKID is available; do not use ATTR_CMN_OBJID 2275 *cmnExtLinkIDValid = true; 2276 *cmnObjIDValid = false; 2277 } 2278 else { 2279 // ATTR_CMNEXT_LINKID is not available 2280 cmnExtLinkIDValid = false; 2281 // ATTR_CMN_OBJID can only be used if the file system does not use 64-bit object IDs 2282 if ( (volAttrs.capabilities.capabilities[VOL_CAPABILITIES_FORMAT] & VOL_CAP_FMT_64BIT_OBJECT_IDS) && (volAttrs.capabilities.valid[VOL_CAPABILITIES_FORMAT] & VOL_CAP_FMT_64BIT_OBJECT_IDS) ) { 2283 *cmnObjIDValid = false; 2284 } 2285 else { 2286 *cmnObjIDValid = true; 2287 } 2288 } 2289 } 2290 } 2291 if ( result != 0 ) { 2292 *cmnExtLinkIDValid = *cmnObjIDValid = false; 2293 } 2294 return result; 2295} 2296.Ed 2297.Pp 2298. 2299.Sh SEE ALSO 2300. 2301.Xr access 2 , 2302.Xr chflags 2 , 2303.Xr exchangedata 2 , 2304.Xr fcntl 2 , 2305.Xr getattrlistbulk 2 , 2306.Xr mount 2 , 2307.Xr searchfs 2 , 2308.Xr setattrlist 2 , 2309.Xr stat 2 , 2310.Xr statfs 2 2311. 2312.Sh HISTORY 2313A 2314.Fn getattrlist 2315function call appeared in Darwin 1.3.1 (Mac OS X version 10.0). 2316The 2317.Fn getattrlistat 2318function call appeared in OS X 10.10 . 2319