xref: /original-bsd/usr.sbin/amd/fsinfo/fsinfo.h (revision c3e32dec)
1 /*
2  * Copyright (c) 1989 Jan-Simon Pendry
3  * Copyright (c) 1989 Imperial College of Science, Technology & Medicine
4  * Copyright (c) 1989, 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  * %sccs.include.redist.c%
11  *
12  *	@(#)fsinfo.h	8.1 (Berkeley) 06/06/93
13  *
14  * $Id: fsinfo.h,v 5.2.2.1 1992/02/09 15:09:51 jsp beta $
15  *
16  */
17 
18 /*
19  * Get this in now so that OS_HDR can use it
20  */
21 #ifdef __STDC__
22 #define	P(x) x
23 #define	P_void void
24 #define Const const
25 #else
26 #define P(x) ()
27 #define P_void /* as nothing */
28 #define Const /* as nothing */
29 #endif /* __STDC__ */
30 
31 #ifdef __GNUC__
32 #define INLINE /* __inline */
33 #else
34 #define	INLINE
35 #endif /* __GNUC__ */
36 
37 /*
38  * Pick up target dependent definitions
39  */
40 #include "os-defaults.h"
41 #include OS_HDR
42 
43 #ifdef VOIDP
44 typedef void *voidp;
45 #else
46 typedef char *voidp;
47 #endif /* VOIDP */
48 
49 #include <stdio.h>
50 #include <sys/types.h>
51 #include <sys/param.h>
52 
53 /*
54  * Bogosity to deal with ether { ... }
55  */
56 #include <sys/socket.h>
57 #include <netinet/in.h>
58 #include <net/if.h>
59 #include <netinet/if_ether.h>
60 
61 #include "fsi_data.h"
62 
63 extern char* strchr P((Const char*, int)); /* C */
64 extern char* strrchr P((Const char*, int)); /* C */
65 extern char *strdup P((char*)); /* C */
66 extern void fatal();
67 extern void warning();
68 extern void error();
69 extern void analyze_automounts P((qelem*));
70 extern void analyze_hosts P((qelem*));
71 extern void compute_automount_point P((char*, host*, char*));
72 extern automount *new_automount P((char*));
73 extern auto_tree *new_auto_tree P((char*, qelem*));
74 extern host *new_host P((void));
75 extern disk_fs *new_disk_fs P((void));
76 extern void set_disk_fs P((disk_fs*, int, char*));
77 extern ether_if *new_ether_if P((void));
78 extern mount *new_mount P((void));
79 extern void set_mount P((mount*, int, char*));
80 extern fsmount *new_fsmount P((void));
81 extern void set_fsmount P((fsmount*, int, char*));
82 extern qelem *new_que P((void));
83 extern void init_que P((qelem*));
84 extern void ins_que P((qelem*, qelem*));
85 extern void rem_que P((qelem*));
86 extern dict *new_dict P((void));
87 extern dict_ent *dict_locate P((dict*, char*));
88 extern void dict_add P((dict*, char*, char*));
89 extern int dict_iter P((dict*, int (*)()));
90 extern void info_hdr();
91 extern void gen_hdr();
92 extern FILE *pref_open();
93 extern int pref_close();
94 extern ioloc *current_location();
95 
96 extern char *disk_fs_strings[];
97 extern char *mount_strings[];
98 extern char *fsmount_strings[];
99 extern char *host_strings[];
100 extern char *ether_if_strings[];
101 extern char *autodir;
102 extern char *progname;
103 extern char hostname[];
104 extern char *username;
105 extern char **g_argv;
106 extern char *fstab_pref;
107 extern char *exportfs_pref;
108 extern char *mount_pref;
109 extern char *dumpset_pref;
110 extern char *bootparams_pref;
111 extern char idvbuf[];
112 
113 extern int file_io_errors;
114 extern int parse_errors;
115 extern int errors;
116 extern int verbose;
117 
118 extern dict *dict_of_hosts;
119 extern dict *dict_of_volnames;
120 
121 extern char *xcalloc();
122 extern char *xmalloc();
123 #define	ALLOC(x)	((struct x *) xcalloc(1, sizeof(struct x)))
124 #define	STREQ(s,t)	(*(s) == *(t) && strcmp((s)+1,(t)+1) == 0)
125 #define	ISSET(m,b)	((m) & (1<<(b)))
126 #define	BITSET(m,b)	((m) |= (1<<(b)))
127 
128 #define	FIRST(ty, q)	((ty *) ((q)->q_forw))
129 #define	LAST(ty, q)	((ty *) ((q)->q_back))
130 #define	NEXT(ty, q)	((ty *) (((qelem *) q)->q_forw))
131 #define	HEAD(ty, q)	((ty *) q)
132 #define	ITER(v, ty, q) \
133 	for ((v) = FIRST(ty,(q)); (v) != HEAD(ty,(q)); (v) = NEXT(ty,(v)))
134