diff --git a/SingOS.img b/SingOS.img index 615ddcc..1dcb119 100644 Binary files a/SingOS.img and b/SingOS.img differ diff --git a/lsfs_disk_controller.h b/lsfs_disk_controller.h index b3108e9..206d831 100644 --- a/lsfs_disk_controller.h +++ b/lsfs_disk_controller.h @@ -41,10 +41,10 @@ int lsfs_disk_read_data_from_file(lsfs_file *file, int data_length, char *data, int lsfs_disk_write_data_to_file(lsfs_file* file, int data_length, char *data, size_t offset_to_next_entry); int lsfs_disk_rename_file(const char* old_filename_, const char* new_filename); int lsfs_disk_load_disk(); -int write_data_to_disk(lsfs_sector_offset at_sector, uint32_t file_block_size, void* data_to_write); -int write_data_to_disk_off(lsfs_sector_offset index, uint32_t file_block_size, void* data_to_write, int offset); -int read_data_from_disk(lsfs_sector_offset index, uint32_t file_block_size, void* data_buffer); -int read_data_from_disk_off(lsfs_sector_offset index, uint32_t file_block_size, void* data_to_write, int offset); +int write_data_to_disk(lsfs_sector_offset at_sector, uint32_t number_sectors, void* data_to_write); +int write_data_to_disk_off(lsfs_sector_offset index, uint32_t number_sectors, void* data_to_write, int offset); +int read_data_from_disk(lsfs_sector_offset index, uint32_t number_sectors, void* data_buffer); +int read_data_from_disk_off(lsfs_sector_offset index, uint32_t number_sectors, void* data_to_write, int offset); int save_modified_file_information(lsfs_file* file); #define SPACE_MBR_RECORD 2048 // Sectors @@ -99,7 +99,7 @@ typedef struct struct_table_entry lsfs_file_id file_id; uint64_t file_size; mif* ext_file_data; - uint32_t file_block_size; // This tells how many block there are allocated for the specific file. eg. we read this amount of bloks for the file. + uint32_t number_sectors; // This tells how many block there are allocated for the specific file. eg. we read this amount of bloks for the file. uint8_t entry_kind; uint8_t extra_control_bits1; uint8_t extra_control_bits2; @@ -178,7 +178,7 @@ typedef struct lsfs_file { uint64_t creation_date; uint64_t access_time; uint64_t modification_time; - uint32_t file_block_size; + uint32_t number_sectors; lsfs_sector_offset table_entry_sector_index; lsfs_sector_offset data_pointer[NUM_DATA_POINTERS]; } lsfs_file; @@ -235,7 +235,7 @@ int lsfs_disk_getattr(lsfs_file* find_file, const char* path) { find_file->access_time = (uint64_t) timestamp_loading; find_file->modification_time = (uint64_t) timestamp_loading; memcpy(find_file->data_pointer, dir_table->entries[i].data_pointer, NUM_DATA_POINTERS * 8); - find_file->file_block_size = 1; // TODO: should be loaded from disk. + find_file->number_sectors = 1; // TODO: should be loaded from disk. return 1; } } @@ -278,7 +278,7 @@ int lsfs_disk_read_data_from_file(lsfs_file *file, int buffer_size, char *data, { amount_to_read = (DEFAULT_DATA_POINTER_SIZE * SECTOR_SIZE); } - //read_data_from_disk(lsfs_sector_offset index, uint32_t file_block_size, void* data_buffer) + //read_data_from_disk(lsfs_sector_offset index, uint32_t number_sectors, void* data_buffer) if (file->data_pointer[data_pointer_index] == 0) { break; @@ -848,27 +848,27 @@ int save_modified_file_information(lsfs_file* file) { } -int write_data_to_disk(lsfs_sector_offset index, uint32_t file_block_size, void* data_to_write) { +int write_data_to_disk(lsfs_sector_offset index, uint32_t number_sectors, void* data_to_write) { fseek ( disk, (index * SECTOR_SIZE), SEEK_SET ); // SEEK_SET start offset at index 0 and move 1 * SECTOR_SIZE, and write here. - int written = fwrite(data_to_write, 1, (file_block_size * SECTOR_SIZE), disk); + int written = fwrite(data_to_write, 1, (number_sectors * SECTOR_SIZE), disk); return written; } -int write_data_to_disk_off(lsfs_sector_offset index, uint32_t file_block_size, void* data_to_write, int offset) { +int write_data_to_disk_off(lsfs_sector_offset index, uint32_t number_sectors, void* data_to_write, int offset) { fseek ( disk, ((index * SECTOR_SIZE) + offset), SEEK_SET ); // SEEK_SET start offset at index 0 and move 1 * SECTOR_SIZE, and write here. - int written = fwrite(data_to_write, 1, ((file_block_size * SECTOR_SIZE) - offset), disk); + int written = fwrite(data_to_write, 1, ((number_sectors * SECTOR_SIZE) - offset), disk); return written; } -int read_data_from_disk(lsfs_sector_offset index, uint32_t file_block_size, void* data_buffer) { +int read_data_from_disk(lsfs_sector_offset index, uint32_t number_sectors, void* data_buffer) { fseek ( disk, (index * SECTOR_SIZE ), SEEK_SET ); // SEEK_SET start offset at index 0 and move 1 * SECTOR_SIZE, and write here. - int read = fread(data_buffer, 1, (file_block_size * SECTOR_SIZE), disk); + int read = fread(data_buffer, 1, (number_sectors * SECTOR_SIZE), disk); return read; } -int read_data_from_disk_off(lsfs_sector_offset index, uint32_t file_block_size, void* data_to_write, int offset) { +int read_data_from_disk_off(lsfs_sector_offset index, uint32_t number_sectors, void* data_to_write, int offset) { fseek ( disk, ((index * SECTOR_SIZE) + offset), SEEK_SET ); // SEEK_SET start offset at index 0 and move 1 * SECTOR_SIZE, and write here. - int written = fread(data_to_write, 1, ((file_block_size * SECTOR_SIZE) - offset), disk); + int written = fread(data_to_write, 1, ((number_sectors * SECTOR_SIZE) - offset), disk); return written; } #endif diff --git a/lsfs_folder/kernel/kernel.bin b/lsfs_folder/kernel/kernel.bin new file mode 100755 index 0000000..e69de29 diff --git a/lsfs_folder/kernel/utils/disk.out b/lsfs_folder/kernel/utils/disk.out new file mode 100755 index 0000000..bf68117 Binary files /dev/null and b/lsfs_folder/kernel/utils/disk.out differ diff --git a/lsfs_fuse b/lsfs_fuse index 39f5eb4..2171d04 100755 Binary files a/lsfs_fuse and b/lsfs_fuse differ diff --git a/lsfs_fuse.o b/lsfs_fuse.o index 2afd71e..06155da 100644 Binary files a/lsfs_fuse.o and b/lsfs_fuse.o differ