Add storage_file_expand()

This commit is contained in:
Willy-JL
2023-08-02 23:33:27 +02:00
parent 070fb17485
commit e8f11e5521
9 changed files with 80 additions and 1 deletions

View File

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