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