fs: properly implement OperateRangeWithBuffer, correct OperationId names.
This commit is contained in:
@@ -389,17 +389,17 @@ namespace ams::fssystem::save {
|
||||
AMS_ASSERT(this->data_storage != nullptr);
|
||||
|
||||
switch (op_id) {
|
||||
case fs::OperationId::Clear:
|
||||
case fs::OperationId::FillZero:
|
||||
{
|
||||
R_TRY(this->ClearImpl(offset, size));
|
||||
return ResultSuccess();
|
||||
}
|
||||
case fs::OperationId::ClearSignature:
|
||||
case fs::OperationId::DestroySignature:
|
||||
{
|
||||
R_TRY(this->ClearSignatureImpl(offset, size));
|
||||
return ResultSuccess();
|
||||
}
|
||||
case fs::OperationId::InvalidateCache:
|
||||
case fs::OperationId::Invalidate:
|
||||
{
|
||||
R_UNLESS(this->storage_type != fs::StorageType_SaveData, fs::ResultUnsupportedOperationInBlockCacheBufferedStorageB());
|
||||
R_TRY(this->InvalidateCacheImpl(offset, size));
|
||||
@@ -531,7 +531,7 @@ namespace ams::fssystem::save {
|
||||
R_SUCCEED_IF(start_offset == end_offset);
|
||||
|
||||
/* Clear the signature for the aligned range. */
|
||||
R_TRY(this->UpdateLastResult(this->data_storage->OperateRange(fs::OperationId::Clear, start_offset, end_offset - start_offset)));
|
||||
R_TRY(this->UpdateLastResult(this->data_storage->OperateRange(fs::OperationId::FillZero, start_offset, end_offset - start_offset)));
|
||||
|
||||
/* Set blocking buffer manager allocations. */
|
||||
buffers::EnableBlockingBufferManagerAllocation();
|
||||
@@ -558,7 +558,7 @@ namespace ams::fssystem::save {
|
||||
R_TRY(this->UpdateLastResult(this->FlushRangeCacheEntries(offset, size, true)));
|
||||
|
||||
/* Clear the signature for the aligned range. */
|
||||
R_TRY(this->UpdateLastResult(this->data_storage->OperateRange(fs::OperationId::ClearSignature, start_offset, end_offset - start_offset)));
|
||||
R_TRY(this->UpdateLastResult(this->data_storage->OperateRange(fs::OperationId::DestroySignature, start_offset, end_offset - start_offset)));
|
||||
|
||||
/* Set blocking buffer manager allocations. */
|
||||
buffers::EnableBlockingBufferManagerAllocation();
|
||||
@@ -583,7 +583,7 @@ namespace ams::fssystem::save {
|
||||
|
||||
/* Invalidate the aligned range. */
|
||||
{
|
||||
Result result = this->data_storage->OperateRange(fs::OperationId::InvalidateCache, aligned_offset, aligned_size);
|
||||
Result result = this->data_storage->OperateRange(fs::OperationId::Invalidate, aligned_offset, aligned_size);
|
||||
AMS_ASSERT(!fs::ResultBufferAllocationFailed::Includes(result));
|
||||
R_TRY(result);
|
||||
}
|
||||
|
||||
@@ -718,7 +718,7 @@ namespace ams::fssystem::save {
|
||||
AMS_ASSERT(this->IsInitialized());
|
||||
|
||||
/* Invalidate caches, if we should. */
|
||||
if (op_id == fs::OperationId::InvalidateCache) {
|
||||
if (op_id == fs::OperationId::Invalidate) {
|
||||
SharedCache cache(this);
|
||||
while (cache.AcquireNextOverlappedCache(offset, size)) {
|
||||
cache.Invalidate();
|
||||
|
||||
@@ -316,14 +316,14 @@ namespace ams::fssystem::save {
|
||||
|
||||
Result HierarchicalIntegrityVerificationStorage::OperateRange(void *dst, size_t dst_size, fs::OperationId op_id, s64 offset, s64 size, const void *src, size_t src_size) {
|
||||
switch (op_id) {
|
||||
case fs::OperationId::Clear:
|
||||
case fs::OperationId::ClearSignature:
|
||||
case fs::OperationId::FillZero:
|
||||
case fs::OperationId::DestroySignature:
|
||||
{
|
||||
R_TRY(this->buffer_storages[this->max_layers - 2].OperateRange(dst, dst_size, op_id, offset, size, src, src_size));
|
||||
this->is_written_for_rollback = true;
|
||||
return ResultSuccess();
|
||||
}
|
||||
case fs::OperationId::InvalidateCache:
|
||||
case fs::OperationId::Invalidate:
|
||||
case fs::OperationId::QueryRange:
|
||||
{
|
||||
R_TRY(this->buffer_storages[this->max_layers - 2].OperateRange(dst, dst_size, op_id, offset, size, src, src_size));
|
||||
|
||||
@@ -256,7 +256,7 @@ namespace ams::fssystem::save {
|
||||
AMS_ASSERT(util::IsAligned(size, static_cast<size_t>(this->verification_block_size)));
|
||||
|
||||
switch (op_id) {
|
||||
case fs::OperationId::Clear:
|
||||
case fs::OperationId::FillZero:
|
||||
{
|
||||
/* Clear should only be called for save data. */
|
||||
AMS_ASSERT(this->storage_type == fs::StorageType_SaveData);
|
||||
@@ -289,7 +289,7 @@ namespace ams::fssystem::save {
|
||||
|
||||
return ResultSuccess();
|
||||
}
|
||||
case fs::OperationId::ClearSignature:
|
||||
case fs::OperationId::DestroySignature:
|
||||
{
|
||||
/* Clear Signature should only be called for save data. */
|
||||
AMS_ASSERT(this->storage_type == fs::StorageType_SaveData);
|
||||
@@ -319,7 +319,7 @@ namespace ams::fssystem::save {
|
||||
/* Write the cleared signature. */
|
||||
return this->hash_storage.Write(sign_offset, buf.get(), sign_size);
|
||||
}
|
||||
case fs::OperationId::InvalidateCache:
|
||||
case fs::OperationId::Invalidate:
|
||||
{
|
||||
/* Only allow cache invalidation for RomFs. */
|
||||
R_UNLESS(this->storage_type != fs::StorageType_SaveData, fs::ResultUnsupportedOperationInIntegrityVerificationStorageB());
|
||||
|
||||
Reference in New Issue
Block a user