xref: /netbsd-src/external/bsd/am-utils/dist/fsinfo/fsi_data.h (revision 09afef20633f5fe63d92dfe43ee3a9380dc06883)
1 /*	$NetBSD: fsi_data.h,v 1.1.1.2 2009/03/20 20:26:55 christos Exp $	*/
2 
3 /*
4  * Copyright (c) 1997-2009 Erez Zadok
5  * Copyright (c) 1989 Jan-Simon Pendry
6  * Copyright (c) 1989 Imperial College of Science, Technology & Medicine
7  * Copyright (c) 1989 The Regents of the University of California.
8  * All rights reserved.
9  *
10  * This code is derived from software contributed to Berkeley by
11  * Jan-Simon Pendry at Imperial College, London.
12  *
13  * Redistribution and use in source and binary forms, with or without
14  * modification, are permitted provided that the following conditions
15  * are met:
16  * 1. Redistributions of source code must retain the above copyright
17  *    notice, this list of conditions and the following disclaimer.
18  * 2. Redistributions in binary form must reproduce the above copyright
19  *    notice, this list of conditions and the following disclaimer in the
20  *    documentation and/or other materials provided with the distribution.
21  * 3. All advertising materials mentioning features or use of this software
22  *    must display the following acknowledgment:
23  *      This product includes software developed by the University of
24  *      California, Berkeley and its contributors.
25  * 4. Neither the name of the University nor the names of its contributors
26  *    may be used to endorse or promote products derived from this software
27  *    without specific prior written permission.
28  *
29  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
30  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
31  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
32  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
33  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
34  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
35  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
36  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
37  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
38  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
39  * SUCH DAMAGE.
40  *
41  *
42  * File: am-utils/fsinfo/fsi_data.h
43  *
44  */
45 
46 #ifndef _FSI_DATA_H
47 #define _FSI_DATA_H
48 
49 typedef struct auto_tree auto_tree;
50 typedef struct automount automount;
51 typedef struct dict dict;
52 typedef struct dict_data dict_data;
53 typedef struct dict_ent dict_ent;
54 typedef struct disk_fs disk_fs;
55 typedef struct ether_if ether_if;
56 typedef struct fsmount fsmount;
57 typedef struct host host;
58 typedef struct ioloc ioloc;
59 typedef struct fsi_mount fsi_mount;
60 
61 
62 /*
63  * Automount tree
64  */
65 struct automount {
66   qelem a_q;
67   ioloc *a_ioloc;
68   char *a_name;			/* Automount key */
69   char *a_volname;		/* Equivalent volume to be referenced */
70   char *a_symlink;		/* Symlink representation */
71   char *a_opts;			/* opts for mounting */
72   char *a_hardwiredfs;		/* hack to bypass bogus fs definitions */
73   qelem *a_mount;		/* Tree representation */
74   dict_ent *a_mounted;
75 };
76 
77 /*
78  * List of automount trees
79  */
80 struct auto_tree {
81   qelem t_q;
82   ioloc *t_ioloc;
83   char *t_defaults;
84   qelem *t_mount;
85 };
86 
87 /*
88  * A host
89  */
90 struct host {
91   qelem q;
92   int h_mask;
93   ioloc *h_ioloc;
94   fsmount *h_netroot, *h_netswap;
95 #define HF_HOST	0
96   char *h_hostname;	/* The full name of the host */
97   char *h_lochost;	/* The name of the host with local domains stripped */
98   char *h_hostpath;	/* The filesystem path to the host (cf
99 			   compute_hostpath) */
100 #define	HF_ETHER 1
101   qelem *h_ether;
102 #define	HF_CONFIG 2
103   qelem *h_config;
104 #define	HF_ARCH 3
105   char *h_arch;
106 #define	HF_CLUSTER 4
107   char *h_cluster;
108 #define	HF_OS 5
109   char *h_os;
110   qelem *h_disk_fs;
111   qelem *h_mount;
112 };
113 
114 /*
115  * An ethernet interface
116  */
117 struct ether_if {
118   qelem e_q;
119   int e_mask;
120   ioloc *e_ioloc;
121   char *e_if;
122 #define	EF_INADDR 0
123   struct in_addr e_inaddr;
124 #define	EF_NETMASK 1
125   u_long e_netmask;
126 #define	EF_HWADDR 2
127   char *e_hwaddr;
128 };
129 
130 /*
131  * Disk filesystem structure.
132  *
133  * If the DF_* numbers are changed
134  * disk_fs_strings in analyze.c will
135  * need updating.
136  */
137 struct disk_fs {
138   qelem d_q;
139   int d_mask;
140   ioloc *d_ioloc;
141   host *d_host;
142   char *d_mountpt;
143   char *d_dev;
144 #define	DF_FSTYPE	0
145   char *d_fstype;
146 #define	DF_OPTS		1
147   char *d_opts;
148 #define	DF_DUMPSET	2
149   char *d_dumpset;
150 #define	DF_PASSNO	3
151   int d_passno;
152 #define	DF_FREQ		4
153   int d_freq;
154 #define	DF_MOUNT	5
155   qelem *d_mount;
156 #define	DF_LOG		6
157   char *d_log;
158 };
159 
160 #define	DF_REQUIRED	((1<<DF_FSTYPE)|(1<<DF_OPTS)|(1<<DF_PASSNO)|(1<<DF_MOUNT))
161 
162 /*
163  * A mount tree
164  */
165 struct fsi_mount {
166   qelem m_q;
167   ioloc *m_ioloc;
168   int m_mask;
169 #define	DM_VOLNAME	0
170   char *m_volname;
171 #define	DM_EXPORTFS	1
172   char *m_exportfs;
173 #define	DM_SEL		2
174   char *m_sel;
175   char *m_name;
176   int m_name_len;
177   fsi_mount *m_parent;
178   disk_fs *m_dk;
179   fsi_mount *m_exported;
180   qelem *m_mount;
181 };
182 
183 /*
184  * Additional filesystem mounts
185  *
186  * If the FM_* numbers are changed
187  * disk_fs_strings in analyze.c will
188  * need updating.
189  */
190 struct fsmount {
191   qelem f_q;
192   fsi_mount *f_ref;
193   ioloc *f_ioloc;
194   int f_mask;
195 #define	FM_LOCALNAME	0
196   char *f_localname;
197 #define	FM_VOLNAME	1
198   char *f_volname;
199 #define	FM_FSTYPE	2
200   char *f_fstype;
201 #define	FM_OPTS		3
202   char *f_opts;
203 #define	FM_FROM		4
204   char *f_from;
205 #define FM_DIRECT	5
206 };
207 
208 #define	FM_REQUIRED	((1<<FM_VOLNAME)|(1<<FM_FSTYPE)|(1<<FM_OPTS)|(1<<FM_FROM)|(1<<FM_LOCALNAME))
209 #define	FM_NETROOT	0x01
210 #define	FM_NETSWAP	0x02
211 #define	FM_NETBOOT	(FM_NETROOT|FM_NETSWAP)
212 
213 #define	DICTHASH	5
214 struct dict_ent {
215   dict_ent *de_next;
216   char *de_key;
217   int de_count;
218   qelem de_q;
219 };
220 
221 /*
222  * Dictionaries ...
223  */
224 struct dict_data {
225   qelem dd_q;
226   char *dd_data;
227 };
228 
229 struct dict {
230   dict_ent *de[DICTHASH];
231 };
232 
233 /*
234  * Source text location for error reports
235  */
236 struct ioloc {
237   int i_line;
238   char *i_file;
239 };
240 #endif /* not _FSI_DATA_H */
241