From b26ebc12e16c20c8a67dc65198c32318be030437 Mon Sep 17 00:00:00 2001 From: Michael Scire Date: Tue, 12 Jan 2021 04:37:34 -0800 Subject: [PATCH] fs: fix keyslotcache unique_lock usage --- .../source/fssystem/fssystem_key_slot_cache.hpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libraries/libstratosphere/source/fssystem/fssystem_key_slot_cache.hpp b/libraries/libstratosphere/source/fssystem/fssystem_key_slot_cache.hpp index e248bca2a..89cad629e 100644 --- a/libraries/libstratosphere/source/fssystem/fssystem_key_slot_cache.hpp +++ b/libraries/libstratosphere/source/fssystem/fssystem_key_slot_cache.hpp @@ -22,10 +22,10 @@ namespace ams::fssystem { NON_COPYABLE(KeySlotCacheAccessor); NON_MOVEABLE(KeySlotCacheAccessor); private: - std::scoped_lock lk; + std::unique_lock lk; const s32 slot_index; public: - KeySlotCacheAccessor(s32 idx, std::scoped_lock &&l) : lk(std::move(l)), slot_index(idx) { /* ... */ } + KeySlotCacheAccessor(s32 idx, std::unique_lock &&l) : lk(std::move(l)), slot_index(idx) { /* ... */ } s32 GetKeySlotIndex() const { return this->slot_index; } }; @@ -79,7 +79,7 @@ namespace ams::fssystem { } Result Find(std::unique_ptr *out, const void *key, size_t key_size, s32 key2) { - std::scoped_lock lk(this->mutex); + std::unique_lock lk(this->mutex); KeySlotCacheEntryList *lists[2] = { std::addressof(this->high_priority_mru_list), std::addressof(this->low_priority_mru_list) }; for (auto list : lists) { @@ -100,12 +100,12 @@ namespace ams::fssystem { } void AddEntry(KeySlotCacheEntry *entry) { - std::scoped_lock lk(this->mutex); + std::unique_lock lk(this->mutex); this->low_priority_mru_list.push_front(*entry); } private: Result AllocateFromLru(std::unique_ptr *out, KeySlotCacheEntryList &dst_list, const void *key, size_t key_size, s32 key2) { - std::scoped_lock lk(this->mutex); + std::unique_lock lk(this->mutex); KeySlotCacheEntryList &src_list = this->low_priority_mru_list.empty() ? this->high_priority_mru_list : this->low_priority_mru_list; AMS_ASSERT(!src_list.empty());