forked from ShuriZma/suyu
1
0
Fork 0

Merge pull request #2313 from lioncash/reslimit

kernel/resource_limit: Remove the name member from resource limits
This commit is contained in:
bunnei 2019-04-02 16:03:54 -04:00 committed by GitHub
commit 57279e1981
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 14 deletions

View File

@ -115,7 +115,7 @@ struct KernelCore::Impl {
// Creates the default system resource limit // Creates the default system resource limit
void InitializeSystemResourceLimit(KernelCore& kernel) { void InitializeSystemResourceLimit(KernelCore& kernel) {
system_resource_limit = ResourceLimit::Create(kernel, "System"); system_resource_limit = ResourceLimit::Create(kernel);
// If setting the default system values fails, then something seriously wrong has occurred. // If setting the default system values fails, then something seriously wrong has occurred.
ASSERT(system_resource_limit->SetLimitValue(ResourceType::PhysicalMemory, 0x200000000) ASSERT(system_resource_limit->SetLimitValue(ResourceType::PhysicalMemory, 0x200000000)

View File

@ -16,11 +16,8 @@ constexpr std::size_t ResourceTypeToIndex(ResourceType type) {
ResourceLimit::ResourceLimit(KernelCore& kernel) : Object{kernel} {} ResourceLimit::ResourceLimit(KernelCore& kernel) : Object{kernel} {}
ResourceLimit::~ResourceLimit() = default; ResourceLimit::~ResourceLimit() = default;
SharedPtr<ResourceLimit> ResourceLimit::Create(KernelCore& kernel, std::string name) { SharedPtr<ResourceLimit> ResourceLimit::Create(KernelCore& kernel) {
SharedPtr<ResourceLimit> resource_limit(new ResourceLimit(kernel)); return new ResourceLimit(kernel);
resource_limit->name = std::move(name);
return resource_limit;
} }
s64 ResourceLimit::GetCurrentResourceValue(ResourceType resource) const { s64 ResourceLimit::GetCurrentResourceValue(ResourceType resource) const {

View File

@ -31,16 +31,14 @@ constexpr bool IsValidResourceType(ResourceType type) {
class ResourceLimit final : public Object { class ResourceLimit final : public Object {
public: public:
/** /// Creates a resource limit object.
* Creates a resource limit object. static SharedPtr<ResourceLimit> Create(KernelCore& kernel);
*/
static SharedPtr<ResourceLimit> Create(KernelCore& kernel, std::string name = "Unknown");
std::string GetTypeName() const override { std::string GetTypeName() const override {
return "ResourceLimit"; return "ResourceLimit";
} }
std::string GetName() const override { std::string GetName() const override {
return name; return GetTypeName();
} }
static const HandleType HANDLE_TYPE = HandleType::ResourceLimit; static const HandleType HANDLE_TYPE = HandleType::ResourceLimit;
@ -95,9 +93,6 @@ private:
ResourceArray limits{}; ResourceArray limits{};
/// Current resource limit values. /// Current resource limit values.
ResourceArray values{}; ResourceArray values{};
/// Name of resource limit object.
std::string name;
}; };
} // namespace Kernel } // namespace Kernel