2 * Copyright (c) 2004 Alfred Perlstein <alfred@FreeBSD.org>
5 * Redistribution and use in source and binary forms, with or without
6 * 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 the
12 * documentation and/or other materials provided with the distribution.
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * $Id: libautofs.h,v 1.4 2004/09/08 08:12:21 bright Exp $
33 typedef struct auto_handle
* autoh_t
;
34 struct autofs_userreq
;
35 typedef struct autofs_userreq
* autoreq_t
;
36 typedef uint64_t autoino_t
;
38 #define AUTO_INODE_NONE 0
41 #define AUTO_INDIRECT 2
42 #define AUTO_MOUNTER 3
46 AUTOREQ_OP_UNKNOWN
= 0,
52 /* get a handle based on a path. */
53 int autoh_get(const char *, autoh_t
*);
55 void autoh_free(autoh_t
);
58 * Get an array of pointers to handles for all autofs mounts, returns count
61 int autoh_getall(autoh_t
**, int *cnt
);
62 /* free the array of pointers */
63 void autoh_freeall(autoh_t
*);
65 /* return fd to select on. */
66 int autoh_fd(autoh_t
);
68 /* returns the mount point of the autofs instance. */
69 const char *autoh_mp(autoh_t
);
71 /* get an array of pending requests */
72 int autoreq_get(autoh_t
, autoreq_t
**, int *);
73 /* free an array of requests */
74 void autoreq_free(autoh_t
, autoreq_t
*);
76 int autoreq_serv(autoh_t
, autoreq_t
);
78 /* get the operation requested */
79 enum autoreq_op
autoreq_getop(autoreq_t
);
81 /* get a request's file name. */
82 const char *autoreq_getpath(autoreq_t
);
83 /* get a request's inode. a indirect mount may return AUTO_INODE_NONE. */
84 autoino_t
autoreq_getino(autoreq_t
);
86 * set a request's inode. an indirect mount may return AUTO_INODE_NONE,
87 * this is a fixup for indirect mounts.
89 void autoreq_setino(autoreq_t
, autoino_t
);
90 /* get a request's directory inode. */
91 autoino_t
autoreq_getdirino(autoreq_t
);
92 void autoreq_seterrno(autoreq_t
, int);
93 void autoreq_setaux(autoreq_t
, void *, size_t);
94 void autoreq_getaux(autoreq_t
, void **, size_t *);
95 void autoreq_seteof(autoreq_t
, int);
96 void autoreq_getoffset(autoreq_t
, off_t
*);
97 void autoreq_getxid(autoreq_t
, int *);
99 /* toggle by path. args = handle, AUTO_?, pid (-1 to disable), path. */
100 int autoh_togglepath(autoh_t
, int, pid_t
, const char *);
101 /* toggle by fd. args = handle, AUTO_?, pid (-1 to disable), fd. */
102 int autoh_togglefd(autoh_t
, int, pid_t
, int);