1 .\" Copyright (c) 2003 Apple Computer, Inc. All rights reserved.
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.
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.
26 .Nd get file system attributes
28 .Fd #include <sys/attr.h>
29 .Fd #include <unistd.h>
31 .Fn getattrlist "const char* path" "struct attrlist * attrList" "void * attrBuf" "size_t attrBufSize" "unsigned long options"
34 .Fn fgetattrlist "int fd" "struct attrlist * attrList" "void * attrBuf" "size_t attrBufSize" "unsigned long options"
37 .Fa "int fd" "const char *path" "struct attrlist * attrList" "void * attrBuf"
38 .Fa "size_t attrBufSize" "unsigned long options"
43 function returns attributes (that is, metadata) of file system objects.
45 works on the file system object named by
49 works on the provided file descriptor
54 system call is equivalent to
56 except in the case where
58 specifies a relative path.
59 In this case the attributes are returned for the file system object named by
60 path relative to the directory associated with the file descriptor
62 instead of the current working directory.
65 is passed the special value
69 parameter, the current working directory is used and the behavior is
70 identical to a call to
75 as a seriously enhanced version of
77 The functions return attributes about the specified file system object
78 into the buffer specified by
84 parameter determines what attributes are returned.
87 parameter lets you control specific aspects of the function's behavior.
90 Not all volumes support all attributes.
92 .Dv ATTR_VOL_ATTRIBUTES
93 for a discussion of how to determine whether a particular volume supports a
96 Furthermore, you should only request the attributes that you need.
97 Some attributes are expensive to calculate on some volume formats.
99 .Dv ATTR_DIR_ENTRYCOUNT
100 is usually expensive to calculate on non-HFS [Plus] volumes.
101 If you don't need a particular attribute, you should not ask for it.
108 parameter must reference a valid file system object.
109 Read, write or execute permission of the object itself is not required, but
110 all directories listed in the path name leading to the object must be
114 .\" attrList parameter
118 parameter is a pointer to an
120 structure, as defined by
123 It determines what attributes are returned by the function.
124 You are responsible for filling out all fields of this structure before calling the function.
126 typedef u_int32_t attrgroup_t;
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 */
137 #define ATTR_BIT_MAP_COUNT 5
141 .\" attrlist elements
145 structure are defined as follows.
146 .Bl -tag -width XXXbitmapcount
149 Number of attribute bit sets in the structure.
150 In current systems you must set this to
151 .Dv ATTR_BIT_MAP_COUNT .
155 You must set this to 0.
158 A bit set that specifies the common attributes that you require.
159 Common attributes relate to all types of file system objects.
160 See below for a description of these attributes.
163 A bit set that specifies the volume attributes that you require.
164 Volume attributes relate to volumes (that is, mounted file systems).
165 See below for a description of these attributes.
166 If you request volume attributes,
168 must reference the root of a volume.
169 In addition, you can't request volume attributes if you also request
170 file or directory attributes.
173 A bit set that specifies the directory attributes that you require.
174 See below for a description of these attributes.
177 A bit set that specifies the file attributes that you require.
178 See below for a description of these attributes.
181 A bit set that specifies the fork attributes that you require.
182 Fork attributes relate to the actual data in the file,
183 which can be held in multiple named contiguous ranges, or forks.
184 See below for a description of these attributes.
185 If the FSOPT_ATTR_CMN_EXTENDED option is given, this bit set is reinterpreted
186 as extended common attributes attributes, also described below.
191 Unless otherwise noted in the lists below, attributes are read-only.
192 Attributes labelled as read/write can be set using
196 .\" attrBuf and attrBufSize parameters
202 parameters specify a buffer into which the function places attribute values.
203 The format of this buffer is sufficiently complex that its description
204 requires a separate section (see below).
205 The initial contents of this buffer are ignored.
212 parameter is a bit set that controls the behaviour of
214 The following option bits are defined.
216 .Bl -tag -width FSOPT_PACK_INVAL_ATTRS
221 will not follow a symlink if it occurs as
222 the last component of
225 .It FSOPT_REPORT_FULLSIZE
226 The size of the attributes reported (in the first
228 field in the attribute buffer) will be the size needed to hold all the
229 requested attributes; if not set, only the attributes actually returned
230 will be reported. This allows the caller to determine if any truncation
233 .It FSOPT_PACK_INVAL_ATTRS
234 If this is bit is set, then all requested attributes, even ones that are
235 not supported by the object or file system, will be returned. Default values
236 will be used for the invalid ones. Requires that
237 .Dv ATTR_CMN_RETURNED_ATTRS
240 .It FSOPT_ATTR_CMN_EXTENDED
241 If this is bit is set, then
242 .Dv ATTR_CMN_GEN_COUNT
244 .Dv ATTR_CMN_DOCUMENT_ID
245 can be requested. When this option is used, forkattrs are reinterpreted as a
246 set of extended common attributes.
248 .It FSOPT_RETURN_REALDEV
249 If this is bit is set, then ATTR_CMN_DEVID and ATTR_CMN_FSID will return
250 the values corresponding to the physical volume they are on. When a
251 filesystem supports VOL_CAP_INT_VOLUME_GROUPS, it is possible that the
252 filesystem may return a common logical value for these attributes otherwise.
258 The data returned in the buffer described by
262 is formatted as follows.
268 The first element of the buffer is a
270 that contains the overall length, in bytes, of the attributes returned.
271 This size includes the length field itself.
274 Following the length field is a list of attributes.
275 Each attribute is represented by a field of its type,
276 where the type is given as part of the attribute description (below).
279 The attributes are placed into the attribute buffer in the order
280 that they are described below.
283 Each attribute is aligned to a 4-byte boundary (including 64-bit data types).
287 If the attribute is of variable length, it is represented
290 structure, as defined by
295 typedef struct attrreference {
296 int32_t attr_dataoffset;
297 u_int32_t attr_length;
302 This structure contains a 'pointer' to the variable length attribute data.
305 field is the length of the attribute data (in bytes).
308 field is the offset in bytes from the
311 to the attribute data.
312 This offset will always be a multiple of sizeof(u_int32_t) bytes,
313 so you can safely access common data types without fear of alignment
319 function will silently truncate attribute data if
322 The length field at the front of the attribute list always represents
323 the length of the data actually copied into the attribute buffer.
324 If the data is truncated, there is no easy way to determine the
325 buffer size that's required to get all of the requested attributes.
326 You should always pass an
328 that is large enough to accommodate the known size of the attributes
329 in the attribute list (including the leading length field).
332 Because the returned attributes are simply truncated if the buffer is
333 too small, it's possible for a variable length attribute to reference
334 data beyond the end of the attribute buffer. That is, it's possible
335 for the attribute data to start beyond the end of the attribute buffer
339 .Vt attrreference_t ,
348 ) ) or, indeed, for the attribute data to extend beyond the end of the attribute buffer (that is,
360 If this happens you must increase the size of the buffer and call
362 to get an accurate copy of the attribute.
364 .Sh COMMON ATTRIBUTES
366 Common attributes relate to all types of file system objects.
367 The following common attributes are defined.
369 .Bl -tag -width ATTR_VOL_ALLOCATIONCLUMP
371 .It ATTR_CMN_RETURNED_ATTRS
374 structure which is used to report which of the requested attributes
375 were actually returned. This attribute, when requested, will always
376 be the first attribute returned. By default, unsupported attributes
377 will be skipped (i.e. not packed into the output buffer). This behavior
378 can be over-ridden using the FSOPT_PACK_INVAL_ATTRS option flag. Both
379 .Xr getattrlist 2 and
380 .Xr getatttrlistbulk 2 support this attribute while
381 .Xr searchfs 2 does not.
386 structure containing the name of the file system object as
387 UTF-8 encoded, null terminated C string.
388 The attribute data length will not be greater than
390 + 1 characters, which is
392 * 3 + 1 bytes (as one UTF-8-encoded character may
393 take up to three bytes).
399 containing the device number of the device on which this
400 file system object's volume is mounted.
405 structure returned by
411 structure containing the file system identifier for the volume on which
412 the file system object resides.
417 structure returned by
423 that identifies the type of file system object.
424 The values are taken from
432 that identifies the type of file system containing the object.
433 The values are taken from
441 structure that uniquely identifies the file system object within a mounted
442 volume for the duration of its mount; this identifier is not guaranteed to be
443 persistent for the volume and may change every time the volume is mounted.
445 On HFS+ volumes, the ATTR_CMN_OBJID of a file system object is distinct from
446 the ATTR_CMN_OBJID of any hard link to that file system object. Although the
447 ATTR_CMN_OBJID of a file system object may appear similar (in whole
448 or in part) to it's ATTR_CMN_FILEID (see description of ATTR_CMN_FILEID below),
449 \fBno relation between the two attributes should ever be implied.\fP
451 ATTR_CMN_OBJID is deprecated sarting with macOS 10.13, iOS 11.0, watchOS 4.0 and
452 tvOS 11.0 and ATTR_CMNEXT_LINKID should be used in its place.
453 ATTR_CMN_OBJID can only be used on older operating systems only if the file
454 system doesn't 64 bit IDs. See the
456 function in the EXAMPLES section.
458 .It ATTR_CMN_OBJPERMANENTID
461 structure that uniquely and persistently identifies the file system object
462 within its volume; persistence implies that this attribute is unaffected by
463 mount/unmount operations on the volume.
465 Some file systems can not return this attribute when the volume is mounted
466 read-only and will fail the request with error
469 (e.g. original HFS modifies on disk structures to generate persistent
470 identifiers, and hence cannot do so if the volume is mounted read only.)
472 .It ATTR_CMN_PAROBJID
475 structure that uniquely identifies the parent directory of the file system
476 object within a mounted volume, for the duration of the volume mount; this
477 identifier is not guaranteed to be persistent for the volume and may change
478 every time the volume is mounted.
481 If a file system object is hard linked from multiple directories, the parent
482 directory returned for this attribute is non deterministic; it can be any one
483 of the parent directories of this object.
485 For some volume formats the computing cost for this attribute is significant;
486 developers are advised to request this attribute sparingly.
491 containing a text encoding hint for
492 the file system object's name.
493 It is included to facilitate the lossless round trip conversion of names between
494 Unicode and traditional Mac OS script encodings.
495 File systems that do not have an appropriate text encoding value should return
496 kTextEncodingMacUnicode.
501 structure containing the time that the file system object
507 structure containing the time that the file system object
513 structure returned by
519 structure containing the time that the file system object's
520 attributes were last modified.
525 structure returned by
531 structure containing the time that the file system object
537 structure returned by
540 .It ATTR_CMN_BKUPTIME
543 structure containing the time that the file system object was
545 This value is for use by backup utilities.
546 The file system stores but does not interpret the value.
548 .It ATTR_CMN_FNDRINFO
549 (read/write) 32 bytes of data for use by the Finder.
550 Equivalent to the concatenation of a
555 (or, for directories, a
558 .Vt ExtendedFolderInfo
561 This attribute is not byte swapped by the file system.
562 The value of multibyte fields on disk is always big endian.
563 When running on a little endian system (such as Darwin on x86),
564 you must byte swap any multibyte fields.
569 containing the owner of the file system object.
574 structure returned by
580 containing the group of the file system object.
585 structure returned by
588 .It ATTR_CMN_ACCESSMASK
591 containing the access permissions of the file system object.
596 structure returned by
598 Only the permission bits of
600 are valid; other bits should be ignored,
601 e.g., by masking with
607 containing file flags.
612 structure returned by
614 For more information about these flags, see
617 .It ATTR_CMN_GEN_COUNT
620 containing a non zero monotonically increasing generation
621 count for this file system object. The generation count tracks
622 the number of times the data in a file system object has been
623 modified. No meaning can be implied from its value. The
624 value of the generation count for a file system object can
625 be compared against a previous value of the same file system
626 object for equality; i.e. an unchanged generation
627 count indicates identical data. Requesting this attribute requires the
628 FSOPT_ATTR_CMN_EXTENDED option flag.
631 A generation count value of 0 is invalid and cannot be used to
632 determine data change.
634 The generation count is invalid while a file is mmap'ed. An invalid
635 generation count value of 0 will be returned for mmap'ed files.
637 .It ATTR_CMN_DOCUMENT_ID
640 containing the document id. The document id is a value assigned
641 by the kernel to a document (which can be a file or directory)
642 and is used to track the data regardless of where it gets moved.
643 The document id survives safe saves; i.e it is sticky to the path it
644 was assigned to. Requesting this attribute requires the
645 FSOPT_ATTR_CMN_EXTENDED option flag.
647 A document id of 0 is invalid.
649 .It ATTR_CMN_USERACCESS
652 containing the effective permissions of the current user
653 (the calling process's effective UID) for this file system object.
654 You can test for read, write, and execute permission using
664 .It ATTR_CMN_EXTENDED_SECURITY
665 A variable-length object (thus an
667 structure) containing a
669 structure, of which only the ACL entry is used.
674 of the owner of the file system object. Analoguous to
675 .Dv ATTR_CMN_OWNERID .
680 of the group to which the file system object belongs.
687 that uniquely identifies the file system object within its mounted volume.
692 structure returned by
695 .It ATTR_CMN_PARENTID
698 that identifies the parent directory of the file system object.
700 .It ATTR_CMN_FULLPATH
703 structure containing the full path (resolving all symlinks) to
704 the file system object as
705 a UTF-8 encoded, null terminated C string.
706 The attribute data length will not be greater than
708 Inconsistent behavior may be observed when this attribute is requested on
709 hard-linked items, particularly when the file system does not support ATTR_CMN_PARENTID
710 natively. Callers should be aware of this when requesting the full path of a hard-linked item.
712 .It ATTR_CMN_ADDEDTIME
715 that contains the time that the file system object was created or renamed into
716 its containing directory. Note that inconsistent behavior may be observed
717 when this attribute is requested on hard-linked items.
719 .It ATTR_CMN_DATA_PROTECT_FLAGS
722 that contains the file or directory's data protection class.
727 .Sh VOLUME ATTRIBUTES
729 Volume attributes relate to volumes (that is, mounted file systems).
730 The following volume attributes are defined.
732 .Bl -tag -width ATTR_VOL_ALLOCATIONCLUMP
735 For reasons that are not at all obvious, you must set
739 field if you request any other volume attributes.
740 This does not result in any attribute data being added to the attribute buffer.
745 containing the file system type.
750 structure returned by
752 Generally not a useful value.
754 .It ATTR_VOL_SIGNATURE
757 containing the volume signature word.
758 This value is unique within a given file system type and lets you
759 distinguish between different volume formats handled by the same file system.
764 containing the total size of the volume in bytes.
766 .It ATTR_VOL_SPACEFREE
769 containing the free space on the volume in bytes.
771 .It ATTR_VOL_SPACEAVAIL
774 containing the space, in bytes, on the volume available to non-privileged processes.
775 This is the free space minus the amount of space reserved by the system to prevent critical
776 disk exhaustion errors.
777 Non-privileged programs, like a disk management tool, should use this value to display the
778 space available to the user.
780 .Dv ATTR_VOL_SPACEAVAIL
782 .Dv ATTR_VOL_SPACEFREE
790 .It ATTR_VOL_MINALLOCATION
793 containing the minimum allocation size on the volume in bytes.
794 If you create a file containing one byte, it will consume this much space.
796 .It ATTR_VOL_ALLOCATIONCLUMP
799 containing the allocation clump size on the volume, in bytes.
800 As a file is extended, the file system will attempt to allocate
801 this much space each time in order to reduce fragmentation.
803 .It ATTR_VOL_IOBLOCKSIZE
806 containing the optimal block size when reading or writing data.
811 structure returned by
814 .It ATTR_VOL_OBJCOUNT
817 containing the number of file system objects on the volume.
819 .It ATTR_VOL_FILECOUNT
822 containing the number of files on the volume.
824 .It ATTR_VOL_DIRCOUNT
827 containing the number of directories on the volume.
829 .It ATTR_VOL_MAXOBJCOUNT
832 containing the maximum number of file system objects that can be stored on the volume.
834 .It ATTR_VOL_MOUNTPOINT
837 structure containing the path to the volume's mount point as a
838 UTF-8 encoded, null terminated C string.
839 The attribute data length will not be greater than
845 structure returned by
851 structure containing the name of the volume as a
852 UTF-8 encoded, null terminated C string.
853 The attribute data length will not be greater than
858 This attribute is only read/write if the
859 .Dv VOL_CAP_INT_VOL_RENAME
860 bit is set in the volume capabilities (see below).
863 .It ATTR_VOL_MOUNTFLAGS
866 containing the volume mount flags.
867 This is a copy of the value passed to the
871 when the volume was mounted.
876 structure returned by
879 .It ATTR_VOL_MOUNTEDDEVICE
882 structure that returns the same value as the
886 structure returned by
888 For local volumes this is the path to the device on which the volume is mounted as a
889 UTF-8 encoded, null terminated C string.
890 For network volumes, this is a unique string that identifies the mount.
891 The attribute data length will not be greater than
895 .It ATTR_VOL_ENCODINGSUSED
897 .Vt unsigned long long
898 containing a bitmap of the text encodings used on this volume.
899 For more information about this, see the discussion of
901 in DTS Technote 1150 "HFS Plus Volume Format".
903 .It ATTR_VOL_CAPABILITIES
905 .Vt vol_capabilities_attr_t
906 structure describing the optional features supported by this volume.
907 See below for a discussion of volume capabilities.
912 containing the file system UUID. Typically this will be a
915 .It ATTR_VOL_QUOTA_SIZE
918 containing the maximum size of the volume in bytes.
920 .It ATTR_VOL_RESERVED_SIZE
923 containing the minimum size of the volume in bytes.
925 .It ATTR_VOL_ATTRIBUTES
927 .Vt vol_attributes_attr_t
928 structure describing the attributes supported by this volume.
929 This structure is discussed below, along with volume capabilities.
933 .Sh DIRECTORY ATTRIBUTES
935 The following directory attributes are defined.
937 .Bl -tag -width ATTR_VOL_ALLOCATIONCLUMP
939 .It ATTR_DIR_LINKCOUNT
942 containing the number of hard links to the directory;
943 this does not include the historical "." and ".." entries.
944 For file systems that do not support hard links to directories,
945 this value will be 1.
947 .It ATTR_DIR_ENTRYCOUNT
950 containing the number of file system objects in the directory, not including
951 any synthetic items. The historical "." and ".." entries are also
952 excluded from this count.
954 .It ATTR_DIR_MOUNTSTATUS
957 containing flags describing what's mounted on the directory.
958 Currently the only flag defined is
959 .Dv DIR_MNTSTATUS_MNTPOINT,
960 which indicates that there is a file system mounted on this directory.
962 .It ATTR_DIR_ALLOCSIZE
965 containing the number of bytes on disk used by the directory
968 .It ATTR_DIR_IOBLOCKSIZE
971 containing the optimal block size when reading or writing data.
973 .It ATTR_DIR_DATALENGTH
976 containing the length of the directory in bytes (the logical size).
980 Requested directory attributes are not returned for file system objects that
985 The following file attributes are defined.
987 .Bl -tag -width ATTR_VOL_ALLOCATIONCLUMP
989 .It ATTR_FILE_LINKCOUNT
992 containing the number of hard links to this file.
997 structure returned by
1000 .It ATTR_FILE_TOTALSIZE
1003 containing the total number of bytes in all forks of the file (the logical size).
1005 .It ATTR_FILE_ALLOCSIZE
1008 containing a count of the bytes on disk used by all of the file's forks (the physical size).
1010 .It ATTR_FILE_IOBLOCKSIZE
1013 containing the optimal block size when reading or writing this file's data.
1015 .It ATTR_FILE_CLUMPSIZE
1018 containing the allocation clump size for this file, in bytes.
1019 As the file is extended, the file system will attempt to allocate
1020 this much space each time in order to reduce fragmentation.
1021 This value applies to the data fork.
1023 .It ATTR_FILE_DEVTYPE
1026 containing the device type for a special device file.
1031 structure returned by
1034 .It ATTR_FILE_FILETYPE
1037 that whose value is reserved.
1038 Clients should ignore its value.
1039 New volume format implementations should not support this attribute.
1041 .It ATTR_FILE_FORKCOUNT
1044 containing the number of forks in the file.
1045 No built-in file systems on Mac OS X currently support forks other
1046 than the data and resource fork.
1048 .It ATTR_FILE_FORKLIST
1051 structure containing a list of named forks of the file.
1052 No built-in file systems on Mac OS X currently support forks
1053 other than the data and resource fork.
1054 Because of this, the structure of this attribute's value is not yet defined.
1056 .It ATTR_FILE_DATALENGTH
1059 containing the length of the data fork in bytes (the logical size).
1061 .It ATTR_FILE_DATAALLOCSIZE
1064 containing a count of the bytes on disk used by the data fork (the physical size).
1066 .It ATTR_FILE_DATAEXTENTS
1069 array for the data fork.
1070 The array contains eight
1072 structures which represent the first
1073 eight extents of the fork.
1075 This attributes exists for compatibility reasons.
1076 New clients should not use this attribute.
1077 Rather, they should use the
1083 In current implementations the value may not be entirely accurate for
1084 a variety of reasons.
1086 .It ATTR_FILE_RSRCLENGTH
1089 containing the length of the resource fork in bytes (the logical size).
1091 .It ATTR_FILE_RSRCALLOCSIZE
1094 containing a count of the bytes on disk used by the resource fork (the physical size).
1096 .It ATTR_FILE_RSRCEXTENTS
1099 array for the resource fork.
1100 The array contains eight
1102 structures which represent the first
1103 eight extents of the fork.
1106 .Dv ATTR_FILE_DATAEXTENTS .
1111 File attributes are used for any file system object that is not a directory,
1112 not just ordinary files.
1113 Requested file attributes are not returned for file system objects that
1118 Fork attributes relate to the actual data in the file,
1119 which can be held in multiple named contiguous ranges, or forks.
1120 These cannot be used if the FSOPT_ATTR_CMN_EXTENDED is given.
1121 The following fork attributes are defined.
1123 .Bl -tag -width ATTR_VOL_ALLOCATIONCLUMP
1125 .It ATTR_FORK_TOTALSIZE
1129 containing the length of the fork in bytes (the logical size).
1131 .It ATTR_FORK_ALLOCSIZE
1135 containing a count of the bytes on disk used by the fork (the physical size).
1137 .It ATTR_FORK_RESERVED
1139 You must set this to 0.
1144 Fork attributes are deprecated and all bits are reserved.
1145 They are not properly implemented by any current Mac OS X
1146 volume format implementation.
1147 We strongly recommend that client programs do not request fork attributes.
1148 If you are implementing a volume format, you should not support these attributes.
1150 .Sh COMMON EXTENDED ATTRIBUTES
1152 Common extended attributes are like common attributes except that they are set
1153 in the forkattr field and can only be used if the FSOPT_ATTR_CMN_EXTENDED
1154 option is given. Use of these attributes is mutually exclusive with the above
1157 .Bl -tag -width ATTR_VOL_ALLOCATIONCLUMP
1159 .It ATTR_CMNEXT_RELPATH
1162 structure containing the mount-relative path of
1163 the file system object as
1164 a UTF-8 encoded, null terminated C string.
1165 The attribute data length will not be greater than
1167 Inconsistent behavior may be observed when this attribute is requested on
1168 hard-linked items, particularly when the file system does not support
1169 ATTR_CMN_PARENTID natively. Callers should be aware of this when requesting the
1170 relative path of a hard-linked item.
1172 .It ATTR_CMNEXT_PRIVATESIZE
1175 containing the number of bytes that are \fBnot\fP trapped inside a clone
1176 or snapshot, and which would be freed immediately if the file were deleted.
1178 .It ATTR_CMNEXT_LINKID
1181 that uniquely identifies the file system object within a mounted volume for the
1182 duration of its mount.
1184 On HFS+ and APFS volumes, the ATTR_CMNEXT_LINKID of a file system
1185 object is distinct from the ATTR_CMNEXT_LINKID of any hard link to that file
1186 system object. Although the ATTR_CMNEXT_LINKID of a file system object may appear
1187 similar (in whole or in part) to its ATTR_CMN_FILEID (see description of
1188 ATTR_CMN_FILEID above), \fBno relation between the two attributes should ever be implied.\fP
1190 .It ATTR_CMNEXT_NOFIRMLINKPATH
1193 structure containing a path that does not have firmlinks of
1194 the file system object as
1195 a UTF-8 encoded, null terminated C string.
1196 The attribute data length will not be greater than
1198 Inconsistent behavior may be observed when this attribute is requested on
1199 hard-linked items, particularly when the file system does not support
1200 ATTR_CMN_PARENTID natively. Callers should be aware of this when requesting the
1201 canonical path of a hard-linked item.
1202 .It ATTR_CMNEXT_REALDEVID
1205 containing the real device number of the device on which this
1206 file system object's volume is mounted.
1211 structure returned by
1214 .It ATTR_CMNEXT_REALFSID
1217 structure containing the real file system identifier for the volume on which
1218 the file system object resides.
1223 structure returned by
1227 .Sh VOLUME CAPABILITIES
1229 .\" vol_capabilities_attr_t
1231 Not all volumes support all features.
1233 .Dv ATTR_VOL_CAPABILITIES
1235 .Vt vol_capabilities_attr_t
1236 structure (shown below) that indicates which features are supported by the volume.
1239 typedef u_int32_t vol_capabilities_set_t[4];
1242 #define VOL_CAPABILITIES_FORMAT 0
1243 #define VOL_CAPABILITIES_INTERFACES 1
1244 #define VOL_CAPABILITIES_RESERVED1 2
1245 #define VOL_CAPABILITIES_RESERVED2 3
1248 typedef struct vol_capabilities_attr {
1249 vol_capabilities_set_t capabilities;
1250 vol_capabilities_set_t valid;
1251 } vol_capabilities_attr_t;
1255 The structure contains two fields,
1259 Each consists of an array of four elements.
1260 The arrays are indexed by the following values.
1262 .Bl -tag -width VOL_CAP_FMT_PERSISTENTOBJECTIDS
1264 .It VOL_CAPABILITIES_FORMAT
1265 This element contains information about the volume format.
1267 .Dv VOL_CAP_FMT_PERSISTENTOBJECTIDS
1270 .It VOL_CAPABILITIES_INTERFACES
1271 This element contains information about which optional functions are
1272 supported by the volume format implementation.
1274 .Dv VOL_CAP_INT_SEARCHFS
1277 .It VOL_CAPABILITIES_RESERVED1
1279 A file system implementation should set this element to zero.
1280 A client program should ignore this element.
1282 .It VOL_CAPABILITIES_RESERVED2
1284 A file system implementation should set this element to zero.
1285 A client program should ignore this element.
1292 field contains bit sets that indicate which flags are known to the volume format
1294 Each bit indicates whether the contents of the corresponding bit in the
1301 field contains bit sets that indicate whether a particular feature is implemented
1302 by this volume format.
1305 The following bits are defined in the first element (indexed by
1306 .Dv VOL_CAPABILITIES_FORMAT )
1312 .Vt vol_capabilities_attr_t
1315 .Bl -tag -width VOL_CAP_FMT_PERSISTENTOBJECTIDS
1317 .It VOL_CAP_FMT_PERSISTENTOBJECTIDS
1318 If this bit is set the volume format supports persistent object identifiers
1319 and can look up file system objects by their IDs.
1321 .Dv ATTR_CMN_OBJPERMANENTID
1322 for details about how to obtain these identifiers.
1324 .It VOL_CAP_FMT_SYMBOLICLINKS
1325 If this bit is set the volume format supports symbolic links.
1327 .It VOL_CAP_FMT_HARDLINKS
1328 If this bit is set the volume format supports hard links.
1330 .It VOL_CAP_FMT_JOURNAL
1331 If this bit is set the volume format supports a journal used to
1332 speed recovery in case of unplanned restart (such as a power outage
1334 This does not necessarily mean the volume is actively using a journal.
1336 Introduced with Darwin 7.0 (Mac OS X version 10.3).
1338 .It VOL_CAP_FMT_JOURNAL_ACTIVE
1339 If this bit is set the volume is currently using a journal for
1340 speedy recovery after an unplanned restart.
1341 This bit can be set only if
1342 .Dv VOL_CAP_FMT_JOURNAL
1345 Introduced with Darwin 7.0 (Mac OS X version 10.3).
1347 .It VOL_CAP_FMT_NO_ROOT_TIMES
1348 If this bit is set the volume format does not store reliable times for
1349 the root directory, so you should not depend on them to detect changes,
1350 identify volumes across unmount/mount, and so on.
1352 Introduced with Darwin 7.0 (Mac OS X version 10.3).
1354 .It VOL_CAP_FMT_SPARSE_FILES
1355 If this bit is set the volume format supports sparse files,
1356 that is, files which can have 'holes' that have never been written
1357 to, and thus do not consume space on disk.
1358 A sparse file may have an allocated size on disk that is less than its logical length (that is,
1359 .Dv ATTR_FILE_ALLOCSIZE
1361 .Dv ATTR_FILE_TOTALSIZE ).
1364 Introduced with Darwin 7.0 (Mac OS X version 10.3).
1366 .It VOL_CAP_FMT_ZERO_RUNS
1367 For security reasons, parts of a file (runs) that have never been
1368 written to must appear to contain zeroes.
1369 When this bit is set, the volume keeps track of allocated but unwritten
1370 runs of a file so that it can substitute zeroes without actually
1371 writing zeroes to the media.
1372 This provides performance similar to sparse files, but not the space savings.
1374 Introduced with Darwin 7.0 (Mac OS X version 10.3).
1376 .It VOL_CAP_FMT_CASE_SENSITIVE
1377 If this bit is set the volume format treats upper and lower case
1378 characters in file and directory names as different.
1379 Otherwise an upper case character is equivalent to a lower case character,
1380 and you can't have two names that differ solely in the case of
1383 Introduced with Darwin 7.0 (Mac OS X version 10.3).
1385 .It VOL_CAP_FMT_CASE_PRESERVING
1386 If this bit is set the volume format preserves the case of
1387 file and directory names.
1388 Otherwise the volume may change the case of some characters
1389 (typically making them all upper or all lower case).
1391 .Dv VOL_CAP_FMT_CASE_SENSITIVE
1393 .Dv VOL_CAP_FMT_CASE_PRESERVING .
1395 Introduced with Darwin 7.0 (Mac OS X version 10.3).
1397 .It VOL_CAP_FMT_FAST_STATFS
1398 This bit is used as a hint to upper layers to
1401 is fast enough that its results need not be cached by the caller.
1402 A volume format implementation that caches the
1404 information in memory should set this bit.
1405 An implementation that must always read from disk or always perform a network
1406 transaction to satisfy
1408 should not set this bit.
1410 Introduced with Darwin 7.0 (Mac OS X version 10.3).
1412 .It VOL_CAP_FMT_2TB_FILESIZE
1413 If this bit is set the volume format supports file sizes larger
1414 than 4GB, and potentially up to 2TB; it does not indicate
1415 whether the file system supports files larger than that.
1417 Introduced with Darwin 8.0 (Mac OS X version 10.4).
1419 .It VOL_CAP_FMT_OPENDENYMODES
1420 If this bit is set, the volume format supports open deny modes
1421 (e.g., "open for read write, deny write").
1423 .It VOL_CAP_FMT_HIDDEN_FILES
1424 If this bit is set, the volume format supports the
1428 flag is mapped to that volume's native "hidden" or "invisible"
1429 bit (e.g., the invisible bit from the Finder Info extended attribute).
1431 .It VOL_CAP_FMT_PATH_FROM_ID
1432 If this bit is set, the volume format supports the ability to derive a pathname
1433 to the root of the file system given only the ID of an object. This also
1434 implies that object IDs on this file system are persistent and not recycled.
1435 Most file systems will not support this capability.
1437 .It VOL_CAP_FMT_NO_VOLUME_SIZES
1438 If this bit is set the volume format does not support
1439 determining values for total data blocks, available blocks, or free blocks, as in
1448 Historically, those values were set to 0xFFFFFFFF for volumes
1449 that did not support them.
1451 Introduced with Darwin 10.0 (Mac OS X version 10.6).
1453 .It VOL_CAP_FMT_64BIT_OBJECT_IDS
1454 If this bit is set, the volume format uses object IDs that are 64-bit.
1455 This means that ATTR_CMN_FILEID and ATTR_CMN_PARENTID are the primary means of
1456 obtaining object IDs from this volume. The values returned by ATTR_CMN_OBJID,
1457 ATTR_CMN_OBJPERMANENTID, and ATTR_CMN_PAROBJID can be interpreted as 64-bit
1458 object IDs instead of fsobj_id_t.
1460 .It VOL_CAP_FMT_NO_IMMUTABLE_FILES
1461 If this bit is set, the volume format does not support setting the UF_IMMUTABLE
1463 See ATTR_CMN_FLAGS for more details.
1464 .It VOL_CAP_FMT_NO_PERMISSIONS
1465 If this bit is set, the volume format does not support setting file
1467 See ATTR_CMN_USERACCESS for more details.
1468 .It VOL_CAP_FMT_SHARED_SPACE
1469 If this bit is set, the volume format supports having multiple logical filesystems
1470 in a single "partition" which share space.
1471 .It VOL_CAP_FMT_VOL_GROUPS
1472 If this bit is set, the volume format supports having multiple logical filesystems
1473 which may be mounted and unmounted together and may present common filesystem
1474 identifier information.
1480 The following bits are defined in the second element (indexed by
1481 .Dv VOL_CAPABILITIES_INTERFACES )
1487 .Vt vol_capabilities_attr_t
1490 .Bl -tag -width VOL_CAP_FMT_PERSISTENTOBJECTIDS
1492 .It VOL_CAP_INT_SEARCHFS
1493 If this bit is set the volume format implementation supports
1496 .It VOL_CAP_INT_ATTRLIST
1497 If this bit is set the volume format implementation supports
1502 .It VOL_CAP_INT_NFSEXPORT
1503 If this bit is set the volume format implementation allows this volume to be exported via NFS.
1505 .It VOL_CAP_INT_READDIRATTR
1506 If this bit is set the volume format implementation supports
1507 .Xr getdirentriesattr 2 .
1509 .It VOL_CAP_INT_EXCHANGEDATA
1510 If this bit is set the volume format implementation supports
1511 .Xr exchangedata 2 .
1513 Introduced with Darwin 7.0 (Mac OS X version 10.3).
1515 .It VOL_CAP_INT_COPYFILE
1516 If this bit is set the volume format implementation supports the (private and undocumented)
1517 copyfile() function.
1522 Introduced with Darwin 7.0 (Mac OS X version 10.3).
1524 .It VOL_CAP_INT_ALLOCATE
1525 If this bit is set the volume format implementation supports the
1530 Introduced with Darwin 7.0 (Mac OS X version 10.3).
1532 .It VOL_CAP_INT_VOL_RENAME
1533 If this bit is set the volume format implementation allows you to
1534 modify the volume name using
1537 Introduced with Darwin 7.0 (Mac OS X version 10.3).
1539 .It VOL_CAP_INT_ADVLOCK
1540 If this bit is set the volume format implementation supports
1541 advisory locking, that is, the
1549 Introduced with Darwin 7.0 (Mac OS X version 10.3).
1551 .It VOL_CAP_INT_FLOCK
1552 If this bit is set the volume format implementation supports
1563 Introduced with Darwin 7.0 (Mac OS X version 10.3).
1565 .It VOL_CAP_INT_EXTENDED_SECURITY
1566 If this bit is set the volume format implementation supports
1567 extended security controls (ACLs).
1569 Introduced with Darwin 8.0 (Mac OS X version 10.4).
1571 .It VOL_CAP_INT_USERACCESS
1572 If this bit is set the volume format implementation supports the
1573 ATTR_CMN_USERACCESS attribute.
1575 Introduced with Darwin 8.0 (Mac OS X version 10.4).
1577 .It VOL_CAP_INT_MANLOCK
1578 If this bit is set, the volume format implementation supports
1579 AFP-style mandatory byte range locks via
1582 .It VOL_CAP_INT_EXTENDED_ATTR
1583 If this bit is set, the volume format implementation supports
1584 native extended attributes (see
1585 .Xr setxattr 2 Ns ).
1587 .It VOL_CAP_INT_CLONE
1588 If this bit is set, the file system supports cloning files and directories.
1593 .It VOL_CAP_INT_SNAPSHOT
1594 If this bit is set, the file system supports snapshots.
1596 .Xr fs_snapshot_create 2
1599 .It VOL_CAP_INT_NAMEDSTREAMS
1600 If this bit is set, the volume format implementation supports
1601 native named streams.
1603 .It VOL_CAP_INT_RENAME_SWAP
1604 If this bit is set, the file system supports swapping file system
1609 .It VOL_CAP_INT_RENAME_EXCL
1610 If this bit is set, the file system supports an exclusive rename
1615 .It VOL_CAP_INT_RENAME_OPENFAIL
1616 If this bit is set, the file system may fail a rename operation
1617 of a directory if one of its descendents is open.
1625 .\" vol_attributes_attr_t
1627 A volume can also report which attributes it supports.
1628 This information is returned by the
1629 .Dv ATTR_VOL_ATTRIBUTES
1630 attribute, which returns a
1631 .Vt vol_attributes_attr_t
1632 structure (shown below).
1635 typedef struct attribute_set {
1636 attrgroup_t commonattr; /* common attribute group */
1637 attrgroup_t volattr; /* volume attribute group */
1638 attrgroup_t dirattr; /* directory attribute group */
1639 attrgroup_t fileattr; /* file attribute group */
1640 attrgroup_t forkattr; /* fork attribute group */
1644 typedef struct vol_attributes_attr {
1645 attribute_set_t validattr;
1646 attribute_set_t nativeattr;
1647 } vol_attributes_attr_t;
1653 field consists of a number of bit sets that indicate whether an attribute is
1654 supported by the volume format implementation.
1657 is similar except that the bit sets indicate whether an attribute is supported
1658 natively by the volume format.
1659 An attribute is supported natively if the volume format implementation does not have to do
1660 any complex conversions to access the attribute.
1661 For example, a volume format might support persistent object identifiers, but
1662 doing so requires a complex table lookup that is not part of the core volume
1665 .Dv ATTR_VOL_ATTRIBUTES
1666 attribute would return
1667 .Dv ATTR_CMN_OBJPERMANENTID
1671 .Vt vol_attributes_attr_t ,
1677 Upon successful completion a value of 0 is returned.
1678 Otherwise, a value of -1 is returned and
1680 is set to indicate the error.
1683 Not all volumes support
1685 The best way to test whether a volume supports this function is to
1686 simply call it and check the error result.
1690 if it is not supported on a particular volume.
1695 function has been undocumented for more than two years.
1696 In that time a number of volume format implementations have been created without
1697 a proper specification for the behaviour of this routine.
1698 You may encounter volume format implementations with slightly different
1699 behaviour than what is described here.
1700 Your program is expected to be tolerant of this variant behaviour.
1703 If you're implementing a volume format that supports
1705 you should be careful to support the behaviour specified by this document.
1715 The volume does not support the query.
1718 A component of the path prefix for
1722 .It Bq Er ENAMETOOLONG
1723 A component of a path name for
1727 characters, or an entire path name exceeded
1732 The file system object for
1737 The file descriptor argument for
1739 is not a valid file descriptor.
1742 Search permission is denied for a component of the path prefix for
1746 Too many symbolic links were encountered in translating the pathname
1755 points to an invalid address.
1759 is too small to hold a u_int32_t.
1767 .Dv ATTR_BIT_MAP_COUNT .
1770 You requested an invalid attribute.
1773 You requested an attribute that is not supported for this file system object.
1776 You requested volume attributes and directory or file attributes.
1779 You requested volume attributes but
1781 does not reference the root of the volume.
1784 The volume is read-only but must be modified in order to return this attribute.
1787 An I/O error occurred while reading from or writing to the file system.
1790 In addition to the errors returned by the
1794 function may fail if:
1799 argument does not specify an absolute path and the
1803 nor a valid file descriptor open for searching.
1807 argument is not an absolute path and
1811 nor a file descriptor associated with a directory.
1817 If you request any volume attributes, you must set
1821 field, even though it generates no result in the attribute buffer.
1824 The order that attributes are stored in the attribute buffer almost
1825 invariably matches the order of attribute mask bit values.
1828 (0x00000001) comes before
1830 (0x00000002) because its value is smaller.
1831 When ordering attributes, you should always use the order in which they
1832 are described above.
1837 structure is 64-bits (two 32-bit elements) in 32-bit code, and
1838 128-bits (two 64-bit elements) in 64-bit code; however, it is aligned
1839 on a 4-byte (32-bit) boundary, even in 64-bit code.
1841 If you use a structure
1842 for the attribute data, it must be correctly packed and aligned (see
1846 Inconsistent behavior may be observed when the ATTR_CMN_FULLPATH attribute is requested on
1847 hard-linked items, particularly when the file system does not support ATTR_CMN_PARENTID
1848 natively. Callers should be aware of this when requesting the full path of a hard-linked item, especially
1849 if the full path crosses mount points.
1852 For more caveats, see also the compatibility notes above.
1856 The following code prints the file type and creator of a file,
1857 assuming that the volume supports the required attributes.
1863 #include <sys/attr.h>
1864 #include <sys/errno.h>
1866 #include <sys/vnode.h>
1869 typedef struct attrlist attrlist_t;
1872 struct FInfoAttrBuf {
1874 fsobj_type_t objType;
1875 char finderInfo[32];
1876 } __attribute__((aligned(4), packed));
1877 typedef struct FInfoAttrBuf FInfoAttrBuf;
1880 static int FInfoDemo(const char *path)
1883 attrlist_t attrList;
1884 FInfoAttrBuf attrBuf;
1887 memset(&attrList, 0, sizeof(attrList));
1888 attrList.bitmapcount = ATTR_BIT_MAP_COUNT;
1889 attrList.commonattr = ATTR_CMN_OBJTYPE | ATTR_CMN_FNDRINFO;
1892 err = getattrlist(path, &attrList, &attrBuf, sizeof(attrBuf), 0);
1899 assert(attrBuf.length == sizeof(attrBuf));
1902 printf("Finder information for %s:\en", path);
1903 switch (attrBuf.objType) {
1905 printf("file type = '%.4s'\en", &attrBuf.finderInfo[0]);
1906 printf("file creator = '%.4s'\en", &attrBuf.finderInfo[4]);
1909 printf("directory\en");
1912 printf("other object type, %d\en", attrBuf.objType);
1923 The following code is an alternative implementation that uses nested structures
1924 to group the related attributes.
1931 #include <sys/attr.h>
1932 #include <sys/errno.h>
1934 #include <sys/vnode.h>
1937 typedef struct attrlist attrlist_t;
1940 struct FInfo2CommonAttrBuf {
1941 fsobj_type_t objType;
1942 char finderInfo[32];
1943 } __attribute__((aligned(4), packed));
1944 typedef struct FInfo2CommonAttrBuf FInfo2CommonAttrBuf;
1947 struct FInfo2AttrBuf {
1949 FInfo2CommonAttrBuf common;
1950 } __attribute__((aligned(4), packed));;
1951 typedef struct FInfo2AttrBuf FInfo2AttrBuf;
1954 static int FInfo2Demo(const char *path)
1957 attrlist_t attrList;
1958 FInfo2AttrBuf attrBuf;
1961 memset(&attrList, 0, sizeof(attrList));
1962 attrList.bitmapcount = ATTR_BIT_MAP_COUNT;
1963 attrList.commonattr = ATTR_CMN_OBJTYPE | ATTR_CMN_FNDRINFO;
1966 err = getattrlist(path, &attrList, &attrBuf, sizeof(attrBuf), 0);
1973 assert(attrBuf.length == sizeof(attrBuf));
1976 printf("Finder information for %s:\en", path);
1977 switch (attrBuf.common.objType) {
1980 "file type = '%.4s'\en",
1981 &attrBuf.common.finderInfo[0]
1984 "file creator = '%.4s'\en",
1985 &attrBuf.common.finderInfo[4]
1989 printf("directory\en");
1993 "other object type, %d\en",
1994 attrBuf.common.objType
2006 The following example shows how to deal with variable length attributes.
2007 It assumes that the volume specified by
2009 supports the necessary attributes.
2016 #include <sys/attr.h>
2017 #include <sys/errno.h>
2019 #include <sys/vnode.h>
2022 typedef struct attrlist attrlist_t;
2027 u_int32_t fileCount;
2029 attrreference_t mountPointRef;
2030 attrreference_t volNameRef;
2031 char mountPointSpace[MAXPATHLEN];
2032 char volNameSpace[MAXPATHLEN];
2033 } __attribute__((aligned(4), packed));
2034 typedef struct VolAttrBuf VolAttrBuf;
2037 static int VolDemo(const char *path)
2040 attrlist_t attrList;
2044 memset(&attrList, 0, sizeof(attrList));
2045 attrList.bitmapcount = ATTR_BIT_MAP_COUNT;
2046 attrList.volattr = ATTR_VOL_INFO
2047 | ATTR_VOL_FILECOUNT
2049 | ATTR_VOL_MOUNTPOINT
2053 err = getattrlist(path, &attrList, &attrBuf, sizeof(attrBuf), 0);
2060 assert(attrBuf.length > offsetof(VolAttrBuf, mountPointSpace));
2061 assert(attrBuf.length <= sizeof(attrBuf));
2064 printf("Volume information for %s:\en", path);
2065 printf("ATTR_VOL_FILECOUNT: %u\en", attrBuf.fileCount);
2066 printf("ATTR_VOL_DIRCOUNT: %u\en", attrBuf.dirCount);
2068 "ATTR_VOL_MOUNTPOINT: %.*s\en",
2069 (int) attrBuf.mountPointRef.attr_length,
2070 ( ((char *) &attrBuf.mountPointRef)
2071 + attrBuf.mountPointRef.attr_dataoffset )
2074 "ATTR_VOL_NAME: %.*s\en",
2075 (int) attrBuf.volNameRef.attr_length,
2076 ( ((char *) &attrBuf.volNameRef)
2077 + attrBuf.volNameRef.attr_dataoffset )
2086 The following sample demonstrates the need to use packing and alignment
2087 controls; without the attribute, in 64-bit code, the fields of the structure are not
2088 placed at the locations that the kernel expects.
2097 #include <sys/attr.h>
2099 /* The alignment and packing attribute is necessary in 64-bit code */
2100 struct AttrListTimes {
2102 struct timespec st_crtime;
2103 struct timespec st_modtime;
2104 } __attribute__((aligned(4), packed));
2106 main(int argc, char **argv)
2111 for (i = 1; i < argc; i++) {
2112 struct attrlist attrList;
2113 struct AttrListTimes myStat = {0};
2114 char *path = argv[i];
2116 memset(&attrList, 0, sizeof(attrList));
2117 attrList.bitmapcount = ATTR_BIT_MAP_COUNT;
2118 attrList.commonattr = ATTR_CMN_CRTIME |
2121 rv = getattrlist(path, &attrList, &myStat, sizeof(myStat), 0);
2124 warn("getattrlist(%s)", path);
2127 printf("%s: Modification time = %s", argv[i], ctime(&myStat.st_modtime.tv_sec));
2133 The getLinkIDInfo() function determines if ATTR_CMNEXT_LINKID and ATTR_CMN_OBJID
2134 are valid to use on the file system specified by path.
2137 int getLinkIDInfo(const char *path, bool *cmnExtLinkIDValid, bool *cmnObjIDValid)
2140 struct statfs statfsBuf;
2141 struct attrlist attrList;
2142 struct volAttrsBuf {
2144 vol_capabilities_attr_t capabilities;
2145 vol_attributes_attr_t attributes;
2146 } __attribute__((aligned(4), packed));
2147 struct volAttrsBuf volAttrs;
2149 memset(&attrList, 0, sizeof(attrList));
2150 attrList.bitmapcount = ATTR_BIT_MAP_COUNT;
2151 attrList.volattr = ATTR_VOL_INFO | ATTR_VOL_CAPABILITIES | ATTR_VOL_ATTRIBUTES;
2152 // get the file system's mount point path for the input path
2153 result = statfs(path, &statfsBuf);
2154 if ( result == 0 ) {
2155 // get the supported capabilities and attributes
2156 result = getattrlist(statfsBuf.f_mntonname, &attrList, &volAttrs, sizeof(volAttrs), FSOPT_ATTR_CMN_EXTENDED);
2157 if ( result == 0 ) {
2158 if ( volAttrs.attributes.validattr.forkattr & ATTR_CMNEXT_LINKID ) {
2159 // ATTR_CMNEXT_LINKID is available; do not use ATTR_CMN_OBJID
2160 *cmnExtLinkIDValid = true;
2161 *cmnObjIDValid = false;
2164 // ATTR_CMNEXT_LINKID is not available
2165 cmnExtLinkIDValid = false;
2166 // ATTR_CMN_OBJID can only be used if the file system does not use 64-bit object IDs
2167 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) ) {
2168 *cmnObjIDValid = false;
2171 *cmnObjIDValid = true;
2176 if ( result != 0 ) {
2177 *cmnExtLinkIDValid = *cmnObjIDValid = false;
2188 .Xr exchangedata 2 ,
2190 .Xr getattrlistbulk 2 ,
2200 function call appeared in Darwin 1.3.1 (Mac OS X version 10.0).
2203 function call appeared in OS X 10.10 .