xref: /openbsd/usr.sbin/amd/rpcx/amq.x (revision 4cfece93)
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.6 2015/01/21 09:49:37 guenther 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  */
53 typedef int64_t time_type;
54 
55 /*
56  * A tree of what is mounted
57  */
58 struct amq_mount_tree {
59 	amq_string	mt_mountinfo;	/* Mounted filesystem */
60 	amq_string	mt_directory;	/* Virtual mount */
61 	amq_string	mt_mountpoint;	/* Mount point */
62 	amq_string	mt_type;	/* Filesystem type */
63 	time_type	mt_mounttime;	/* Mount time */
64 	u_short		mt_mountuid;	/* Mounter */
65 	int		mt_getattr;	/* Count of getattrs */
66 	int		mt_lookup;	/* Count of lookups */
67 	int		mt_readdir;	/* Count of readdirs */
68 	int		mt_readlink;	/* Count of readlinks */
69 	int		mt_statfs;	/* Count of statfss */
70 	amq_mount_tree	*mt_next;	/* Sibling mount tree */
71 	amq_mount_tree	*mt_child;	/* Child mount tree */
72 };
73 typedef amq_mount_tree *amq_mount_tree_p;
74 
75 /*
76  * List of mounted filesystems
77  */
78 struct amq_mount_info {
79 	amq_string	mi_type;	/* Type of mount */
80 	amq_string	mi_mountpt;	/* Mount point */
81 	amq_string	mi_mountinfo;	/* Mount info */
82 	amq_string	mi_fserver;	/* Fileserver */
83 	int		mi_error;	/* Error code */
84 	int		mi_refc;	/* References */
85 	int		mi_up;		/* Filesystem available */
86 };
87 typedef amq_mount_info amq_mount_info_list<>;
88 
89 /*
90  * A list of mount trees
91  */
92 typedef amq_mount_tree_p amq_mount_tree_list<>;
93 
94 /*
95  * System wide stats
96  */
97 struct amq_mount_stats {
98 	int	as_drops;	/* Dropped requests */
99 	int	as_stale;	/* Stale NFS handles */
100 	int	as_mok;		/* Successful mounts */
101 	int	as_merr;	/* Failed mounts */
102 	int	as_uerr;	/* Failed unmounts */
103 };
104 
105 enum amq_opt {
106 	AMOPT_DEBUG=0,
107 	AMOPT_LOGFILE=1,
108 	AMOPT_XLOG=2,
109 	AMOPT_FLUSHMAPC=3
110 };
111 
112 struct amq_setopt {
113 	amq_opt	as_opt;		/* Option */
114 	amq_string as_str;	/* String */
115 };
116 
117 program AMQ_PROGRAM {
118 	version AMQ_VERSION {
119 		/*
120 		 * Does no work. It is made available in all RPC services
121 		 * to allow server reponse testing and timing
122 		 */
123 		void
124 		AMQPROC_NULL(void) = 0;
125 
126 		/*
127 		 * Returned the mount tree descending from
128 		 * the given directory.  The directory must
129 		 * be a top-level mount point of the automounter.
130 		 */
131 		amq_mount_tree_p
132 		AMQPROC_MNTTREE(amq_string) = 1;
133 
134 		/*
135 		 * Force a timeout unmount on the specified directory.
136 		 */
137 		void
138 		AMQPROC_UMNT(amq_string) = 2;
139 
140 		/*
141 		 * Obtain system wide statistics from the automounter
142 		 */
143 		amq_mount_stats
144 		AMQPROC_STATS(void) = 3;
145 
146 		/*
147 		 * Obtain full tree
148 		 */
149 		amq_mount_tree_list
150 		AMQPROC_EXPORT(void) = 4;
151 
152 		/*
153 		 * Control debug options.
154 		 * Return status:
155 		 *	-1: debug not available
156 		 *	 0: everything wonderful
157 		 *	>0: number of options not recognised
158 		 */
159 		int
160 		AMQPROC_SETOPT(amq_setopt) = 5;
161 
162 		/*
163 		 * List of mounted filesystems
164 		 */
165 		amq_mount_info_list
166 		AMQPROC_GETMNTFS(void) = 6;
167 
168 		/*
169 		 * Get version info
170 		 */
171 		amq_string
172 		AMQPROC_GETVERS(void) = 7;
173 	} = 57;
174 } = 300019;	/* Allocated by Sun, 89/8/29 */
175