vaseboot/include/VasEBoot/fat.h

83 lines
2.4 KiB
C

/*
* VasEBoot -- GRand Unified Bootloader
* Copyright (C) 2000,2001,2002,2003,2004,2005,2007,2008,2009 Free Software Foundation, Inc.
*
* VasEBoot 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.
*
* VasEBoot 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 VasEBoot. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef VasEBoot_FAT_H
#define VasEBoot_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;
/*0 x15 */
VasEBoot_uint16_t sectors_per_fat_16;
VasEBoot_uint16_t sectors_per_track;
/*0 x19 */
VasEBoot_uint16_t num_heads;
/*0 x1b */
VasEBoot_uint32_t num_hidden_sectors;
/* 0x1f */
VasEBoot_uint32_t num_total_sectors_32;
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];
} VasEBoot_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];
} VasEBoot_PACKED fat32;
} VasEBoot_PACKED version_specific;
} VasEBoot_PACKED;
#ifdef VasEBoot_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