xref: /netbsd-src/external/bsd/am-utils/dist/include/amq_defs.h (revision 46f3b50fca8118b155a649350f8a0db6316173f6)
1*46f3b50fSchristos /*	$NetBSD: amq_defs.h,v 1.2 2022/08/23 07:42:28 christos Exp $	*/
2a53f50b9Schristos 
3a53f50b9Schristos /*
48bae5d40Schristos  * Copyright (c) 1997-2014 Erez Zadok
5a53f50b9Schristos  * Copyright (c) 1990 Jan-Simon Pendry
6a53f50b9Schristos  * Copyright (c) 1990 Imperial College of Science, Technology & Medicine
7a53f50b9Schristos  * Copyright (c) 1990 The Regents of the University of California.
8a53f50b9Schristos  * All rights reserved.
9a53f50b9Schristos  *
10a53f50b9Schristos  * This code is derived from software contributed to Berkeley by
11a53f50b9Schristos  * Jan-Simon Pendry at Imperial College, London.
12a53f50b9Schristos  *
13a53f50b9Schristos  * Redistribution and use in source and binary forms, with or without
14a53f50b9Schristos  * modification, are permitted provided that the following conditions
15a53f50b9Schristos  * are met:
16a53f50b9Schristos  * 1. Redistributions of source code must retain the above copyright
17a53f50b9Schristos  *    notice, this list of conditions and the following disclaimer.
18a53f50b9Schristos  * 2. Redistributions in binary form must reproduce the above copyright
19a53f50b9Schristos  *    notice, this list of conditions and the following disclaimer in the
20a53f50b9Schristos  *    documentation and/or other materials provided with the distribution.
218bae5d40Schristos  * 3. Neither the name of the University nor the names of its contributors
22a53f50b9Schristos  *    may be used to endorse or promote products derived from this software
23a53f50b9Schristos  *    without specific prior written permission.
24a53f50b9Schristos  *
25a53f50b9Schristos  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
26a53f50b9Schristos  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27a53f50b9Schristos  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28a53f50b9Schristos  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
29a53f50b9Schristos  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30a53f50b9Schristos  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
31a53f50b9Schristos  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32a53f50b9Schristos  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33a53f50b9Schristos  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34a53f50b9Schristos  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35a53f50b9Schristos  * SUCH DAMAGE.
36a53f50b9Schristos  *
37a53f50b9Schristos  *
38a53f50b9Schristos  * File: am-utils/include/amq_defs.h
39a53f50b9Schristos  *
40a53f50b9Schristos  */
41a53f50b9Schristos 
42a53f50b9Schristos #ifndef _AMQ_DEFS_H
43a53f50b9Schristos #define _AMQ_DEFS_H
44a53f50b9Schristos 
45a53f50b9Schristos /*
46a53f50b9Schristos  * MACROS
47a53f50b9Schristos  */
48a53f50b9Schristos #ifndef AMQ_SIZE
49a53f50b9Schristos # define AMQ_SIZE 16384
50a53f50b9Schristos #endif /* not AMQ_SIZE */
51a53f50b9Schristos #define AMQ_STRLEN 16384
52a53f50b9Schristos #define AMQ_PROGRAM ((u_long)300019)
53a53f50b9Schristos #define AMQ_VERSION ((u_long)1)
54a53f50b9Schristos #define AMQPROC_NULL ((u_long)0)
55a53f50b9Schristos #define AMQPROC_MNTTREE ((u_long)1)
564bcd344eSchristos #define AMQPROC_UMNT ((u_long)2)	/* asynchronous unmount */
57a53f50b9Schristos #define AMQPROC_STATS ((u_long)3)
58a53f50b9Schristos #define AMQPROC_EXPORT ((u_long)4)
59a53f50b9Schristos #define AMQPROC_SETOPT ((u_long)5)
60a53f50b9Schristos #define AMQPROC_GETMNTFS ((u_long)6)
61a53f50b9Schristos #define AMQPROC_MOUNT ((u_long)7)
62a53f50b9Schristos #define AMQPROC_GETVERS ((u_long)8)
63a53f50b9Schristos #define AMQPROC_GETPID ((u_long)9)
64a53f50b9Schristos #define AMQPROC_PAWD ((u_long)10)
654bcd344eSchristos #define AMQPROC_SYNC_UMNT ((u_long)11)	/* synchronous unmount */
668bae5d40Schristos #define AMQPROC_GETMAPINFO ((u_long)12)
67a53f50b9Schristos 
68a53f50b9Schristos /*
69a53f50b9Schristos  * TYPEDEFS
70a53f50b9Schristos  */
71*46f3b50fSchristos typedef long long time_type;
72a53f50b9Schristos typedef struct amq_mount_info amq_mount_info;
738bae5d40Schristos typedef struct amq_map_info amq_map_info;
74a53f50b9Schristos typedef struct amq_mount_stats amq_mount_stats;
75a53f50b9Schristos typedef struct amq_mount_tree amq_mount_tree;
76a53f50b9Schristos typedef struct amq_setopt amq_setopt;
774bcd344eSchristos typedef struct amq_sync_umnt amq_sync_umnt;
78a53f50b9Schristos typedef amq_mount_tree *amq_mount_tree_p;
79a53f50b9Schristos 
80a53f50b9Schristos /*
81a53f50b9Schristos  * STRUCTURES:
82a53f50b9Schristos  */
83a53f50b9Schristos struct amq_mount_tree {
84a53f50b9Schristos   amq_string mt_mountinfo;
85a53f50b9Schristos   amq_string mt_directory;
86a53f50b9Schristos   amq_string mt_mountpoint;
87a53f50b9Schristos   amq_string mt_type;
88a53f50b9Schristos   time_type mt_mounttime;
89a53f50b9Schristos   u_short mt_mountuid;
90a53f50b9Schristos   int mt_getattr;
91a53f50b9Schristos   int mt_lookup;
92a53f50b9Schristos   int mt_readdir;
93a53f50b9Schristos   int mt_readlink;
94a53f50b9Schristos   int mt_statfs;
95a53f50b9Schristos   struct amq_mount_tree *mt_next;
96a53f50b9Schristos   struct amq_mount_tree *mt_child;
97a53f50b9Schristos };
98a53f50b9Schristos 
99a53f50b9Schristos struct amq_mount_info {
100a53f50b9Schristos   amq_string mi_type;
101a53f50b9Schristos   amq_string mi_mountpt;
102a53f50b9Schristos   amq_string mi_mountinfo;
103a53f50b9Schristos   amq_string mi_fserver;
104a53f50b9Schristos   int mi_error;
105a53f50b9Schristos   int mi_refc;
106a53f50b9Schristos   int mi_up;
107a53f50b9Schristos };
108a53f50b9Schristos 
109a53f50b9Schristos typedef struct {
110a53f50b9Schristos   u_int amq_mount_info_list_len;
111a53f50b9Schristos   amq_mount_info *amq_mount_info_list_val;
112a53f50b9Schristos } amq_mount_info_list;
113a53f50b9Schristos 
114a53f50b9Schristos typedef struct {
115a53f50b9Schristos   u_int amq_mount_tree_list_len;
116a53f50b9Schristos   amq_mount_tree_p *amq_mount_tree_list_val;
117a53f50b9Schristos } amq_mount_tree_list;
118a53f50b9Schristos 
1198bae5d40Schristos struct amq_map_info {
1208bae5d40Schristos   amq_string mi_name;
1218bae5d40Schristos   amq_string mi_wildcard;
1228bae5d40Schristos   time_type mi_modify;
1238bae5d40Schristos   int mi_flags;
1248bae5d40Schristos   int mi_refc;
1258bae5d40Schristos   int mi_up;
1268bae5d40Schristos   int mi_reloads;
1278bae5d40Schristos   int mi_nentries;
1288bae5d40Schristos };
1298bae5d40Schristos 
1308bae5d40Schristos typedef struct {
1318bae5d40Schristos   u_int amq_map_info_list_len;
1328bae5d40Schristos   amq_map_info *amq_map_info_list_val;
1338bae5d40Schristos } amq_map_info_list;
1348bae5d40Schristos 
135a53f50b9Schristos struct amq_mount_stats {
136a53f50b9Schristos   int as_drops;
137a53f50b9Schristos   int as_stale;
138a53f50b9Schristos   int as_mok;
139a53f50b9Schristos   int as_merr;
140a53f50b9Schristos   int as_uerr;
141a53f50b9Schristos };
142a53f50b9Schristos 
1434bcd344eSchristos typedef enum {
1444bcd344eSchristos   AMQ_UMNT_OK 		= 0,	/* must be zero! */
1454bcd344eSchristos   AMQ_UMNT_FAILED 	= 1,	/* unmount failed */
1464bcd344eSchristos   AMQ_UMNT_FORK 	= 2,	/* fork failed */
1474bcd344eSchristos   AMQ_UMNT_READ 	= 3,	/* pipe read failed */
1484bcd344eSchristos   AMQ_UMNT_SERVER 	= 4,	/* server down */
1494bcd344eSchristos   AMQ_UMNT_SIGNAL 	= 5	/* received signal */
1504bcd344eSchristos } au_etype;
1514bcd344eSchristos 
1524bcd344eSchristos struct amq_sync_umnt {
1534bcd344eSchristos 	au_etype	au_etype;	/* error type */
1544bcd344eSchristos 	int		au_errno;	/* error number */
1554bcd344eSchristos 	int		au_signal;	/* signal received */
1564bcd344eSchristos };
1574bcd344eSchristos 
158a53f50b9Schristos enum amq_opt {
159a53f50b9Schristos   AMOPT_DEBUG = 0,
160a53f50b9Schristos   AMOPT_LOGFILE = 1,
161a53f50b9Schristos   AMOPT_XLOG = 2,
162a53f50b9Schristos   AMOPT_FLUSHMAPC = 3
163a53f50b9Schristos };
164a53f50b9Schristos typedef enum amq_opt amq_opt;	/* enum typedefs should be after enum */
165a53f50b9Schristos 
166a53f50b9Schristos struct amq_setopt {
167a53f50b9Schristos   amq_opt as_opt;
168a53f50b9Schristos   amq_string as_str;
169a53f50b9Schristos };
170a53f50b9Schristos 
171a53f50b9Schristos /*
172a53f50b9Schristos  * EXTERNALS:
173a53f50b9Schristos  *
174a53f50b9Schristos  * external definitions for amqproc_*_1() have been moved off to private
175a53f50b9Schristos  * headers in lib/amu.h, amd/amd.h, etc.  They have to be private since the
176a53f50b9Schristos  * same named functions appear in different places with different prototypes
177a53f50b9Schristos  * an functionality.
178a53f50b9Schristos  */
179a53f50b9Schristos extern bool_t xdr_amq_mount_info(XDR *xdrs, amq_mount_info *objp);
180a53f50b9Schristos extern bool_t xdr_amq_mount_info_list(XDR *xdrs, amq_mount_info_list *objp);
1818bae5d40Schristos extern bool_t xdr_amq_map_info(XDR *xdrs, amq_map_info *objp);
1828bae5d40Schristos extern bool_t xdr_amq_map_info_list(XDR *xdrs, amq_map_info_list *objp);
183a53f50b9Schristos extern bool_t xdr_amq_mount_stats(XDR *xdrs, amq_mount_stats *objp);
184a53f50b9Schristos extern bool_t xdr_amq_mount_tree(XDR *xdrs, amq_mount_tree *objp);
185a53f50b9Schristos extern bool_t xdr_amq_mount_tree_list(XDR *xdrs, amq_mount_tree_list *objp);
186a53f50b9Schristos extern bool_t xdr_amq_mount_tree_p(XDR *xdrs, amq_mount_tree_p *objp);
187a53f50b9Schristos extern bool_t xdr_amq_opt(XDR *xdrs, amq_opt *objp);
188a53f50b9Schristos extern bool_t xdr_amq_setopt(XDR *xdrs, amq_setopt *objp);
1894bcd344eSchristos extern bool_t xdr_amq_sync_umnt(XDR *xdrs, amq_sync_umnt *objp);
190a53f50b9Schristos extern bool_t xdr_pri_free(XDRPROC_T_TYPE xdr_args, caddr_t args_ptr);
191a53f50b9Schristos extern bool_t xdr_time_type(XDR *xdrs, time_type *objp);
192a53f50b9Schristos 
193a53f50b9Schristos #endif /* not _AMQ_DEFS_H */
194