2 .\" Copyright (c) 2005 The DragonFly Project. All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
8 .\" 1. Redistributions of source code must retain the above copyright
9 .\" notice, this list of conditions and the following disclaimer.
10 .\" 2. Redistributions in binary form must reproduce the above copyright
11 .\" notice, this list of conditions and the following disclaimer in
12 .\" the documentation and/or other materials provided with the
14 .\" 3. Neither the name of The DragonFly Project nor the names of its
15 .\" contributors may be used to endorse or promote products derived
16 .\" from this software without specific, prior written permission.
18 .\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 .\" LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
21 .\" FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
22 .\" COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
23 .\" INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
24 .\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 .\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
26 .\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27 .\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
28 .\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
38 .Nm nlookup_init_raw ,
39 .Nm nlookup_init_root ,
53 .Fn nlookup "struct nlookupdata *nd"
55 .Fn nlookup_init "struct nlookupdata *nd" "const char *path" "enum uio_seg seg" "int flags"
57 .Fn nlookup_init_at "struct nlookupdata *nd" "struct file **fpp" "int fd" "const char *path" "enum uio_seg seg" "int flags"
59 .Fn nlookup_init_raw "struct nlookupdata *nd" "const char *path" "enum uio_seg seg" "int flags" "struct ucred *cred" "struct namecache *ncstart"
61 .Fn nlookup_init_root "struct nlookupdata *nd" "const char *path" "enum uio_seg seg" "int flags" "struct ucred *cred" "struct namecache *ncstart" "struct namecache *ncroot"
63 .Fn nlookup_zero "struct nlookupdata *nd"
65 .Fn nlookup_done "struct nlookupdata *nd"
67 .Fn nlookup_done_at "struct nlookupdata *nd" "struct file *fp"
68 .Ft "struct namecache *"
69 .Fn nlookup_simple "const char *str" "enum uio_seg seg" "int niflags" "int *error"
71 .Fn nlookup_mp "struct mount *mp" "struct namecache **ncpp"
73 .Fn nreadsymlink "struct nlookupdata *nd" "struct namecache *ncp" "struct nlcomponent *nlc"
75 .Fn naccess "struct namecache *ncp" "int vmode" "struct ucred *cred"
77 .Fn naccess_va "struct vattr *va" "int vmode" "struct ucred *cred"
80 does a generic namecache lookup.
82 .Fa "struct nlookupdata"
85 on return, even if an error occurs.
86 If no error occurs the returned nl_ncp
87 is always referenced and locked, otherwise it may or may not be.
88 Intermediate directory elements, including the current directory,
89 require execute (search) permission.
91 does not examine the access permissions on the returned element.
96 is set the last directory must allow
99 .Dv VCREATE Ns / Ns Dv VDELETE
101 and an error code of 0
102 will be returned for a non-existent target.
103 Otherwise a non-existent target will cause
109 .Fa "struct nlookupdata" ,
110 and does an early error
111 return for copyin faults or a degenerate empty string (which is
113 The first process proc0's
114 credentials are used if the calling
115 thread is not associated with a process context.
122 is a relative path and
127 is interpreted relative to the directory associated with
129 and the file entry for
131 is referenced and returned in
133 Its main use is the implementation of
140 but does not assume a process context.
141 rootncp is always chosen for the root directory and the
143 and starting directory are supplied in the arguments.
145 .Fn nlookup_init_root
148 but does not assume rootnch for the root directory.
149 The root directory is supplied in the arguments, and is also
150 used for the jail directory.
154 .Fa "struct nlookupdata" .
159 structure after we are through with
161 This function may be called on any nlookupdata structure
166 is mandatory in all cases except where
168 returns an error, even if as a consumer you believe you
169 have taken all dynamic elements out of the
176 structure that was initialized with
178 and drops the reference to
182 is a simple all-in-one
184 It returns a locked namecache structure or NULL if an error
186 Note that the returned ncp
187 is not checked for permissions,
190 is checked on the directory path leading up to
194 to check the permissions of the returned leaf.
197 is used to resolve a mount point's glue ncp.
198 It creates the illusion of continuity in the namecache tree
199 by connecting the ncp related to the vnode under the mount
200 to the ncp related to the mount's root vnode.
201 If no error occurred a locked, ref'd ncp is stored in
205 reads the contents of a symlink, allocates a path buffer out
206 of the namei_zone and initialize the supplied nlcomponent
208 If an error occurs no buffer will be allocated or returned
212 generally checks the V* access bits from
214 All specified bits must pass for this function to return 0.
217 is specified and the target ncp represents a
218 non-existent file or dir, or if
221 target exists, the parent directory is checked for
225 is specified and the target ncp represents a positive
226 hit, an error is returned.
229 is not specified and the target does not exist
235 does not (and should not) return
237 for non-existent leafs.
238 The passed ncp may or may not be locked.
239 The caller should use a locked ncp on leaf lookups, especially
248 checks the requested access against the given
253 .Pa sys/kern/vfs_nlookup.c
258 This man page was written by