|
|
@ -100,14 +100,15 @@ typedef struct Directory_Table |
|
|
|
|
|
|
|
typedef struct File_System_Control_Information |
|
|
|
{ |
|
|
|
char filesyste_information[256]; |
|
|
|
uint64_t offset_on_disk; |
|
|
|
uint64_t next_partition; |
|
|
|
uint64_t maximum_sectors_on_partition; |
|
|
|
uint64_t next_free_sector; |
|
|
|
uint64_t next_sector_reuse_pointer; |
|
|
|
uint64_t last_sector_index_on_partition; |
|
|
|
uint64_t maximum_sectors_on_disk; |
|
|
|
uint64_t sectors_size_on_disk; |
|
|
|
uint64_t next_free_sector; |
|
|
|
uint64_t number_of_mtt; |
|
|
|
uint64_t master_tag_records[16]; |
|
|
|
uint64_t not_used[26]; |
|
|
|
|
|
|
|
} __attribute__((packed)) FSCI; |
|
|
|
|
|
|
|
typedef struct struct_partition_control |
|
|
@ -522,11 +523,8 @@ int create_file_system() { |
|
|
|
int* zero_buffer; |
|
|
|
FSCI fsci; |
|
|
|
fsci.offset_on_disk = 1; |
|
|
|
fsci.maximum_sectors_on_partition = 1048576; // Max 4GiB
|
|
|
|
//fsci.maximum_sectors_on_partition = 1048576; // Max 4GiB
|
|
|
|
fsci.next_free_sector = 257; |
|
|
|
fsci.number_of_mtt = 1; |
|
|
|
memset(fsci.master_tag_records, 0, 128); |
|
|
|
fsci.master_tag_records[0] = 1; |
|
|
|
|
|
|
|
fseek ( disk , 0, SEEK_SET ); |
|
|
|
fwrite(&fsci, 1, sizeof(fsci), disk); |
|
|
@ -559,9 +557,15 @@ int lsfs_disk_load_disk() { |
|
|
|
if (mbr.partitions[i].partition_type == 0x18) |
|
|
|
{ |
|
|
|
printf("%d\n", mbr.partitions[i].LBA_abs_first_sector); |
|
|
|
// First we find the Mater Table.
|
|
|
|
|
|
|
|
// First we find the File system control information.
|
|
|
|
fseek ( disk , mbr.partitions[i].LBA_abs_first_sector * SECTOR_SIZE, SEEK_SET ); |
|
|
|
fread(&p_control.master_table, 1, sizeof(table_entry) * DEFAULT_MASTER_TABLE_SIZE , disk); |
|
|
|
fread(&p_control.fsci, 1, SECTOR_SIZE , disk); |
|
|
|
|
|
|
|
// next we find the Mater Table.
|
|
|
|
fseek ( disk , (mbr.partitions[i].LBA_abs_first_sector + 1) * SECTOR_SIZE, SEEK_SET ); |
|
|
|
fread(&p_control.master_table, 1, 10 * SECTOR_SIZE , disk); |
|
|
|
|
|
|
|
return 1; |
|
|
|
} |
|
|
|
} |
|
|
|