mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-07-15 13:22:15 +02:00
std::scoped_lock<> -> std::scoped_lock
This commit is contained in:
parent
9b21262085
commit
cf7412df06
@ -145,7 +145,7 @@ namespace ams::ncm::impl {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Result InitializeContentManager() {
|
Result InitializeContentManager() {
|
||||||
std::scoped_lock<os::Mutex> lk(g_mutex);
|
std::scoped_lock lk(g_mutex);
|
||||||
|
|
||||||
/* Already initialized. */
|
/* Already initialized. */
|
||||||
if (g_initialized) {
|
if (g_initialized) {
|
||||||
@ -256,7 +256,7 @@ namespace ams::ncm::impl {
|
|||||||
|
|
||||||
void FinalizeContentManager() {
|
void FinalizeContentManager() {
|
||||||
{
|
{
|
||||||
std::scoped_lock<os::Mutex> lk(g_mutex);
|
std::scoped_lock lk(g_mutex);
|
||||||
|
|
||||||
for (size_t i = 0; i < MaxContentStorageEntries; i++) {
|
for (size_t i = 0; i < MaxContentStorageEntries; i++) {
|
||||||
ContentStorageEntry* entry = &g_content_storage_entries[i];
|
ContentStorageEntry* entry = &g_content_storage_entries[i];
|
||||||
@ -281,7 +281,7 @@ namespace ams::ncm::impl {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Result CreateContentStorage(StorageId storage_id) {
|
Result CreateContentStorage(StorageId storage_id) {
|
||||||
std::scoped_lock<os::Mutex> lk(g_mutex);
|
std::scoped_lock lk(g_mutex);
|
||||||
|
|
||||||
if (storage_id == StorageId::None || static_cast<u8>(storage_id) == 6) {
|
if (storage_id == StorageId::None || static_cast<u8>(storage_id) == 6) {
|
||||||
return ResultUnknownStorage();
|
return ResultUnknownStorage();
|
||||||
@ -306,7 +306,7 @@ namespace ams::ncm::impl {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Result VerifyContentStorage(StorageId storage_id) {
|
Result VerifyContentStorage(StorageId storage_id) {
|
||||||
std::scoped_lock<os::Mutex> lk(g_mutex);
|
std::scoped_lock lk(g_mutex);
|
||||||
|
|
||||||
if (storage_id == StorageId::None || static_cast<u8>(storage_id) == 6) {
|
if (storage_id == StorageId::None || static_cast<u8>(storage_id) == 6) {
|
||||||
return ResultUnknownStorage();
|
return ResultUnknownStorage();
|
||||||
@ -334,7 +334,7 @@ namespace ams::ncm::impl {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Result OpenContentStorage(std::shared_ptr<IContentStorage>* out, StorageId storage_id) {
|
Result OpenContentStorage(std::shared_ptr<IContentStorage>* out, StorageId storage_id) {
|
||||||
std::scoped_lock<os::Mutex> lk(g_mutex);
|
std::scoped_lock lk(g_mutex);
|
||||||
|
|
||||||
if (storage_id == StorageId::None || static_cast<u8>(storage_id) == 6) {
|
if (storage_id == StorageId::None || static_cast<u8>(storage_id) == 6) {
|
||||||
return ResultUnknownStorage();
|
return ResultUnknownStorage();
|
||||||
@ -378,7 +378,7 @@ namespace ams::ncm::impl {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Result CloseContentStorageForcibly(StorageId storage_id) {
|
Result CloseContentStorageForcibly(StorageId storage_id) {
|
||||||
std::scoped_lock<os::Mutex> lk(g_mutex);
|
std::scoped_lock lk(g_mutex);
|
||||||
|
|
||||||
if (storage_id == StorageId::None) {
|
if (storage_id == StorageId::None) {
|
||||||
return ResultUnknownStorage();
|
return ResultUnknownStorage();
|
||||||
@ -402,7 +402,7 @@ namespace ams::ncm::impl {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Result ActivateContentStorage(StorageId storage_id) {
|
Result ActivateContentStorage(StorageId storage_id) {
|
||||||
std::scoped_lock<os::Mutex> lk(g_mutex);
|
std::scoped_lock lk(g_mutex);
|
||||||
|
|
||||||
if (storage_id == StorageId::None || static_cast<u8>(storage_id) == 6) {
|
if (storage_id == StorageId::None || static_cast<u8>(storage_id) == 6) {
|
||||||
return ResultUnknownStorage();
|
return ResultUnknownStorage();
|
||||||
@ -460,7 +460,7 @@ namespace ams::ncm::impl {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Result InactivateContentStorage(StorageId storage_id) {
|
Result InactivateContentStorage(StorageId storage_id) {
|
||||||
std::scoped_lock<os::Mutex> lk(g_mutex);
|
std::scoped_lock lk(g_mutex);
|
||||||
|
|
||||||
if (storage_id == StorageId::None || static_cast<u8>(storage_id) == 6) {
|
if (storage_id == StorageId::None || static_cast<u8>(storage_id) == 6) {
|
||||||
return ResultUnknownStorage();
|
return ResultUnknownStorage();
|
||||||
@ -484,7 +484,7 @@ namespace ams::ncm::impl {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Result CreateContentMetaDatabase(StorageId storage_id) {
|
Result CreateContentMetaDatabase(StorageId storage_id) {
|
||||||
std::scoped_lock<os::Mutex> lk(g_mutex);
|
std::scoped_lock lk(g_mutex);
|
||||||
|
|
||||||
if (storage_id == StorageId::None || storage_id == StorageId::GameCard || static_cast<u8>(storage_id) == 6) {
|
if (storage_id == StorageId::None || storage_id == StorageId::GameCard || static_cast<u8>(storage_id) == 6) {
|
||||||
return ResultUnknownStorage();
|
return ResultUnknownStorage();
|
||||||
@ -517,7 +517,7 @@ namespace ams::ncm::impl {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Result VerifyContentMetaDatabase(StorageId storage_id) {
|
Result VerifyContentMetaDatabase(StorageId storage_id) {
|
||||||
std::scoped_lock<os::Mutex> lk(g_mutex);
|
std::scoped_lock lk(g_mutex);
|
||||||
|
|
||||||
if (storage_id == StorageId::GameCard) {
|
if (storage_id == StorageId::GameCard) {
|
||||||
return ResultSuccess();
|
return ResultSuccess();
|
||||||
@ -556,7 +556,7 @@ namespace ams::ncm::impl {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Result OpenContentMetaDatabase(std::shared_ptr<IContentMetaDatabase>* out, StorageId storage_id) {
|
Result OpenContentMetaDatabase(std::shared_ptr<IContentMetaDatabase>* out, StorageId storage_id) {
|
||||||
std::scoped_lock<os::Mutex> lk(g_mutex);
|
std::scoped_lock lk(g_mutex);
|
||||||
|
|
||||||
if (storage_id == StorageId::None || static_cast<u8>(storage_id) == 6) {
|
if (storage_id == StorageId::None || static_cast<u8>(storage_id) == 6) {
|
||||||
return ResultUnknownStorage();
|
return ResultUnknownStorage();
|
||||||
@ -600,7 +600,7 @@ namespace ams::ncm::impl {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Result CloseContentMetaDatabaseForcibly(StorageId storage_id) {
|
Result CloseContentMetaDatabaseForcibly(StorageId storage_id) {
|
||||||
std::scoped_lock<os::Mutex> lk(g_mutex);
|
std::scoped_lock lk(g_mutex);
|
||||||
|
|
||||||
if (storage_id == StorageId::None) {
|
if (storage_id == StorageId::None) {
|
||||||
return ResultUnknownStorage();
|
return ResultUnknownStorage();
|
||||||
@ -631,7 +631,7 @@ namespace ams::ncm::impl {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Result CleanupContentMetaDatabase(StorageId storage_id) {
|
Result CleanupContentMetaDatabase(StorageId storage_id) {
|
||||||
std::scoped_lock<os::Mutex> lk(g_mutex);
|
std::scoped_lock lk(g_mutex);
|
||||||
|
|
||||||
if (storage_id == StorageId::None || static_cast<u8>(storage_id) == 6) {
|
if (storage_id == StorageId::None || static_cast<u8>(storage_id) == 6) {
|
||||||
return ResultUnknownStorage();
|
return ResultUnknownStorage();
|
||||||
@ -648,7 +648,7 @@ namespace ams::ncm::impl {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Result ActivateContentMetaDatabase(StorageId storage_id) {
|
Result ActivateContentMetaDatabase(StorageId storage_id) {
|
||||||
std::scoped_lock<os::Mutex> lk(g_mutex);
|
std::scoped_lock lk(g_mutex);
|
||||||
|
|
||||||
if (storage_id == StorageId::None || static_cast<u8>(storage_id) == 6) {
|
if (storage_id == StorageId::None || static_cast<u8>(storage_id) == 6) {
|
||||||
return ResultUnknownStorage();
|
return ResultUnknownStorage();
|
||||||
@ -684,7 +684,7 @@ namespace ams::ncm::impl {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Result InactivateContentMetaDatabase(StorageId storage_id) {
|
Result InactivateContentMetaDatabase(StorageId storage_id) {
|
||||||
std::scoped_lock<os::Mutex> lk(g_mutex);
|
std::scoped_lock lk(g_mutex);
|
||||||
|
|
||||||
if (storage_id == StorageId::None || static_cast<u8>(storage_id) == 6) {
|
if (storage_id == StorageId::None || static_cast<u8>(storage_id) == 6) {
|
||||||
return ResultUnknownStorage();
|
return ResultUnknownStorage();
|
||||||
|
@ -429,7 +429,7 @@ namespace ams::ncm {
|
|||||||
R_TRY(this->EnsureEnabled());
|
R_TRY(this->EnsureEnabled());
|
||||||
|
|
||||||
{
|
{
|
||||||
std::scoped_lock<os::Mutex> lk(this->rights_id_cache->mutex);
|
std::scoped_lock lk(this->rights_id_cache->mutex);
|
||||||
|
|
||||||
/* Attempt to locate the content id in the cache. */
|
/* Attempt to locate the content id in the cache. */
|
||||||
for (size_t i = 0; i < impl::RightsIdCache::MaxEntries; i++) {
|
for (size_t i = 0; i < impl::RightsIdCache::MaxEntries; i++) {
|
||||||
@ -454,7 +454,7 @@ namespace ams::ncm {
|
|||||||
R_TRY(fsGetRightsIdAndKeyGenerationByPath(common_path, &key_generation, &rights_id));
|
R_TRY(fsGetRightsIdAndKeyGenerationByPath(common_path, &key_generation, &rights_id));
|
||||||
|
|
||||||
{
|
{
|
||||||
std::scoped_lock<os::Mutex> lk(this->rights_id_cache->mutex);
|
std::scoped_lock lk(this->rights_id_cache->mutex);
|
||||||
impl::RightsIdCache::Entry* eviction_candidate = &this->rights_id_cache->entries[0];
|
impl::RightsIdCache::Entry* eviction_candidate = &this->rights_id_cache->entries[0];
|
||||||
|
|
||||||
/* Find a suitable existing entry to store our new one at. */
|
/* Find a suitable existing entry to store our new one at. */
|
||||||
@ -598,7 +598,7 @@ namespace ams::ncm {
|
|||||||
R_TRY(this->EnsureEnabled());
|
R_TRY(this->EnsureEnabled());
|
||||||
|
|
||||||
{
|
{
|
||||||
std::scoped_lock<os::Mutex> lk(this->rights_id_cache->mutex);
|
std::scoped_lock lk(this->rights_id_cache->mutex);
|
||||||
|
|
||||||
/* Attempt to locate the content id in the cache. */
|
/* Attempt to locate the content id in the cache. */
|
||||||
for (size_t i = 0; i < impl::RightsIdCache::MaxEntries; i++) {
|
for (size_t i = 0; i < impl::RightsIdCache::MaxEntries; i++) {
|
||||||
@ -623,7 +623,7 @@ namespace ams::ncm {
|
|||||||
R_TRY(fsGetRightsIdAndKeyGenerationByPath(common_path, &key_generation, &rights_id));
|
R_TRY(fsGetRightsIdAndKeyGenerationByPath(common_path, &key_generation, &rights_id));
|
||||||
|
|
||||||
{
|
{
|
||||||
std::scoped_lock<os::Mutex> lk(this->rights_id_cache->mutex);
|
std::scoped_lock lk(this->rights_id_cache->mutex);
|
||||||
impl::RightsIdCache::Entry* eviction_candidate = &this->rights_id_cache->entries[0];
|
impl::RightsIdCache::Entry* eviction_candidate = &this->rights_id_cache->entries[0];
|
||||||
|
|
||||||
/* Find a suitable existing entry to store our new one at. */
|
/* Find a suitable existing entry to store our new one at. */
|
||||||
|
@ -226,7 +226,7 @@ namespace ams::ncm::fs {
|
|||||||
static os::Mutex g_mount_index_lock;
|
static os::Mutex g_mount_index_lock;
|
||||||
|
|
||||||
MountName CreateUniqueMountName() {
|
MountName CreateUniqueMountName() {
|
||||||
std::scoped_lock<os::Mutex> lk(g_mount_index_lock);
|
std::scoped_lock lk(g_mount_index_lock);
|
||||||
MountName mount_name;
|
MountName mount_name;
|
||||||
g_mount_index++;
|
g_mount_index++;
|
||||||
snprintf(mount_name.name, sizeof(MountName), "@ncm%08x", g_mount_index);
|
snprintf(mount_name.name, sizeof(MountName), "@ncm%08x", g_mount_index);
|
||||||
|
Loading…
Reference in New Issue
Block a user