1 .\" Copyright (c) 2017 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.
24 .Nd get the path associated with filesystem node identifier (inode number/link id/object id)
26 .Fd #include <sys/attr.h>
27 .Fd #include <sys/fsgetpath.h>
30 .Fn fsgetpath "char * restrict_buf" "size_t buflen" "fsid_t * fsid" "uint64_t obj_id"
35 function returns the path in a caller provided buffer
37 of length indicated by
39 associated with a filesystem object identified by
44 is a pointer to a structure which identifies a filesystem to which the object belongs.
45 It is obtained by the value returned for ATTR_CMN_FSID in a previous call to
54 can be any one of of a object identifier i.e. ATTR_CMN_FILEID returned by
62 or a link id returned in ATTR_CMNEXT_LINKID by a previous call to
64 Using a linkid will result in a more accurate path in case the filesystem object is a
65 hard link. If a inode number is passed and the object is a hard link, any one of the
66 multiple paths to that filesystem object may be returned.
68 Upon successful completion,
70 returns the path length. Otherwise, a value of -1 is returned and errno is set to indicate the error.
73 Not all volumes support
75 A volume can be tested for
79 to get the volume capabilities attribute ATTR_VOL_CAPABILITIES, and then testing the VOL_CAP_FMT_PATH_FROM_ID flag.
84 function will fail if:
88 Read permissions are denied on any component of the pathname.
91 The underlying filesystem does not support this call.
95 is larger than PAGE_SIZE
98 An I/O error occurred while reading from the file system.
101 The calling process does not have appropriate privileges.
104 The Filesystem object does not exist.
107 restrict_buf points to memory not valid in the callers address space.
110 restrict_buf is not large enough to hold the path.
125 function call appeared in macOS version 10.13