xref: /openbsd/usr.sbin/amd/rpcx/amq.x (revision 17df1aa7)
1 /*
2  * Copyright (c) 1990 Jan-Simon Pendry
3  * Copyright (c) 1990 Imperial College of Science, Technology & Medicine
4  * Copyright (c) 1990, 1993
5  *	The Regents of the University of California.  All rights reserved.
6  *
7  * This code is derived from software contributed to Berkeley by
8  * Jan-Simon Pendry at Imperial College, London.
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions
12  * are met:
13  * 1. Redistributions of source code must retain the above copyright
14  *    notice, this list of conditions and the following disclaimer.
15  * 2. Redistributions in binary form must reproduce the above copyright
16  *    notice, this list of conditions and the following disclaimer in the
17  *    documentation and/or other materials provided with the distribution.
18  * 3. Neither the name of the University nor the names of its contributors
19  *    may be used to endorse or promote products derived from this software
20  *    without specific prior written permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32  * SUCH DAMAGE.
33  *
34  *	from: @(#)amq.x	8.1 (Berkeley) 6/6/93
35  *	$Id: amq.x,v 1.5 2003/11/08 19:17:29 jmc Exp $
36  *
37  */
38 
39 /*
40  * Protocol description used by the amq program
41  */
42 
43 const AMQ_STRLEN = 1024;	/* Maximum length of a pathname */
44 
45 /*
46  * The type dirpath is the pathname of a directory
47  */
48 typedef string amq_string<AMQ_STRLEN>;
49 
50 /*
51  * The type time_type should correspond to the system time_t
52  * XXX int/long time_t garbage; this needs to be a 32-bit integer
53  */
54 typedef int time_type;
55 
56 /*
57  * A tree of what is mounted
58  */
59 struct amq_mount_tree {
60 	amq_string	mt_mountinfo;	/* Mounted filesystem */
61 	amq_string	mt_directory;	/* Virtual mount */
62 	amq_string	mt_mountpoint;	/* Mount point */
63 	amq_string	mt_type;	/* Filesystem type */
64 	time_type	mt_mounttime;	/* Mount time */
65 	u_short		mt_mountuid;	/* Mounter */
66 	int		mt_getattr;	/* Count of getattrs */
67 	int		mt_lookup;	/* Count of lookups */
68 	int		mt_readdir;	/* Count of readdirs */
69 	int		mt_readlink;	/* Count of readlinks */
70 	int		mt_statfs;	/* Count of statfss */
71 	amq_mount_tree	*mt_next;	/* Sibling mount tree */
72 	amq_mount_tree	*mt_child;	/* Child mount tree */
73 };
74 typedef amq_mount_tree *amq_mount_tree_p;
75 
76 /*
77  * List of mounted filesystems
78  */
79 struct amq_mount_info {
80 	amq_string	mi_type;	/* Type of mount */
81 	amq_string	mi_mountpt;	/* Mount point */
82 	amq_string	mi_mountinfo;	/* Mount info */
83 	amq_string	mi_fserver;	/* Fileserver */
84 	int		mi_error;	/* Error code */
85 	int		mi_refc;	/* References */
86 	int		mi_up;		/* Filesystem available */
87 };
88 typedef amq_mount_info amq_mount_info_list<>;
89 
90 /*
91  * A list of mount trees
92  */
93 typedef amq_mount_tree_p amq_mount_tree_list<>;
94 
95 /*
96  * System wide stats
97  */
98 struct amq_mount_stats {
99 	int	as_drops;	/* Dropped requests */
100 	int	as_stale;	/* Stale NFS handles */
101 	int	as_mok;		/* Successful mounts */
102 	int	as_merr;	/* Failed mounts */
103 	int	as_uerr;	/* Failed unmounts */
104 };
105 
106 enum amq_opt {
107 	AMOPT_DEBUG=0,
108 	AMOPT_LOGFILE=1,
109 	AMOPT_XLOG=2,
110 	AMOPT_FLUSHMAPC=3
111 };
112 
113 struct amq_setopt {
114 	amq_opt	as_opt;		/* Option */
115 	amq_string as_str;	/* String */
116 };
117 
118 program AMQ_PROGRAM {
119 	version AMQ_VERSION {
120 		/*
121 		 * Does no work. It is made available in all RPC services
122 		 * to allow server reponse testing and timing
123 		 */
124 		void
125 		AMQPROC_NULL(void) = 0;
126 
127 		/*
128 		 * Returned the mount tree descending from
129 		 * the given directory.  The directory must
130 		 * be a top-level mount point of the automounter.
131 		 */
132 		amq_mount_tree_p
133 		AMQPROC_MNTTREE(amq_string) = 1;
134 
135 		/*
136 		 * Force a timeout unmount on the specified directory.
137 		 */
138 		void
139 		AMQPROC_UMNT(amq_string) = 2;
140 
141 		/*
142 		 * Obtain system wide statistics from the automounter
143 		 */
144 		amq_mount_stats
145 		AMQPROC_STATS(void) = 3;
146 
147 		/*
148 		 * Obtain full tree
149 		 */
150 		amq_mount_tree_list
151 		AMQPROC_EXPORT(void) = 4;
152 
153 		/*
154 		 * Control debug options.
155 		 * Return status:
156 		 *	-1: debug not available
157 		 *	 0: everything wonderful
158 		 *	>0: number of options not recognised
159 		 */
160 		int
161 		AMQPROC_SETOPT(amq_setopt) = 5;
162 
163 		/*
164 		 * List of mounted filesystems
165 		 */
166 		amq_mount_info_list
167 		AMQPROC_GETMNTFS(void) = 6;
168 
169 		/*
170 		 * Mount a filesystem
171 		 */
172 		int
173 		AMQPROC_MOUNT(amq_string) = 7;
174 
175 		/*
176 		 * Get version info
177 		 */
178 		amq_string
179 		AMQPROC_GETVERS(void) = 8;
180 	} = 1;
181 } = 300019;	/* Allocated by Sun, 89/8/29 */
182