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