]> CyberLeo.Net >> Repos - FreeBSD/releng/8.1.git/blob - lib/libautofs/libautofs.h
Copy stable/8 to releng/8.1 in preparation for 8.1-RC1.
[FreeBSD/releng/8.1.git] / lib / libautofs / libautofs.h
1 /*
2  * Copyright (c) 2004 Alfred Perlstein <alfred@FreeBSD.org>
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
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.
13  *
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
24  * SUCH DAMAGE.
25  *
26  * $FreeBSD$
27  * $Id: libautofs.h,v 1.4 2004/09/08 08:12:21 bright Exp $
28  */
29 #ifndef _LIBAUTOFS_H
30 #define _LIBAUTOFS_H
31
32 struct auto_handle;
33 typedef struct auto_handle * autoh_t;
34 struct autofs_userreq;
35 typedef struct autofs_userreq * autoreq_t;
36 typedef uint64_t autoino_t;
37
38 #define AUTO_INODE_NONE         0
39
40 #define AUTO_DIRECT             1
41 #define AUTO_INDIRECT           2
42 #define AUTO_MOUNTER            3
43 #define AUTO_BROWSE             4
44
45 enum autoreq_op {
46         AUTOREQ_OP_UNKNOWN = 0,
47         AUTOREQ_OP_LOOKUP,
48         AUTOREQ_OP_STAT,
49         AUTOREQ_OP_READDIR
50 };
51
52 /* get a handle based on a path. */
53 int             autoh_get(const char *, autoh_t *);
54 /* release. */
55 void            autoh_free(autoh_t);
56
57 /*
58  * Get an array of pointers to handles for all autofs mounts, returns count
59  * or -1
60  */
61 int             autoh_getall(autoh_t **, int *cnt);
62 /* free the array of pointers */
63 void            autoh_freeall(autoh_t *);
64
65 /* return fd to select on. */
66 int             autoh_fd(autoh_t);
67
68 /* returns the mount point of the autofs instance. */
69 const char      *autoh_mp(autoh_t);
70
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 *);
75 /* serve a request */
76 int             autoreq_serv(autoh_t, autoreq_t);
77
78 /* get the operation requested */
79 enum autoreq_op autoreq_getop(autoreq_t);
80
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);
85 /*
86  * set a request's inode.  an indirect mount may return AUTO_INODE_NONE,
87  * this is a fixup for indirect mounts.
88  */
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 *);
98
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);
103
104 #endif