mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-05-27 21:24:11 -04:00
util::unique_lock, update loader to new sf semantics
This commit is contained in:
parent
3761f80592
commit
e4e278bb3d
9 changed files with 262 additions and 39 deletions
|
@ -19,7 +19,7 @@
|
|||
|
||||
namespace ams::fssrv::impl {
|
||||
|
||||
FileInterfaceAdapter::FileInterfaceAdapter(std::unique_ptr<fs::fsa::IFile> &&file, FileSystemInterfaceAdapter *parent, std::unique_lock<fssystem::SemaphoreAdapter> &&sema)
|
||||
FileInterfaceAdapter::FileInterfaceAdapter(std::unique_ptr<fs::fsa::IFile> &&file, FileSystemInterfaceAdapter *parent, util::unique_lock<fssystem::SemaphoreAdapter> &&sema)
|
||||
: parent_filesystem(parent, true), base_file(std::move(file)), open_count_semaphore(std::move(sema))
|
||||
{
|
||||
/* ... */
|
||||
|
@ -89,7 +89,7 @@ namespace ams::fssrv::impl {
|
|||
return ResultSuccess();
|
||||
}
|
||||
|
||||
DirectoryInterfaceAdapter::DirectoryInterfaceAdapter(std::unique_ptr<fs::fsa::IDirectory> &&dir, FileSystemInterfaceAdapter *parent, std::unique_lock<fssystem::SemaphoreAdapter> &&sema)
|
||||
DirectoryInterfaceAdapter::DirectoryInterfaceAdapter(std::unique_ptr<fs::fsa::IDirectory> &&dir, FileSystemInterfaceAdapter *parent, util::unique_lock<fssystem::SemaphoreAdapter> &&sema)
|
||||
: parent_filesystem(parent, true), base_dir(std::move(dir)), open_count_semaphore(std::move(sema))
|
||||
{
|
||||
/* ... */
|
||||
|
@ -236,7 +236,7 @@ namespace ams::fssrv::impl {
|
|||
Result FileSystemInterfaceAdapter::OpenFile(ams::sf::Out<ams::sf::SharedPointer<fssrv::sf::IFile>> out, const fssrv::sf::Path &path, u32 mode) {
|
||||
auto read_lock = this->AcquireCacheInvalidationReadLock();
|
||||
|
||||
std::unique_lock<fssystem::SemaphoreAdapter> open_count_semaphore;
|
||||
util::unique_lock<fssystem::SemaphoreAdapter> open_count_semaphore;
|
||||
if (this->open_count_limited) {
|
||||
/* TODO: This calls into fssrv::FileSystemProxyImpl, which we don't have yet. */
|
||||
AMS_ABORT_UNLESS(false);
|
||||
|
@ -264,7 +264,7 @@ namespace ams::fssrv::impl {
|
|||
Result FileSystemInterfaceAdapter::OpenDirectory(ams::sf::Out<ams::sf::SharedPointer<fssrv::sf::IDirectory>> out, const fssrv::sf::Path &path, u32 mode) {
|
||||
auto read_lock = this->AcquireCacheInvalidationReadLock();
|
||||
|
||||
std::unique_lock<fssystem::SemaphoreAdapter> open_count_semaphore;
|
||||
util::unique_lock<fssystem::SemaphoreAdapter> open_count_semaphore;
|
||||
if (this->open_count_limited) {
|
||||
/* TODO: This calls into fssrv::FileSystemProxyImpl, which we don't have yet. */
|
||||
AMS_ABORT_UNLESS(false);
|
||||
|
|
|
@ -22,10 +22,10 @@ namespace ams::fssystem {
|
|||
NON_COPYABLE(KeySlotCacheAccessor);
|
||||
NON_MOVEABLE(KeySlotCacheAccessor);
|
||||
private:
|
||||
std::unique_lock<os::Mutex> lk;
|
||||
util::unique_lock<os::Mutex> lk;
|
||||
const s32 slot_index;
|
||||
public:
|
||||
KeySlotCacheAccessor(s32 idx, std::unique_lock<os::Mutex> &&l) : lk(std::move(l)), slot_index(idx) { /* ... */ }
|
||||
KeySlotCacheAccessor(s32 idx, util::unique_lock<os::Mutex> &&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<KeySlotCacheAccessor> *out, const void *key, size_t key_size, s32 key2) {
|
||||
std::unique_lock lk(this->mutex);
|
||||
util::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::unique_lock lk(this->mutex);
|
||||
util::unique_lock lk(this->mutex);
|
||||
this->low_priority_mru_list.push_front(*entry);
|
||||
}
|
||||
private:
|
||||
Result AllocateFromLru(std::unique_ptr<KeySlotCacheAccessor> *out, KeySlotCacheEntryList &dst_list, const void *key, size_t key_size, s32 key2) {
|
||||
std::unique_lock lk(this->mutex);
|
||||
util::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());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue