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