1 .\" Copyright (c) 2004 Alfred Perlstein <alfred@FreeBSD.org>
2 .\" All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\" notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\" notice, this list of conditions and the following disclaimer in the
11 .\" documentation and/or other materials provided with the distribution.
13 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 .\" $Id: libautofs.3,v 1.4 2004/09/08 08:12:21 bright Exp $
32 .Nd "procedural interface to managing an autofs file system"
36 .Fn autoh_get "const char *path" "autoh_t *hndlp"
38 .Fn autoh_free "autoh_t hndl"
40 .Fn autoh_getall "autoh_t **hndlpp" "int *cnt"
42 .Fn autoh_freeall "autoh_t *hndlep"
44 .Fn autoh_fd "autoh_t hndl"
46 .Fn autoh_mp "autoh_t hndl"
48 .Fn autoreq_get "autoh_t hndl" "autoreq_t **reqpp" "int *cntp"
50 .Fn autoreq_free "autoh_t hndl" "autoreq_t *reqp"
52 .Fn autoreq_serv "autoh_t hndl" "autoreq_t req"
54 .Fn autoreq_getop "autoreq_t req"
56 .Fn autoreq_getpath "autoreq_t req"
58 .Fn autoreq_getino "autoreq_t req"
60 .Fn autoreq_getdirino "autoreq_t req"
62 .Fn autoreq_getaux "autoreq_t req" "void **auxdatap" "size_t *auxsizep"
64 .Fn autoreq_getoffset "autoreq_t req" "off_t *offp"
66 .Fn autoreq_getxid "autoreq_t req" "int *xidp"
68 .Fn autoreq_setino "autoreq_t req" "autoino_t ino"
70 .Fn autoreq_seterrno "autoreq_t req" "int errno"
72 .Fn autoreq_setaux "autoreq_t req" "void *auxdata" "size_t auxsize"
74 .Fn autoreq_seteof "autoreq_t req" "int eof"
76 .Fn autoh_togglepath "autoh_t hndl" "int toggle" "pid_t pid" "const char *path"
78 .Fn autoh_togglefd "autoh_t hndl" "int toggle" "pid_t pid" "int fd"
82 library provides a "mostly" stable interface to the
88 is managed via handles of type
92 which refer to handles to
94 mount points and requests respectively.
98 function returns a handle to an
100 file system based on the
103 The handle returned should be freed via the
109 function returns an array of handles to all mounted
111 file systems, each of which should be released via the
113 function or released en-mass via the
119 function returns a file descriptor that can be used with
123 to check for "exceptional" data to detect an
128 should set the fd in the
133 should set POLLPRI in the pollfd
139 function returns the path to the autofs file system that the
145 function returns an array of autofs requests in
147 the number of requests is stored into
149 Each request should be released using the
153 Requests that are retrieved via the
155 are served via the "autoreq_" functions.
157 The following functions returns information about the request.
158 .Bl -tag -width indent
160 return the operation type of the request, that would be one of
161 AUTOREQ_OP_UNKNOWN, AUTOREQ_OP_LOOKUP, AUTOREQ_OP_STAT, AUTOREQ_OP_READDIR
162 depending on the type of request that
164 requires service from.
165 .It Fn autoreq_getpath
166 return the path of the mountpoint associated with the request
168 .It Fn autoreq_getino
169 return the inode associated with the request
171 .It Fn autoreq_getdirno
172 return the directory inode associated with the request
174 .It Fn autoreq_getaux
175 return the auxiliary data associated with the request
177 .It Fn autoreq_getoffset
178 return the offset request associated with the request
180 (used for readdir request)
181 .It Fn autoreq_getxid
182 return the transaction id associated with an autofs request, these
183 are unique per mount point, but not system wide.
185 for debugging to ensure requests are being accepted by the kernel.
188 The following functions allow one to set the response sent to
190 to the requesting userland application.
191 .Bl -tag -width indent
192 .It Fn autoreq_setino
197 this is typically unused.
198 .It Fn autoreq_seterrno
199 set the error returned to the application sending the request, typically
200 this is left alone, or set to ENOENT if the request is for a non-existent
202 The default error is no error.
203 Meaning the application will see
205 .It Fn autoreq_setaux
206 used to set the auxiliary data for a request, currently used to set
207 the dirent structures for serving a readdir request.
210 .It Fn autoreq_seteof
211 used to set the eof flag for readdir requests (default is not eof.)
218 are used to set options on an
227 argument should be set to the pid of the process serving
229 requests, or -1 to disable the option.
231 .Bl -tag -width AUTO_INDIRECT
233 set this process as the one responsible for the
235 node, if this process exits, then requests into the autofs will begin to fail.
237 dispatch directory read requests for this node to the process identified by
239 Specifically, calls to
243 will be routed to userland after the current actual directory contents
244 are read into userland.
246 Set the directory as a mount trigger.
247 Any request to enter the directory
248 will trigger a callback into the process
251 Set the directory as an indirect trigger.
252 Any request for an entry inside
253 the directory will be routed to the process identified by
257 See /usr/share/examples/autofs/driver/
261 utility first appeared in
264 This manual page and the autofs file system suite were written by
265 .An Alfred Perlstein .