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
@@ -206,6 +206,19 @@ static uint64_t storage_process_file_tell(Storage* app, File* file) {
return ret;
}
static bool storage_process_file_expand(Storage* app, File* file, const uint64_t size) {
bool ret = false;
StorageData* storage = get_storage_by_file(file, app->storage);
if(storage == NULL) {
file->error_id = FSE_INVALID_PARAMETER;
} else {
FS_CALL(storage, file.expand(storage, file, size));
}
return ret;
}
static bool storage_process_file_truncate(Storage* app, File* file) {
bool ret = false;
StorageData* storage = get_storage_by_file(file, app->storage);
@@ -575,6 +588,10 @@ void storage_process_message_internal(Storage* app, StorageMessage* message) {
message->return_data->uint64_value =
storage_process_file_tell(app, message->data->file.file);
break;
case StorageCommandFileExpand:
message->return_data->bool_value = storage_process_file_expand(
app, message->data->fexpand.file, message->data->fexpand.size);
break;
case StorageCommandFileTruncate:
message->return_data->bool_value =
storage_process_file_truncate(app, message->data->file.file);