namespace sts -> namespace ams
namespace sts::ams -> ams::exosphere, ams::. This is to facilitate future use of ams:: namespace code in mesosphere, as we'll want to include ams::util, ams::result, ams::svc...
This commit is contained in:
@@ -22,7 +22,7 @@
|
||||
#include "updater_files.hpp"
|
||||
#include "updater_paths.hpp"
|
||||
|
||||
namespace sts::updater {
|
||||
namespace ams::updater {
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -72,7 +72,7 @@ namespace sts::updater {
|
||||
return true;
|
||||
case BootImageUpdateType::Mariko:
|
||||
return false;
|
||||
STS_UNREACHABLE_DEFAULT_CASE();
|
||||
AMS_UNREACHABLE_DEFAULT_CASE();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ namespace sts::updater {
|
||||
return true;
|
||||
case BootImageUpdateType::Mariko:
|
||||
return false;
|
||||
STS_UNREACHABLE_DEFAULT_CASE();
|
||||
AMS_UNREACHABLE_DEFAULT_CASE();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ namespace sts::updater {
|
||||
return NcmContentMetaType_BootImagePackage;
|
||||
case BootModeType::Safe:
|
||||
return NcmContentMetaType_BootImagePackageSafe;
|
||||
STS_UNREACHABLE_DEFAULT_CASE();
|
||||
AMS_UNREACHABLE_DEFAULT_CASE();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -139,7 +139,7 @@ namespace sts::updater {
|
||||
Result GetBootImagePackageDataId(u64 *out_data_id, BootModeType mode, void *work_buffer, size_t work_buffer_size) {
|
||||
/* Ensure we can read content metas. */
|
||||
constexpr size_t MaxContentMetas = 0x40;
|
||||
STS_ASSERT(work_buffer_size >= sizeof(NcmContentMetaKey) * MaxContentMetas);
|
||||
AMS_ASSERT(work_buffer_size >= sizeof(NcmContentMetaKey) * MaxContentMetas);
|
||||
|
||||
/* Open NAND System meta database, list contents. */
|
||||
NcmContentMetaDatabase meta_db;
|
||||
@@ -156,7 +156,7 @@ namespace sts::updater {
|
||||
return ResultBootImagePackageNotFound();
|
||||
}
|
||||
|
||||
STS_ASSERT(total_entries == written_entries);
|
||||
AMS_ASSERT(total_entries == written_entries);
|
||||
|
||||
/* Output is sorted, return the lowest valid exfat entry. */
|
||||
if (total_entries > 1) {
|
||||
@@ -182,7 +182,7 @@ namespace sts::updater {
|
||||
return VerifyBootImagesNormal(data_id, work_buffer, work_buffer_size, boot_image_update_type);
|
||||
case BootModeType::Safe:
|
||||
return VerifyBootImagesSafe(data_id, work_buffer, work_buffer_size, boot_image_update_type);
|
||||
STS_UNREACHABLE_DEFAULT_CASE();
|
||||
AMS_UNREACHABLE_DEFAULT_CASE();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -303,7 +303,7 @@ namespace sts::updater {
|
||||
return UpdateBootImagesNormal(data_id, work_buffer, work_buffer_size, boot_image_update_type);
|
||||
case BootModeType::Safe:
|
||||
return UpdateBootImagesSafe(data_id, work_buffer, work_buffer_size, boot_image_update_type);
|
||||
STS_UNREACHABLE_DEFAULT_CASE();
|
||||
AMS_UNREACHABLE_DEFAULT_CASE();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -340,7 +340,7 @@ namespace sts::updater {
|
||||
}
|
||||
|
||||
/* Only preserve autorcm if on a unit with unpatched rcm bug. */
|
||||
if (HasAutoRcmPreserve(boot_image_update_type) && !ams::IsRcmBugPatched()) {
|
||||
if (HasAutoRcmPreserve(boot_image_update_type) && !exosphere::IsRcmBugPatched()) {
|
||||
R_TRY(boot0_accessor.PreserveAutoRcm(bct, work, Boot0Partition::BctNormalSub));
|
||||
R_TRY(boot0_accessor.Write(bct, BctSize, Boot0Partition::BctNormalSub));
|
||||
R_TRY(boot0_accessor.PreserveAutoRcm(bct, work, Boot0Partition::BctNormalMain));
|
||||
@@ -399,7 +399,7 @@ namespace sts::updater {
|
||||
R_TRY(boot0_accessor.UpdateEks(bct, work));
|
||||
}
|
||||
/* Only preserve autorcm if on a unit with unpatched rcm bug. */
|
||||
if (HasAutoRcmPreserve(boot_image_update_type) && !ams::IsRcmBugPatched()) {
|
||||
if (HasAutoRcmPreserve(boot_image_update_type) && !exosphere::IsRcmBugPatched()) {
|
||||
R_TRY(boot0_accessor.PreserveAutoRcm(bct, work, Boot0Partition::BctSafeSub));
|
||||
R_TRY(boot0_accessor.Write(bct, BctSize, Boot0Partition::BctSafeSub));
|
||||
R_TRY(boot0_accessor.PreserveAutoRcm(bct, work, Boot0Partition::BctSafeMain));
|
||||
@@ -492,7 +492,7 @@ namespace sts::updater {
|
||||
case spl::HardwareType::Hoag:
|
||||
case spl::HardwareType::Iowa:
|
||||
return BootImageUpdateType::Mariko;
|
||||
STS_UNREACHABLE_DEFAULT_CASE();
|
||||
AMS_UNREACHABLE_DEFAULT_CASE();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
#include "updater_bis_management.hpp"
|
||||
|
||||
namespace sts::updater {
|
||||
namespace ams::updater {
|
||||
|
||||
Result BisAccessor::Initialize() {
|
||||
R_TRY(fsOpenBisStorage(&this->storage, this->partition_id));
|
||||
@@ -35,18 +35,18 @@ namespace sts::updater {
|
||||
}
|
||||
|
||||
Result BisAccessor::Read(void *dst, size_t size, u64 offset) {
|
||||
STS_ASSERT((offset % SectorAlignment) == 0);
|
||||
AMS_ASSERT((offset % SectorAlignment) == 0);
|
||||
return fsStorageRead(&this->storage, offset, dst, size);
|
||||
}
|
||||
|
||||
Result BisAccessor::Write(u64 offset, const void *src, size_t size) {
|
||||
STS_ASSERT((offset % SectorAlignment) == 0);
|
||||
AMS_ASSERT((offset % SectorAlignment) == 0);
|
||||
return fsStorageWrite(&this->storage, offset, src, size);
|
||||
}
|
||||
|
||||
Result BisAccessor::Write(u64 offset, size_t size, const char *bip_path, void *work_buffer, size_t work_buffer_size) {
|
||||
STS_ASSERT((offset % SectorAlignment) == 0);
|
||||
STS_ASSERT((work_buffer_size % SectorAlignment) == 0);
|
||||
AMS_ASSERT((offset % SectorAlignment) == 0);
|
||||
AMS_ASSERT((work_buffer_size % SectorAlignment) == 0);
|
||||
|
||||
FILE *bip_fp = fopen(bip_path, "rb");
|
||||
if (bip_fp == NULL) {
|
||||
@@ -63,7 +63,7 @@ namespace sts::updater {
|
||||
return fsdevGetLastResult();
|
||||
}
|
||||
}
|
||||
STS_ASSERT(written + read_size <= size);
|
||||
AMS_ASSERT(written + read_size <= size);
|
||||
|
||||
size_t aligned_size = ((read_size + SectorAlignment - 1) / SectorAlignment) * SectorAlignment;
|
||||
R_TRY(this->Write(offset + written, work_buffer, aligned_size));
|
||||
@@ -77,8 +77,8 @@ namespace sts::updater {
|
||||
}
|
||||
|
||||
Result BisAccessor::Clear(u64 offset, u64 size, void *work_buffer, size_t work_buffer_size) {
|
||||
STS_ASSERT((offset % SectorAlignment) == 0);
|
||||
STS_ASSERT((work_buffer_size % SectorAlignment) == 0);
|
||||
AMS_ASSERT((offset % SectorAlignment) == 0);
|
||||
AMS_ASSERT((work_buffer_size % SectorAlignment) == 0);
|
||||
|
||||
std::memset(work_buffer, 0, work_buffer_size);
|
||||
|
||||
@@ -92,8 +92,8 @@ namespace sts::updater {
|
||||
}
|
||||
|
||||
Result BisAccessor::GetHash(void *dst, u64 offset, u64 size, u64 hash_size, void *work_buffer, size_t work_buffer_size) {
|
||||
STS_ASSERT((offset % SectorAlignment) == 0);
|
||||
STS_ASSERT((work_buffer_size % SectorAlignment) == 0);
|
||||
AMS_ASSERT((offset % SectorAlignment) == 0);
|
||||
AMS_ASSERT((work_buffer_size % SectorAlignment) == 0);
|
||||
|
||||
Sha256Context sha_ctx;
|
||||
sha256ContextCreate(&sha_ctx);
|
||||
@@ -113,12 +113,12 @@ namespace sts::updater {
|
||||
|
||||
size_t Boot0Accessor::GetBootloaderVersion(void *bct) {
|
||||
u32 version = *reinterpret_cast<u32 *>(reinterpret_cast<uintptr_t>(bct) + BctVersionOffset);
|
||||
STS_ASSERT(version <= BctVersionMax);
|
||||
AMS_ASSERT(version <= BctVersionMax);
|
||||
return static_cast<size_t>(version);
|
||||
}
|
||||
|
||||
size_t Boot0Accessor::GetEksIndex(size_t bootloader_version) {
|
||||
STS_ASSERT(bootloader_version <= BctVersionMax);
|
||||
AMS_ASSERT(bootloader_version <= BctVersionMax);
|
||||
return (bootloader_version > 0) ? bootloader_version - 1 : 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
#include <stratosphere.hpp>
|
||||
#include <stratosphere/updater/updater_types.hpp>
|
||||
|
||||
namespace sts::updater {
|
||||
namespace ams::updater {
|
||||
|
||||
class BisAccessor {
|
||||
public:
|
||||
@@ -138,13 +138,13 @@ namespace sts::updater {
|
||||
}
|
||||
}
|
||||
|
||||
STS_ASSERT(entry != nullptr);
|
||||
AMS_ASSERT(entry != nullptr);
|
||||
return entry;
|
||||
}
|
||||
public:
|
||||
Result Read(size_t *out_size, void *dst, size_t size, EnumType which) {
|
||||
const auto entry = FindEntry(which);
|
||||
STS_ASSERT(size >= entry->size);
|
||||
AMS_ASSERT(size >= entry->size);
|
||||
|
||||
R_TRY(BisAccessor::Read(dst, entry->size, entry->offset));
|
||||
|
||||
@@ -154,8 +154,8 @@ namespace sts::updater {
|
||||
|
||||
Result Write(const void *src, size_t size, EnumType which) {
|
||||
const auto entry = FindEntry(which);
|
||||
STS_ASSERT(size <= entry->size);
|
||||
STS_ASSERT((size % BisAccessor::SectorAlignment) == 0);
|
||||
AMS_ASSERT(size <= entry->size);
|
||||
AMS_ASSERT((size % BisAccessor::SectorAlignment) == 0);
|
||||
return BisAccessor::Write(entry->offset, src, size);
|
||||
}
|
||||
|
||||
@@ -198,7 +198,7 @@ namespace sts::updater {
|
||||
return FsBisStorageId_BootConfigAndPackage2RepairMain;
|
||||
case Package2Type::RepairSub:
|
||||
return FsBisStorageId_BootConfigAndPackage2RepairSub;
|
||||
STS_UNREACHABLE_DEFAULT_CASE();
|
||||
AMS_UNREACHABLE_DEFAULT_CASE();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
#include "updater_bis_save.hpp"
|
||||
|
||||
namespace sts::updater {
|
||||
namespace ams::updater {
|
||||
|
||||
size_t BisSave::GetVerificationFlagOffset(BootModeType mode) {
|
||||
switch (mode) {
|
||||
@@ -33,9 +33,9 @@ namespace sts::updater {
|
||||
}
|
||||
|
||||
Result BisSave::Initialize(void *work_buffer, size_t work_buffer_size) {
|
||||
STS_ASSERT(work_buffer_size >= SaveSize);
|
||||
STS_ASSERT(util::IsAligned(reinterpret_cast<uintptr_t>(work_buffer), 0x1000));
|
||||
STS_ASSERT(util::IsAligned(work_buffer_size, 0x200));
|
||||
AMS_ASSERT(work_buffer_size >= SaveSize);
|
||||
AMS_ASSERT(util::IsAligned(reinterpret_cast<uintptr_t>(work_buffer), 0x1000));
|
||||
AMS_ASSERT(util::IsAligned(work_buffer_size, 0x200));
|
||||
|
||||
R_TRY(this->accessor.Initialize());
|
||||
this->save_buffer = work_buffer;
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
#include "updater_bis_management.hpp"
|
||||
|
||||
namespace sts::updater {
|
||||
namespace ams::updater {
|
||||
|
||||
class BisSave {
|
||||
public:
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
#include "updater_files.hpp"
|
||||
|
||||
namespace sts::updater {
|
||||
namespace ams::updater {
|
||||
|
||||
Result ReadFile(size_t *out_size, void *dst, size_t dst_size, const char *path) {
|
||||
FILE *fp = fopen(path, "rb");
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
#include <stratosphere.hpp>
|
||||
#include <stratosphere/updater/updater_types.hpp>
|
||||
|
||||
namespace sts::updater {
|
||||
namespace ams::updater {
|
||||
|
||||
/* File helpers. */
|
||||
Result ReadFile(size_t *out_size, void *dst, size_t dst_size, const char *path);
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
#include "updater_paths.hpp"
|
||||
|
||||
namespace sts::updater {
|
||||
namespace ams::updater {
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace sts::updater {
|
||||
constexpr const char *Package2PathA = "bip:/a/package2";
|
||||
|
||||
const char *ChooseCandidatePath(const char * const *candidates, size_t num_candidates) {
|
||||
STS_ASSERT(num_candidates > 0);
|
||||
AMS_ASSERT(num_candidates > 0);
|
||||
|
||||
for (size_t i = 0; i < num_candidates; i++) {
|
||||
struct stat buf;
|
||||
@@ -72,7 +72,7 @@ namespace sts::updater {
|
||||
constexpr const char *candidates[] = {BctPathA, BctPathNx};
|
||||
return ChooseCandidatePath(candidates, util::size(candidates));
|
||||
}
|
||||
STS_UNREACHABLE_DEFAULT_CASE();
|
||||
AMS_UNREACHABLE_DEFAULT_CASE();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ namespace sts::updater {
|
||||
constexpr const char *candidates[] = {Package1PathA, Package1PathNx};
|
||||
return ChooseCandidatePath(candidates, util::size(candidates));
|
||||
}
|
||||
STS_UNREACHABLE_DEFAULT_CASE();
|
||||
AMS_UNREACHABLE_DEFAULT_CASE();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ namespace sts::updater {
|
||||
constexpr const char *candidates[] = {Package2PathA, Package2PathNx};
|
||||
return ChooseCandidatePath(candidates, util::size(candidates));
|
||||
}
|
||||
STS_UNREACHABLE_DEFAULT_CASE();;
|
||||
AMS_UNREACHABLE_DEFAULT_CASE();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
#include <stratosphere.hpp>
|
||||
#include <stratosphere/updater/updater_types.hpp>
|
||||
|
||||
namespace sts::updater {
|
||||
namespace ams::updater {
|
||||
|
||||
/* Path functionality. */
|
||||
const char *GetBootImagePackageMountPath();
|
||||
|
||||
Reference in New Issue
Block a user