fat_io_lib finally works, implement virtual partition devices, manage devices via string keys
All checks were successful
Build documentation / build-and-deploy (push) Successful in 3m35s
All checks were successful
Build documentation / build-and-deploy (push) Successful in 3m35s
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
#include <desc.h>
|
||||
#include <devices.h>
|
||||
#include <fs/path.h>
|
||||
#include <fs/tarfs.h>
|
||||
#include <fs/vfs.h>
|
||||
@@ -12,7 +13,6 @@
|
||||
#include <path_defs.h>
|
||||
#include <status.h>
|
||||
#include <sys/debug.h>
|
||||
#include <xdrv_device.h>
|
||||
|
||||
static struct tar_file* tar_get_file (struct tarfs* tarfs, const char* filename) {
|
||||
for (size_t i = 0; i < TARFS_FILES_MAX; i++) {
|
||||
@@ -55,7 +55,7 @@ static size_t tar_parse (struct tarfs* tarfs, uint8_t* addr) {
|
||||
return i;
|
||||
}
|
||||
|
||||
int tarfs_mount (struct vfs_volume* volume, struct proc* proc, struct reschedule_ctx* rctx) {
|
||||
int tarfs_mount (struct vfs_volume* volume) {
|
||||
struct tarfs* tarfs = malloc (sizeof (*tarfs));
|
||||
|
||||
if (tarfs == NULL)
|
||||
@@ -71,14 +71,14 @@ int tarfs_mount (struct vfs_volume* volume, struct proc* proc, struct reschedule
|
||||
|
||||
spin_lock (&back_device->lock);
|
||||
|
||||
ret = device_op (back_device, XDRV_GET_SIZE, proc, rctx, &total_size);
|
||||
ret = device_op (back_device, XDRV_GET_SIZE, NULL, NULL, &total_size);
|
||||
if (ret < 0) {
|
||||
spin_unlock (&back_device->lock);
|
||||
free (volume->udata);
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = device_op (back_device, XDRV_GET_SECTOR_SIZE, proc, rctx, §or_size);
|
||||
ret = device_op (back_device, XDRV_GET_SECTOR_SIZE, NULL, NULL, §or_size);
|
||||
if (ret < 0) {
|
||||
spin_unlock (&back_device->lock);
|
||||
free (volume->udata);
|
||||
@@ -96,7 +96,7 @@ int tarfs_mount (struct vfs_volume* volume, struct proc* proc, struct reschedule
|
||||
size_t sector_count = 1;
|
||||
for (size_t sector = 0; sector < total_size / sector_size; sector++) {
|
||||
uint8_t* dest = (uint8_t*)((uintptr_t)buffer + (sector * sector_size));
|
||||
ret = device_op (back_device, XDRV_READ, proc, rctx, §or, §or_count, dest);
|
||||
ret = device_op (back_device, XDRV_READ, NULL, NULL, §or, §or_count, dest);
|
||||
}
|
||||
|
||||
spin_unlock (&back_device->lock);
|
||||
@@ -113,6 +113,11 @@ int tarfs_mount (struct vfs_volume* volume, struct proc* proc, struct reschedule
|
||||
return ret;
|
||||
}
|
||||
|
||||
int tarfs_format (struct vfs_volume* volume) {
|
||||
(void)volume;
|
||||
return ST_OK;
|
||||
}
|
||||
|
||||
int tarfs_describe (struct vfs_volume* volume, const char* path, struct desc* desc) {
|
||||
struct tarfs* tarfs = volume->udata;
|
||||
|
||||
@@ -190,3 +195,9 @@ int tarfs_read_dir_entry (struct vfs_volume* volume, const char* path, struct di
|
||||
|
||||
return ST_DIR_NO_ENTRIES;
|
||||
}
|
||||
|
||||
int tarfs_write (struct vfs_volume* volume, const char* path, uint8_t* buffer, size_t off,
|
||||
size_t size) {
|
||||
(void)volume, (void)path, (void)buffer, (void)off, (void)size;
|
||||
return ST_OK;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user