Home | History | Annotate | Line # | Download | only in bootblk
      1 #	$NetBSD: genfth.cf,v 1.10 2022/11/17 06:40:39 chs Exp $
      2 
      3 #
      4 # Copyright (c) 1997 The NetBSD Foundation, Inc.
      5 # All rights reserved.
      6 #
      7 # This code is derived from software contributed to The NetBSD Foundation
      8 # by Christos Zoulas.
      9 #
     10 # Redistribution and use in source and binary forms, with or without
     11 # modification, are permitted provided that the following conditions
     12 # are met:
     13 # 1. Redistributions of source code must retain the above copyright
     14 #    notice, this list of conditions and the following disclaimer.
     15 # 2. Redistributions in binary form must reproduce the above copyright
     16 #    notice, this list of conditions and the following disclaimer in the
     17 #    documentation and/or other materials provided with the distribution.
     18 #
     19 # THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     20 # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     21 # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     22 # PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     23 # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     24 # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     25 # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     26 # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     27 # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     28 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     29 # POSSIBILITY OF SUCH DAMAGE.
     30 #
     31 # Copyright (c) 1992, 1993
     32 #	The Regents of the University of California.  All rights reserved.
     33 #
     34 # This software was developed by the Computer Systems Engineering group
     35 # at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
     36 # contributed to Berkeley.
     37 #
     38 # All advertising materials mentioning features or use of this software
     39 # must display the following acknowledgement:
     40 #	This product includes software developed by the University of
     41 #	California, Lawrence Berkeley Laboratory.
     42 #
     43 # Redistribution and use in source and binary forms, with or without
     44 # modification, are permitted provided that the following conditions
     45 # are met:
     46 # 1. Redistributions of source code must retain the above copyright
     47 #    notice, this list of conditions and the following disclaimer.
     48 # 2. Redistributions in binary form must reproduce the above copyright
     49 #    notice, this list of conditions and the following disclaimer in the
     50 #    documentation and/or other materials provided with the distribution.
     51 # 3. All advertising materials mentioning features or use of this software
     52 #    must display the following acknowledgement:
     53 #	This product includes software developed by the University of
     54 #	California, Berkeley and its contributors.
     55 # 4. Neither the name of the University nor the names of its contributors
     56 #    may be used to endorse or promote products derived from this software
     57 #    without specific prior written permission.
     58 #
     59 # THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     60 # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     61 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     62 # ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     63 # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     64 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     65 # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     66 # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     67 # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     68 # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     69 # SUCH DAMAGE.
     70 #
     71 #	@(#)genassym.c	8.1 (Berkeley) 6/11/93
     72 #
     73 
     74 include <sys/param.h>
     75 include <sys/time.h>
     76 include <ufs/ufs/dinode.h>
     77 include <ufs/ufs/dir.h>
     78 include <ufs/ffs/fs.h>
     79 include <dev/raidframe/raidframevar.h>
     80 
     81 #
     82 # ufs sizing constants
     83 #
     84 define	dev_bsize	DEV_BSIZE
     85 define	maxbsize	MAXBSIZE
     86 define	bbsize		BBSIZE
     87 define	sbsize		SBLOCKSIZE
     88 define	bboff		BBOFF
     89 define	sboff		SBLOCK_UFS1
     90 define	bblock		BBLOCK
     91 # XXX: Will not work for UFS2!
     92 define	sblock		SBLOCK_UFS1
     93 
     94 # RAID1 boot support
     95 define	rf_protected	RF_PROTECTED_SECTORS
     96 
     97 #
     98 # ufs superblock
     99 #
    100 struct	fs
    101 member	fs_magic
    102 member	fs_bsize
    103 member	fs_old_npsect
    104 member	fs_old_nsect
    105 member	fs_old_interleave
    106 member	fs_old_postblformat
    107 member	fs_old_nrpos
    108 member	fs_old_inodefmt
    109 member	fs_maxfilesize
    110 member	fs_qbmask
    111 member	fs_qfmask
    112 member	fs_bmask
    113 member	fs_fmask
    114 member	fs_ipg
    115 member	fs_fpg
    116 member	fs_inopb
    117 member	fs_fragshift
    118 member	fs_bshift
    119 member	fs_fshift
    120 member	fs_old_cgoffset
    121 member	fs_old_cgmask
    122 member	fs_dblkno
    123 member	fs_iblkno
    124 member	fs_sblkno
    125 member	fs_cblkno
    126 member  fs_fsbtodb
    127 member	fs_nindir
    128 member	fs_frag
    129 member	fs_maxsymlinklen
    130 
    131 #
    132 # ufs1 dinode
    133 #
    134 struct	ufs1_dinode
    135 member	di1_size	di_size
    136 member	di1_mode	di_mode
    137 member	di1_db		di_db
    138 member	di1_ib		di_ib
    139 
    140 #
    141 # ufs2 dinode
    142 #
    143 struct	ufs2_dinode
    144 member	di2_size	di_size
    145 member	di2_mode	di_mode
    146 member	di2_db		di_db
    147 member	di2_ib		di_ib
    148 
    149 #
    150 # ufs direct
    151 #
    152 struct	direct
    153 member	d_ino
    154 member	d_reclen
    155 #member	d_type		# notused
    156 member	d_namlen
    157 member	d_name
    158 
    159 define	fs1_magic_value	FS_UFS1_MAGIC
    160 define	fs2_magic_value	FS_UFS2_MAGIC
    161 define	fs2ea_magic_value FS_UFS2EA_MAGIC
    162 define	fs_42postblfmt	FS_42POSTBLFMT
    163 define	fs_44inodefmt	FS_44INODEFMT
    164 define	ndaddr		UFS_NDADDR
    165 define	niaddr		UFS_NIADDR
    166 define	rootino		UFS_ROOTINO
    167 define	ifmt		IFMT
    168 define	ifdir		IFDIR
    169 define	iflnk		IFLNK
    170