Parcourir la source

Save work

master
Jørn Guldberg il y a 4 ans
Parent
révision
ba1ccf37e6
6 fichiers modifiés avec 16 ajouts et 16 suppressions
  1. BIN
      SingOS.img
  2. +16
    -16
      lsfs_disk_controller.h
  3. +0
    -0
      lsfs_folder/kernel/kernel.bin
  4. BIN
      lsfs_folder/kernel/utils/disk.out
  5. BIN
      lsfs_fuse
  6. BIN
      lsfs_fuse.o

BIN
SingOS.img Voir le fichier


+ 16
- 16
lsfs_disk_controller.h Voir le fichier

@ -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

+ 0
- 0
lsfs_folder/kernel/kernel.bin Voir le fichier


BIN
lsfs_folder/kernel/utils/disk.out Voir le fichier


BIN
lsfs_fuse Voir le fichier


BIN
lsfs_fuse.o Voir le fichier


Chargement…
Annuler
Enregistrer