vaseboot/include/VasEBoot/fat.h

78 lines
2.5 KiB
C

/*
* VAS_EBOOT -- GRand Unified Bootloader
* Copyright (C) 2000,2001,2002,2003,2004,2005,2007,2008,2009 Free Software Foundation, Inc.
*
* VAS_EBOOT is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* VAS_EBOOT is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with VAS_EBOOT. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef VAS_EBOOT_FAT_H
#define VAS_EBOOT_FAT_H 1
#include <VasEBoot/types.h>
struct VasEBoot_fat_bpb
{
VasEBoot_uint8_t jmp_boot[3];
VasEBoot_uint8_t oem_name[8];
VasEBoot_uint16_t bytes_per_sector;
VasEBoot_uint8_t sectors_per_cluster;
VasEBoot_uint16_t num_reserved_sectors;
VasEBoot_uint8_t num_fats; /* 0x10 */
VasEBoot_uint16_t num_root_entries;
VasEBoot_uint16_t num_total_sectors_16;
VasEBoot_uint8_t media; /* 0x15 */
VasEBoot_uint16_t sectors_per_fat_16;
VasEBoot_uint16_t sectors_per_track; /* 0x18 */
VasEBoot_uint16_t num_heads; /* 0x1A */
VasEBoot_uint32_t num_hidden_sectors; /* 0x1C */
VasEBoot_uint32_t num_total_sectors_32; /* 0x20 */
union
{
struct
{
VasEBoot_uint8_t num_ph_drive;
VasEBoot_uint8_t reserved;
VasEBoot_uint8_t boot_sig;
VasEBoot_uint32_t num_serial;
VasEBoot_uint8_t label[11];
VasEBoot_uint8_t fstype[8];
} VAS_EBOOT_PACKED fat12_or_fat16;
struct
{
VasEBoot_uint32_t sectors_per_fat_32;
VasEBoot_uint16_t extended_flags;
VasEBoot_uint16_t fs_version;
VasEBoot_uint32_t root_cluster;
VasEBoot_uint16_t fs_info;
VasEBoot_uint16_t backup_boot_sector;
VasEBoot_uint8_t reserved[12];
VasEBoot_uint8_t num_ph_drive;
VasEBoot_uint8_t reserved1;
VasEBoot_uint8_t boot_sig;
VasEBoot_uint32_t num_serial;
VasEBoot_uint8_t label[11];
VasEBoot_uint8_t fstype[8];
} VAS_EBOOT_PACKED fat32;
} VAS_EBOOT_PACKED version_specific;
} VAS_EBOOT_PACKED;
#ifdef VAS_EBOOT_UTIL
#include <VasEBoot/disk.h>
VasEBoot_disk_addr_t
VasEBoot_fat_get_cluster_sector (VasEBoot_disk_t disk, VasEBoot_uint64_t *sec_per_lcn);
#endif
#endif