fat_io_lib port WIP
All checks were successful
Build documentation / build-and-deploy (push) Successful in 3m12s
All checks were successful
Build documentation / build-and-deploy (push) Successful in 3m12s
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
#include <device/device.h>
|
||||
#include <fs/fat1.h>
|
||||
#include <fs/fatfs.h>
|
||||
#include <fs/tarfs.h>
|
||||
#include <fs/vfs.h>
|
||||
#include <id/id_alloc.h>
|
||||
@@ -52,16 +54,21 @@ int vfs_create_volume (const char* key, int fs_type, struct device* back_device,
|
||||
volume->lock = SPIN_LOCK_INIT;
|
||||
|
||||
switch (volume->fs_type) {
|
||||
case VFS_TARFS: {
|
||||
case VFS_TARFS:
|
||||
volume->driver_ops.mount = &tarfs_mount;
|
||||
volume->driver_ops.describe = &tarfs_describe;
|
||||
volume->driver_ops.read = &tarfs_read;
|
||||
volume->driver_ops.read_dir_entry = &tarfs_read_dir_entry;
|
||||
} break;
|
||||
default: {
|
||||
break;
|
||||
case VFS_FAT16:
|
||||
volume->driver_ops.mount = &fatfs_mount;
|
||||
volume->driver_ops.describe = &fatfs_describe;
|
||||
volume->driver_ops.read = &fatfs_read;
|
||||
volume->driver_ops.read_dir_entry = &fatfs_read_dir_entry;
|
||||
break;
|
||||
default:
|
||||
free (volume);
|
||||
return -ST_MOUNT_ERROR;
|
||||
} break;
|
||||
}
|
||||
|
||||
int ret = volume->driver_ops.mount (volume, proc, rctx);
|
||||
@@ -208,3 +215,14 @@ void vfs_init (void) {
|
||||
|
||||
volume_table.lock = SPIN_LOCK_INIT;
|
||||
}
|
||||
|
||||
void vfs_translate (size_t fs_block, size_t fs_block_count, size_t fs_block_size,
|
||||
size_t device_sector_size, size_t* out_phys_sector, size_t* out_sector_count) {
|
||||
size_t ratio = fs_block_size / device_sector_size;
|
||||
|
||||
if (out_phys_sector != NULL)
|
||||
*out_phys_sector = fs_block * ratio;
|
||||
|
||||
if (out_sector_count != NULL)
|
||||
*out_sector_count = fs_block_count * ratio;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user