4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright (c) 1996, 1998, 1999 by Sun Microsystems, Inc.
24 * All rights reserved.
30 #pragma ident "%Z%%M% %I% %E% SMI"
36 #define BPSEC 512 /* Assumed # of bytes per sector */
40 #define BOOTSECSIG 0xAA55
43 * Offset (in bytes) from address of boot sector to where we put
44 * the backup copy of that sector. (FAT32 only)
46 #define BKUP_BOOTSECT_OFFSET 0xC00
48 #define uppercase(c) ((c) >= 'a' && (c) <= 'z' ? (c) - 'a' + 'A' : (c))
50 #define FAT12_TYPE_STRING "FAT12 "
51 #define FAT16_TYPE_STRING "FAT16 "
52 #define FAT32_TYPE_STRING "FAT32 "
54 #define FAT12_ENTSPERSECT 341
55 #define FAT16_ENTSPERSECT 256
56 #define FAT32_ENTSPERSECT 128
59 #define SUNIXOSBOOT 190 /* Solaris UNIX boot partition */
63 * A macro implementing a ceiling function for integer divides.
65 #define idivceil(dvend, dvsor) \
66 ((dvend)/(dvsor) + (((dvend)%(dvsor) == 0) ? 0 : 1))
69 * Return values for the seek_XXX functions
71 #define PART_NOT_FOUND 0
77 * ---------------------
79 * |-------------------|
81 * |-------------------|
83 * |-------------------|
85 * |-------------------|
87 * |-------------------|
90 * |___________________|
96 struct _orig_bios_param_blk
{
97 uint16_t bytes_sector
;
98 uchar_t sectors_per_cluster
;
99 uint16_t resv_sectors
;
101 uint16_t num_root_entries
;
102 uint16_t sectors_in_volume
;
104 uint16_t sectors_per_fat
;
105 uint16_t sectors_per_track
;
107 uint32_t hidden_sectors
;
108 uint32_t sectors_in_logical_volume
;
117 struct _bpb32_extensions
{
118 uint32_t big_sectors_per_fat
;
122 uint32_t root_dir_clust
;
125 uint16_t reserved
[6];
134 struct _bpb_extensions
{
135 uchar_t phys_drive_num
;
137 uchar_t ext_signature
;
139 uchar_t volume_label
[11];
149 struct _sun_bpb_extensions
{
150 uint16_t bs_offset_high
;
151 uint16_t bs_offset_low
;
158 * bpb_t is a conglomeration of all the fields a bpb can have. Every
159 * bpb will have the orig_bios struct, but only FAT32's will have bpb32,
160 * and only Solaris boot diskettes will have the sunbpb structure.
162 typedef struct _bios_param_blk
{
163 struct _orig_bios_param_blk bpb
;
164 struct _bpb32_extensions bpb32
;
165 struct _bpb_extensions ebpb
;
166 struct _sun_bpb_extensions sunbpb
;
172 uchar_t bs_jump_code
[3];
173 uchar_t bs_oem_name
[8];
174 struct _orig_bios_param_blk bs_bpb
;
179 struct _boot_sector
{
180 struct _bpb_head bs_front
;
181 struct _bpb_extensions bs_ebpb
;
182 struct _sun_bpb_extensions bs_sebpb
;
183 uchar_t bs_bootstrap
[444];
184 uchar_t bs_signature
[2];
189 struct _boot_sector32
{
190 struct _bpb_head bs_front
;
191 struct _bpb32_extensions bs_bpb32
;
192 struct _bpb_extensions bs_ebpb
;
193 uchar_t bs_bootstrap
[420];
194 uchar_t bs_signature
[2];
198 #define ORIG_BPB_START_INDEX 8 /* index into filler field */
199 #define EXT_BPB_START_INDEX 33 /* index into filler field */
200 #define BPB_32_START_INDEX 33 /* index into filler field */
201 #define EXT_BPB_32_START_INDEX 61 /* index into filler field */
202 struct _boot_sector
{
203 uchar_t bs_jump_code
[3];
204 uchar_t bs_filler
[59];
205 uchar_t bs_sun_bpb
[4];
206 uchar_t bs_bootstrap
[444];
207 uchar_t bs_signature
[2];
210 struct _boot_sector32
{
211 uchar_t bs_jump_code
[3];
212 uchar_t bs_filler
[87];
213 uchar_t bs_bootstrap
[420];
214 uchar_t bs_signature
[2];
218 typedef union _ubso
{
219 struct _boot_sector bs
;
220 struct _boot_sector32 bs32
;
229 #endif /* _MKFS_PCFS_H */