Mass storage revert to expand (max 2G img w/ seek)

This reverts commit 54804fcc66.
This commit is contained in:
Willy-JL
2023-08-29 03:25:45 +02:00
parent 0ec8c85481
commit 034edf50ce
10 changed files with 83 additions and 2 deletions

View File

@@ -396,6 +396,22 @@ static uint64_t storage_ext_file_tell(void* ctx, File* file) {
return position;
}
static bool storage_ext_file_expand(void* ctx, File* file, const uint64_t size) {
#ifdef FURI_RAM_EXEC
UNUSED(ctx);
UNUSED(file);
UNUSED(size);
file->error_id = FSE_NOT_READY;
#else
StorageData* storage = ctx;
SDFile* file_data = storage_get_storage_file_data(file, storage);
file->internal_error_id = f_expand(file_data, size, 1);
file->error_id = storage_ext_parse_error(file->internal_error_id);
#endif
return (file->error_id == FSE_OK);
}
static bool storage_ext_file_truncate(void* ctx, File* file) {
#ifdef FURI_RAM_EXEC
UNUSED(ctx);
@@ -609,6 +625,7 @@ static const FS_Api fs_api = {
.write = storage_ext_file_write,
.seek = storage_ext_file_seek,
.tell = storage_ext_file_tell,
.expand = storage_ext_file_expand,
.truncate = storage_ext_file_truncate,
.size = storage_ext_file_size,
.sync = storage_ext_file_sync,

View File

@@ -455,6 +455,14 @@ static uint64_t storage_int_file_tell(void* ctx, File* file) {
return position;
}
static bool storage_int_file_expand(void* ctx, File* file, const uint64_t size) {
UNUSED(ctx);
UNUSED(file);
UNUSED(size);
file->error_id = FSE_NOT_IMPLEMENTED;
return (file->error_id == FSE_OK);
}
static bool storage_int_file_truncate(void* ctx, File* file) {
StorageData* storage = ctx;
lfs_t* lfs = lfs_get_from_storage(storage);
@@ -703,6 +711,7 @@ static const FS_Api fs_api = {
.write = storage_int_file_write,
.seek = storage_int_file_seek,
.tell = storage_int_file_tell,
.expand = storage_int_file_expand,
.truncate = storage_int_file_truncate,
.size = storage_int_file_size,
.sync = storage_int_file_sync,