fs: revise NcaFileSystemDriver for latest semantics

This commit is contained in:
Michael Scire
2021-12-13 22:42:32 -08:00
committed by SciresM
parent ccf29a1302
commit 52296fc2dd
37 changed files with 1612 additions and 1026 deletions

View File

@@ -18,6 +18,7 @@
namespace ams::fssystem {
template<typename BaseStorageType>
class HierarchicalSha256Storage : public ::ams::fs::IStorage, public ::ams::fs::impl::Newable {
NON_COPYABLE(HierarchicalSha256Storage);
NON_MOVEABLE(HierarchicalSha256Storage);
@@ -25,17 +26,18 @@ namespace ams::fssystem {
static constexpr s32 LayerCount = 3;
static constexpr size_t HashSize = crypto::Sha256Generator::HashSize;
private:
os::SdkMutex m_mutex;
IStorage *m_base_storage;
BaseStorageType m_base_storage;
s64 m_base_storage_size;
char *m_hash_buffer;
size_t m_hash_buffer_size;
s32 m_hash_target_block_size;
s32 m_log_size_ratio;
fssystem::IHash256GeneratorFactory *m_hash_generator_factory;
os::SdkMutex m_mutex;
public:
HierarchicalSha256Storage() : m_mutex() { /* ... */ }
Result Initialize(IStorage **base_storages, s32 layer_count, size_t htbs, void *hash_buf, size_t hash_buf_size);
Result Initialize(BaseStorageType *base_storages, s32 layer_count, size_t htbs, void *hash_buf, size_t hash_buf_size, fssystem::IHash256GeneratorFactory *hgf);
virtual Result Read(s64 offset, void *buffer, size_t size) override;
virtual Result Write(s64 offset, const void *buffer, size_t size) override;
@@ -46,7 +48,7 @@ namespace ams::fssystem {
}
virtual Result Flush() override {
return ResultSuccess();
return m_base_storage->Flush();
}
virtual Result SetSize(s64 size) override {