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