stratosphere: use SdkMutex/SdkRecursiveMutex over Mutex
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
|
||||
namespace ams::fssystem {
|
||||
|
||||
AesXtsStorage::AesXtsStorage(IStorage *base, const void *key1, const void *key2, size_t key_size, const void *iv, size_t iv_size, size_t block_size) : base_storage(base), block_size(block_size), mutex(false) {
|
||||
AesXtsStorage::AesXtsStorage(IStorage *base, const void *key1, const void *key2, size_t key_size, const void *iv, size_t iv_size, size_t block_size) : base_storage(base), block_size(block_size), mutex() {
|
||||
AMS_ASSERT(base != nullptr);
|
||||
AMS_ASSERT(key1 != nullptr);
|
||||
AMS_ASSERT(key2 != nullptr);
|
||||
|
||||
@@ -74,13 +74,13 @@ namespace ams::fssystem {
|
||||
}
|
||||
|
||||
DirectorySaveDataFileSystem::DirectorySaveDataFileSystem(std::shared_ptr<fs::fsa::IFileSystem> fs)
|
||||
: PathResolutionFileSystem(fs), accessor_mutex(false), open_writable_files(0)
|
||||
: PathResolutionFileSystem(fs), accessor_mutex(), open_writable_files(0)
|
||||
{
|
||||
/* ... */
|
||||
}
|
||||
|
||||
DirectorySaveDataFileSystem::DirectorySaveDataFileSystem(std::unique_ptr<fs::fsa::IFileSystem> fs)
|
||||
: PathResolutionFileSystem(std::move(fs)), accessor_mutex(false), open_writable_files(0)
|
||||
: PathResolutionFileSystem(std::move(fs)), accessor_mutex(), open_writable_files(0)
|
||||
{
|
||||
/* ... */
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace ams::fssystem {
|
||||
static constexpr s32 LayerCount = 3;
|
||||
static constexpr size_t HashSize = crypto::Sha256Generator::HashSize;
|
||||
private:
|
||||
os::Mutex mutex;
|
||||
os::SdkMutex mutex;
|
||||
IStorage *base_storage;
|
||||
s64 base_storage_size;
|
||||
char *hash_buffer;
|
||||
@@ -33,7 +33,7 @@ namespace ams::fssystem {
|
||||
s32 hash_target_block_size;
|
||||
s32 log_size_ratio;
|
||||
public:
|
||||
HierarchicalSha256Storage() : mutex(false) { /* ... */ }
|
||||
HierarchicalSha256Storage() : mutex() { /* ... */ }
|
||||
|
||||
Result Initialize(IStorage **base_storages, s32 layer_count, size_t htbs, void *hash_buf, size_t hash_buf_size);
|
||||
|
||||
|
||||
@@ -22,10 +22,10 @@ namespace ams::fssystem {
|
||||
NON_COPYABLE(KeySlotCacheAccessor);
|
||||
NON_MOVEABLE(KeySlotCacheAccessor);
|
||||
private:
|
||||
util::unique_lock<os::Mutex> lk;
|
||||
util::unique_lock<os::SdkMutex> lk;
|
||||
const s32 slot_index;
|
||||
public:
|
||||
KeySlotCacheAccessor(s32 idx, util::unique_lock<os::Mutex> &&l) : lk(std::move(l)), slot_index(idx) { /* ... */ }
|
||||
KeySlotCacheAccessor(s32 idx, util::unique_lock<os::SdkMutex> &&l) : lk(std::move(l)), slot_index(idx) { /* ... */ }
|
||||
|
||||
s32 GetKeySlotIndex() const { return this->slot_index; }
|
||||
};
|
||||
@@ -64,11 +64,11 @@ namespace ams::fssystem {
|
||||
private:
|
||||
using KeySlotCacheEntryList = util::IntrusiveListBaseTraits<KeySlotCacheEntry>::ListType;
|
||||
private:
|
||||
os::Mutex mutex;
|
||||
os::SdkMutex mutex;
|
||||
KeySlotCacheEntryList high_priority_mru_list;
|
||||
KeySlotCacheEntryList low_priority_mru_list;
|
||||
public:
|
||||
constexpr KeySlotCache() : mutex(false), high_priority_mru_list(), low_priority_mru_list() { /* ... */ }
|
||||
constexpr KeySlotCache() : mutex(), high_priority_mru_list(), low_priority_mru_list() { /* ... */ }
|
||||
|
||||
Result AllocateHighPriority(std::unique_ptr<KeySlotCacheAccessor> *out, const void *key, size_t key_size, s32 key2) {
|
||||
return this->AllocateFromLru(out, this->high_priority_mru_list, key, key_size, key2);
|
||||
|
||||
@@ -21,13 +21,12 @@ namespace ams::fssystem {
|
||||
|
||||
class AdditionalDeviceAddressEntry {
|
||||
private:
|
||||
/* TODO: SdkMutex */
|
||||
os::Mutex mutex;
|
||||
os::SdkMutex mutex;
|
||||
bool is_registered;
|
||||
uintptr_t address;
|
||||
size_t size;
|
||||
public:
|
||||
constexpr AdditionalDeviceAddressEntry() : mutex(false), is_registered(), address(), size() { /* ... */ }
|
||||
constexpr AdditionalDeviceAddressEntry() : mutex(), is_registered(), address(), size() { /* ... */ }
|
||||
|
||||
void Register(uintptr_t addr, size_t sz) {
|
||||
std::scoped_lock lk(this->mutex);
|
||||
@@ -77,18 +76,17 @@ namespace ams::fssystem {
|
||||
constexpr size_t HeapAllocatableSizeMax = HeapBlockSize * (static_cast<size_t>(1) << HeapOrderMax);
|
||||
constexpr size_t HeapAllocatableSizeMaxForLarge = HeapBlockSize * (static_cast<size_t>(1) << HeapOrderMaxForLarge);
|
||||
|
||||
/* TODO: SdkMutex */
|
||||
os::Mutex g_heap_mutex(false);
|
||||
FileSystemBuddyHeap g_heap;
|
||||
constinit os::SdkMutex g_heap_mutex;
|
||||
constinit FileSystemBuddyHeap g_heap;
|
||||
|
||||
std::atomic<size_t> g_retry_count;
|
||||
std::atomic<size_t> g_reduce_allocation_count;
|
||||
constinit std::atomic<size_t> g_retry_count;
|
||||
constinit std::atomic<size_t> g_reduce_allocation_count;
|
||||
|
||||
void *g_heap_buffer;
|
||||
size_t g_heap_size;
|
||||
size_t g_heap_free_size_peak;
|
||||
constinit void *g_heap_buffer;
|
||||
constinit size_t g_heap_size;
|
||||
constinit size_t g_heap_free_size_peak;
|
||||
|
||||
AdditionalDeviceAddressEntry g_additional_device_address_entry;
|
||||
constinit AdditionalDeviceAddressEntry g_additional_device_address_entry;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -25,12 +25,12 @@ namespace ams::fssystem {
|
||||
private:
|
||||
using BlockCache = LruListCache<s64, char *>;
|
||||
private:
|
||||
os::Mutex mutex;
|
||||
os::SdkMutex mutex;
|
||||
BlockCache block_cache;
|
||||
fs::IStorage * const base_storage;
|
||||
s32 block_size;
|
||||
public:
|
||||
ReadOnlyBlockCacheStorage(IStorage *bs, s32 bsz, char *buf, size_t buf_size, s32 cache_block_count) : mutex(false), base_storage(bs), block_size(bsz) {
|
||||
ReadOnlyBlockCacheStorage(IStorage *bs, s32 bsz, char *buf, size_t buf_size, s32 cache_block_count) : mutex(), base_storage(bs), block_size(bsz) {
|
||||
/* Validate preconditions. */
|
||||
AMS_ASSERT(buf_size >= static_cast<size_t>(this->block_size));
|
||||
AMS_ASSERT(util::IsPowerOfTwo(this->block_size));
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace ams::fssystem::save {
|
||||
this->Finalize();
|
||||
}
|
||||
|
||||
Result BlockCacheBufferedStorage::Initialize(IBufferManager *bm, os::Mutex *mtx, IStorage *data, s64 data_size, size_t verif_block_size, s32 max_cache_entries, bool is_real_data, s8 buffer_level, bool is_keep_burst_mode, fs::StorageType storage_type) {
|
||||
Result BlockCacheBufferedStorage::Initialize(IBufferManager *bm, os::SdkRecursiveMutex *mtx, IStorage *data, s64 data_size, size_t verif_block_size, s32 max_cache_entries, bool is_real_data, s8 buffer_level, bool is_keep_burst_mode, fs::StorageType storage_type) {
|
||||
/* Validate preconditions. */
|
||||
AMS_ASSERT(data != nullptr);
|
||||
AMS_ASSERT(bm != nullptr);
|
||||
|
||||
@@ -582,7 +582,7 @@ namespace ams::fssystem::save {
|
||||
}
|
||||
};
|
||||
|
||||
BufferedStorage::BufferedStorage() : base_storage(), buffer_manager(), block_size(), base_storage_size(), caches(), cache_count(), next_acquire_cache(), next_fetch_cache(), mutex(false), bulk_read_enabled() {
|
||||
BufferedStorage::BufferedStorage() : base_storage(), buffer_manager(), block_size(), base_storage_size(), caches(), cache_count(), next_acquire_cache(), next_fetch_cache(), mutex(), bulk_read_enabled() {
|
||||
/* ... */
|
||||
}
|
||||
|
||||
|
||||
@@ -150,7 +150,7 @@ namespace ams::fssystem::save {
|
||||
this->storage = fs::SubStorage();
|
||||
}
|
||||
|
||||
Result HierarchicalIntegrityVerificationStorage::Initialize(const HierarchicalIntegrityVerificationInformation &info, HierarchicalStorageInformation storage, FileSystemBufferManagerSet *bufs, os::Mutex *mtx, fs::StorageType storage_type) {
|
||||
Result HierarchicalIntegrityVerificationStorage::Initialize(const HierarchicalIntegrityVerificationInformation &info, HierarchicalStorageInformation storage, FileSystemBufferManagerSet *bufs, os::SdkRecursiveMutex *mtx, fs::StorageType storage_type) {
|
||||
/* Validate preconditions. */
|
||||
AMS_ASSERT(bufs != nullptr);
|
||||
AMS_ASSERT(IntegrityMinLayerCount <= info.max_layers && info.max_layers <= IntegrityMaxLayerCount);
|
||||
|
||||
Reference in New Issue
Block a user