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