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