mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-04-28 03:59:58 -07:00
Add storage_file_expand()
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user