Пример #1
0
void init_filesystem(void){ //initialize the file system structutes
	bound_blocks_bitmap = (unsigned char *)malloc(BLOCK_SIZE*SECTOR_SIZE*sizeof(unsigned char));
	ata_read_sectors(BOUND_BLOCKS_BITMAP, BLOCK_SIZE, bound_blocks_bitmap);			
	if(~(*bound_blocks_bitmap) & 0b111){
		print("initializing the bound block bitmap\n");
		*bound_blocks_bitmap = (*bound_blocks_bitmap) | 0b111;
		ata_write_sectors(BOUND_BLOCKS_BITMAP, BLOCK_SIZE, bound_blocks_bitmap);
	}

	inode_list = (inode *)malloc(BLOCK_SIZE*SECTOR_SIZE*sizeof(unsigned char));
	ata_read_sectors(INODE_LIST, BLOCK_SIZE, (char *)inode_list);
	
	file_names_list = (unsigned char *)malloc(BLOCK_SIZE*SECTOR_SIZE*sizeof(unsigned char));
	ata_read_sectors(FILE_NAMES_LIST, BLOCK_SIZE, file_names_list);
	open_files_list = create_list();
	open_dirs_list = create_list();
}
Пример #2
0
bool part_write_sectors(uchar disk, partition_t* part, uint sector, uint sectors, void* buffer)
{
	return ata_write_sectors(disk, part->start_lba + sector, sectors, buffer);
}