Merged FAT16 into Dev
Hopefully with success
This commit is contained in:
21
source/kernel/filesystem/FAT/BiosParameterBlock.h
Normal file
21
source/kernel/filesystem/FAT/BiosParameterBlock.h
Normal file
@ -0,0 +1,21 @@
|
||||
#pragma once
|
||||
#include <stdint.h>
|
||||
#include "./ExtendBootRecord.h"
|
||||
|
||||
struct BiosParameterBlock {
|
||||
uint8_t BootLoaderCodeSection [3];
|
||||
uint8_t OEM_id [8];
|
||||
uint16_t BytesPerSector ; // I suspect would be 512
|
||||
uint8_t SectorsPerCluster ;
|
||||
uint16_t ReservedSectors;
|
||||
uint8_t NumberOfFileAllocationTables; // Probably equals 2
|
||||
uint16_t NumberOfDirectoryEntries; // Root directory must contain entire sectors
|
||||
uint16_t TotalSectorsInLogicalVolume ; // 0 means >65535 sectors in volume , actual count can be found in LargeSectorCount
|
||||
uint8_t MediaDescriptor ; // Indication the media descriptor type
|
||||
uint16_t NumberOfSectorsPerFAT;// only in FAT12 / FAT 16
|
||||
uint16_t NumberOfSectorsPerTrack;
|
||||
uint16_t NumberOfHeadsOnMedia;
|
||||
uint32_t NumberOfHiddenSectors;
|
||||
uint32_t LargeSectorCount;
|
||||
ExtendedBootRecord_FAT16 ebpb;
|
||||
}__attribute__((packed));
|
19
source/kernel/filesystem/FAT/DirectoryEntry.h
Normal file
19
source/kernel/filesystem/FAT/DirectoryEntry.h
Normal file
@ -0,0 +1,19 @@
|
||||
#pragma once
|
||||
#include <stdint.h>
|
||||
|
||||
struct DirectoryEntry {
|
||||
uint8_t filename [8];
|
||||
uint8_t Extension [3];
|
||||
uint8_t attribute;
|
||||
uint8_t Reserved;
|
||||
uint8_t creation;
|
||||
uint16_t CreationTime;
|
||||
uint16_t CreationDate;
|
||||
uint16_t LastAccessDate;
|
||||
uint16_t ReservedFAT32;
|
||||
uint16_t LastWriteTime;
|
||||
uint16_t LastWriteDate;
|
||||
uint16_t StartingCluster;
|
||||
uint32_t FilesizeInBytes;
|
||||
|
||||
}__attribute__((packed));
|
32
source/kernel/filesystem/FAT/ExtendBootRecord.h
Normal file
32
source/kernel/filesystem/FAT/ExtendBootRecord.h
Normal file
@ -0,0 +1,32 @@
|
||||
#pragma once
|
||||
#include <stdint.h>
|
||||
|
||||
struct ExtendedBootRecord_FAT16{
|
||||
uint8_t DriveNumber;
|
||||
uint8_t Reserved;
|
||||
uint8_t Signature;
|
||||
const uint32_t VOLUME_ID_SERIAL_NUMBER;
|
||||
uint8_t volume_label [11];
|
||||
uint8_t Identifier_string [8];
|
||||
uint8_t bootCode [448];
|
||||
uint16_t partitionSignature;
|
||||
}__attribute__((packed));
|
||||
|
||||
struct ExtendedBootRecord_FAT32{
|
||||
uint32_t SectorsPerFAT;
|
||||
uint16_t Flags;
|
||||
const uint16_t FAT_VERSION_NUMBER;
|
||||
uint32_t rootDirectory_clusterNumber;// Often set to 2;
|
||||
uint16_t FSInfo_SectorNumber;
|
||||
uint16_t backup_bpb_sectorNumber;
|
||||
uint8_t Reserved [12];
|
||||
uint8_t DriveNumber;
|
||||
uint8_t Reserved2;
|
||||
uint8_t Signature; // must be 0x28 or 0x29
|
||||
uint32_t VOLUME_ID_SERIAL;
|
||||
uint8_t volume_label[11];
|
||||
uint8_t SystemIdentifierString [8]; // ALWAYS "FAT32 " but spec says do not trust
|
||||
uint8_t BootCode [420]; // NICE
|
||||
uint16_t PartitionSignature; // 0xAA55
|
||||
|
||||
}__attribute__((packed));
|
Reference in New Issue
Block a user