pcfs_bpb.h revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 1999 by Sun Microsystems, Inc.
* All rights reserved.
*/
#ifndef _PCFS_BPB_H
#define _PCFS_BPB_H
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef __cplusplus
extern "C" {
#endif
/*
* Common Bios Parameter Block definitions for the pcfs user-level utilities
*
* At press time these definitions are duplicated in mkfs_pcfs.h. They really
* need to be separated out of mkfs_pcfs.h and then it should reference this
* file.
*/
#define OPCODE1 0xE9
#define OPCODE2 0xEB
#define BOOTSECSIG 0xAA55
/*
* Offset (in bytes) from address of boot sector to where we put
* the backup copy of that sector. (FAT32 only)
*/
#define BKUP_BOOTSECT_OFFSET 0xC00
#define FAT12_TYPE_STRING "FAT12 "
#define FAT16_TYPE_STRING "FAT16 "
#define FAT32_TYPE_STRING "FAT32 "
#define FAT12_ENTSPERSECT 341
#define FAT16_ENTSPERSECT 256
#define FAT32_ENTSPERSECT 128
#ifndef SUNIXOSBOOT
#endif
/*
* MS-DOS Disk layout:
*
* ---------------------
* | Boot sector |
* |-------------------|
* | Reserved area |
* |-------------------|
* | FAT #1 |
* |-------------------|
* | FAT #2 |
* |-------------------|
* | Root directory |
* |-------------------|
* | |
* | File area |
* |___________________|
*/
#ifdef i386
#pragma pack(1)
#endif
struct _orig_bios_param_blk {
/*
* The sectors_in_volume field will be zero on larger volumes (>32Mb)
* and newer file systems (>=MSDOS4.0). In these cases the
* sectors_in_logical_volume field should be used instead.
*/
/*
* Number of sectors in the partition prior to the start of the logical disk
*/
};
#ifdef i386
#pragma pack()
#endif
#ifdef i386
#pragma pack(1)
#endif
struct _bpb32_extensions {
};
#ifdef i386
#pragma pack()
#endif
#ifdef i386
#pragma pack(1)
#endif
struct _bpb_extensions {
};
#ifdef i386
#pragma pack()
#endif
#ifdef i386
#pragma pack(1)
#endif
struct _sun_bpb_extensions {
};
#ifdef i386
#pragma pack()
#endif
/*
* bpb_t is a conglomeration of all the fields a bpb can have. Every
* bpb will have the orig_bios struct, but only FAT32's will have bpb32,
* and only Solaris boot diskettes will have the sunbpb structure.
*/
typedef struct _bios_param_blk {
struct _orig_bios_param_blk bpb;
struct _bpb32_extensions bpb32;
struct _bpb_extensions ebpb;
struct _sun_bpb_extensions sunbpb;
} bpb_t;
#ifdef i386
#pragma pack(1)
struct _bpb_head {
struct _orig_bios_param_blk bs_bpb;
};
#pragma pack()
#pragma pack(1)
struct _boot_sector {
struct _bpb_extensions bs_ebpb;
struct _sun_bpb_extensions bs_sebpb;
};
#pragma pack()
#pragma pack(1)
struct _boot_sector32 {
struct _bpb32_extensions bs_bpb32;
struct _bpb_extensions bs_ebpb;
};
#pragma pack()
#else
struct _boot_sector {
};
struct _boot_sector32 {
};
#endif
typedef union _ubso {
struct _boot_sector bs;
struct _boot_sector32 bs32;
#ifdef __cplusplus
}
#endif
#endif /* _PCFS_BPB_H */