fsi_data.h revision 174294
138494Sobrien/*
2174294Sobrien * Copyright (c) 1997-2006 Erez Zadok
338494Sobrien * Copyright (c) 1989 Jan-Simon Pendry
438494Sobrien * Copyright (c) 1989 Imperial College of Science, Technology & Medicine
538494Sobrien * Copyright (c) 1989 The Regents of the University of California.
638494Sobrien * All rights reserved.
738494Sobrien *
838494Sobrien * This code is derived from software contributed to Berkeley by
938494Sobrien * Jan-Simon Pendry at Imperial College, London.
1038494Sobrien *
1138494Sobrien * Redistribution and use in source and binary forms, with or without
1238494Sobrien * modification, are permitted provided that the following conditions
1338494Sobrien * are met:
1438494Sobrien * 1. Redistributions of source code must retain the above copyright
1538494Sobrien *    notice, this list of conditions and the following disclaimer.
1638494Sobrien * 2. Redistributions in binary form must reproduce the above copyright
1738494Sobrien *    notice, this list of conditions and the following disclaimer in the
1838494Sobrien *    documentation and/or other materials provided with the distribution.
1938494Sobrien * 3. All advertising materials mentioning features or use of this software
2042629Sobrien *    must display the following acknowledgment:
2138494Sobrien *      This product includes software developed by the University of
2238494Sobrien *      California, Berkeley and its contributors.
2338494Sobrien * 4. Neither the name of the University nor the names of its contributors
2438494Sobrien *    may be used to endorse or promote products derived from this software
2538494Sobrien *    without specific prior written permission.
2638494Sobrien *
2738494Sobrien * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2838494Sobrien * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2938494Sobrien * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
3038494Sobrien * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
3138494Sobrien * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
3238494Sobrien * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
3338494Sobrien * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
3438494Sobrien * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
3538494Sobrien * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3638494Sobrien * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3738494Sobrien * SUCH DAMAGE.
3838494Sobrien *
3938494Sobrien *
40174294Sobrien * File: am-utils/fsinfo/fsi_data.h
4138494Sobrien *
4238494Sobrien */
4338494Sobrien
44174294Sobrien#ifndef _FSI_DATA_H
45174294Sobrien#define _FSI_DATA_H
46174294Sobrien
4738494Sobrientypedef struct auto_tree auto_tree;
4838494Sobrientypedef struct automount automount;
4938494Sobrientypedef struct dict dict;
5038494Sobrientypedef struct dict_data dict_data;
5138494Sobrientypedef struct dict_ent dict_ent;
5238494Sobrientypedef struct disk_fs disk_fs;
5338494Sobrientypedef struct ether_if ether_if;
5438494Sobrientypedef struct fsmount fsmount;
5538494Sobrientypedef struct host host;
5638494Sobrientypedef struct ioloc ioloc;
5738494Sobrientypedef struct fsi_mount fsi_mount;
5838494Sobrien
5938494Sobrien
6038494Sobrien/*
6138494Sobrien * Automount tree
6238494Sobrien */
6338494Sobrienstruct automount {
6438494Sobrien  qelem a_q;
6538494Sobrien  ioloc *a_ioloc;
6638494Sobrien  char *a_name;			/* Automount key */
6738494Sobrien  char *a_volname;		/* Equivalent volume to be referenced */
6838494Sobrien  char *a_symlink;		/* Symlink representation */
6938494Sobrien  char *a_opts;			/* opts for mounting */
7038494Sobrien  char *a_hardwiredfs;		/* hack to bypass bogus fs definitions */
7138494Sobrien  qelem *a_mount;		/* Tree representation */
7238494Sobrien  dict_ent *a_mounted;
7338494Sobrien};
7438494Sobrien
7538494Sobrien/*
7638494Sobrien * List of automount trees
7738494Sobrien */
7838494Sobrienstruct auto_tree {
7938494Sobrien  qelem t_q;
8038494Sobrien  ioloc *t_ioloc;
8138494Sobrien  char *t_defaults;
8238494Sobrien  qelem *t_mount;
8338494Sobrien};
8438494Sobrien
8538494Sobrien/*
8638494Sobrien * A host
8738494Sobrien */
8838494Sobrienstruct host {
8938494Sobrien  qelem q;
9038494Sobrien  int h_mask;
9138494Sobrien  ioloc *h_ioloc;
9238494Sobrien  fsmount *h_netroot, *h_netswap;
9338494Sobrien#define HF_HOST	0
9442629Sobrien  char *h_hostname;	/* The full name of the host */
9542629Sobrien  char *h_lochost;	/* The name of the host with local domains stripped */
9642629Sobrien  char *h_hostpath;	/* The filesystem path to the host (cf
9742629Sobrien			   compute_hostpath) */
9838494Sobrien#define	HF_ETHER 1
9938494Sobrien  qelem *h_ether;
10038494Sobrien#define	HF_CONFIG 2
10138494Sobrien  qelem *h_config;
10238494Sobrien#define	HF_ARCH 3
10338494Sobrien  char *h_arch;
10438494Sobrien#define	HF_CLUSTER 4
10538494Sobrien  char *h_cluster;
10638494Sobrien#define	HF_OS 5
10738494Sobrien  char *h_os;
10838494Sobrien  qelem *h_disk_fs;
10938494Sobrien  qelem *h_mount;
11038494Sobrien};
11138494Sobrien
11238494Sobrien/*
11338494Sobrien * An ethernet interface
11438494Sobrien */
11538494Sobrienstruct ether_if {
11638494Sobrien  qelem e_q;
11738494Sobrien  int e_mask;
11838494Sobrien  ioloc *e_ioloc;
11938494Sobrien  char *e_if;
12038494Sobrien#define	EF_INADDR 0
12138494Sobrien  struct in_addr e_inaddr;
12238494Sobrien#define	EF_NETMASK 1
12338494Sobrien  u_long e_netmask;
12438494Sobrien#define	EF_HWADDR 2
12538494Sobrien  char *e_hwaddr;
12638494Sobrien};
12738494Sobrien
12838494Sobrien/*
12938494Sobrien * Disk filesystem structure.
13038494Sobrien *
13138494Sobrien * If the DF_* numbers are changed
13238494Sobrien * disk_fs_strings in analyze.c will
13338494Sobrien * need updating.
13438494Sobrien */
13538494Sobrienstruct disk_fs {
13638494Sobrien  qelem d_q;
13738494Sobrien  int d_mask;
13838494Sobrien  ioloc *d_ioloc;
13938494Sobrien  host *d_host;
14038494Sobrien  char *d_mountpt;
14138494Sobrien  char *d_dev;
14238494Sobrien#define	DF_FSTYPE	0
14338494Sobrien  char *d_fstype;
14438494Sobrien#define	DF_OPTS		1
14538494Sobrien  char *d_opts;
14638494Sobrien#define	DF_DUMPSET	2
14738494Sobrien  char *d_dumpset;
14838494Sobrien#define	DF_PASSNO	3
14938494Sobrien  int d_passno;
15038494Sobrien#define	DF_FREQ		4
15138494Sobrien  int d_freq;
15238494Sobrien#define	DF_MOUNT	5
15338494Sobrien  qelem *d_mount;
15438494Sobrien#define	DF_LOG		6
15538494Sobrien  char *d_log;
15638494Sobrien};
15738494Sobrien
15838494Sobrien#define	DF_REQUIRED	((1<<DF_FSTYPE)|(1<<DF_OPTS)|(1<<DF_PASSNO)|(1<<DF_MOUNT))
15938494Sobrien
16038494Sobrien/*
16138494Sobrien * A mount tree
16238494Sobrien */
16338494Sobrienstruct fsi_mount {
16438494Sobrien  qelem m_q;
16538494Sobrien  ioloc *m_ioloc;
16638494Sobrien  int m_mask;
16738494Sobrien#define	DM_VOLNAME	0
16838494Sobrien  char *m_volname;
16938494Sobrien#define	DM_EXPORTFS	1
17038494Sobrien  char *m_exportfs;
17138494Sobrien#define	DM_SEL		2
17238494Sobrien  char *m_sel;
17338494Sobrien  char *m_name;
17438494Sobrien  int m_name_len;
17538494Sobrien  fsi_mount *m_parent;
17638494Sobrien  disk_fs *m_dk;
17738494Sobrien  fsi_mount *m_exported;
17838494Sobrien  qelem *m_mount;
17938494Sobrien};
18038494Sobrien
18138494Sobrien/*
18238494Sobrien * Additional filesystem mounts
18338494Sobrien *
18438494Sobrien * If the FM_* numbers are changed
18538494Sobrien * disk_fs_strings in analyze.c will
18638494Sobrien * need updating.
18738494Sobrien */
18838494Sobrienstruct fsmount {
18938494Sobrien  qelem f_q;
19038494Sobrien  fsi_mount *f_ref;
19138494Sobrien  ioloc *f_ioloc;
19238494Sobrien  int f_mask;
19338494Sobrien#define	FM_LOCALNAME	0
19438494Sobrien  char *f_localname;
19538494Sobrien#define	FM_VOLNAME	1
19638494Sobrien  char *f_volname;
19738494Sobrien#define	FM_FSTYPE	2
19838494Sobrien  char *f_fstype;
19938494Sobrien#define	FM_OPTS		3
20038494Sobrien  char *f_opts;
20138494Sobrien#define	FM_FROM		4
20238494Sobrien  char *f_from;
20338494Sobrien#define FM_DIRECT	5
20438494Sobrien};
20538494Sobrien
20638494Sobrien#define	FM_REQUIRED	((1<<FM_VOLNAME)|(1<<FM_FSTYPE)|(1<<FM_OPTS)|(1<<FM_FROM)|(1<<FM_LOCALNAME))
20738494Sobrien#define	FM_NETROOT	0x01
20838494Sobrien#define	FM_NETSWAP	0x02
20938494Sobrien#define	FM_NETBOOT	(FM_NETROOT|FM_NETSWAP)
21038494Sobrien
21138494Sobrien#define	DICTHASH	5
21238494Sobrienstruct dict_ent {
21338494Sobrien  dict_ent *de_next;
21438494Sobrien  char *de_key;
21538494Sobrien  int de_count;
21638494Sobrien  qelem de_q;
21738494Sobrien};
21838494Sobrien
21938494Sobrien/*
22038494Sobrien * Dictionaries ...
22138494Sobrien */
22238494Sobrienstruct dict_data {
22338494Sobrien  qelem dd_q;
22438494Sobrien  char *dd_data;
22538494Sobrien};
22638494Sobrien
22738494Sobrienstruct dict {
22838494Sobrien  dict_ent *de[DICTHASH];
22938494Sobrien};
23038494Sobrien
23138494Sobrien/*
23238494Sobrien * Source text location for error reports
23338494Sobrien */
23438494Sobrienstruct ioloc {
23538494Sobrien  int i_line;
23638494Sobrien  char *i_file;
23738494Sobrien};
238174294Sobrien#endif /* not _FSI_DATA_H */
239