mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-05-27 13:14:15 -04:00
kern: Implement SvcManageNamedPort
This commit is contained in:
parent
6c52cc3e26
commit
ca26d8ce27
22 changed files with 1035 additions and 11 deletions
|
@ -23,7 +23,39 @@ namespace ams::kern {
|
|||
|
||||
class KObjectName : public KSlabAllocated<KObjectName>, public util::IntrusiveListBaseNode<KObjectName> {
|
||||
public:
|
||||
/* TODO: This is a placeholder definition. */
|
||||
static constexpr size_t NameLengthMax = 12;
|
||||
|
||||
using List = util::IntrusiveListBaseTraits<KObjectName>::ListType;
|
||||
private:
|
||||
char name[NameLengthMax];
|
||||
KAutoObject *object;
|
||||
public:
|
||||
constexpr KObjectName() : name(), object() { /* ... */ }
|
||||
public:
|
||||
static Result NewFromName(KAutoObject *obj, const char *name);
|
||||
static Result Delete(KAutoObject *obj, const char *name);
|
||||
|
||||
static KScopedAutoObject<KAutoObject> Find(const char *name);
|
||||
|
||||
template<typename Derived>
|
||||
static Result Delete(const char *name) {
|
||||
/* Find the object. */
|
||||
KScopedAutoObject obj = Find(name);
|
||||
R_UNLESS(obj.IsNotNull(), svc::ResultNotFound());
|
||||
|
||||
/* Cast the object to the desired type. */
|
||||
Derived *derived = obj->DynamicCast<Derived *>();
|
||||
R_UNLESS(derived != nullptr, svc::ResultNotFound());
|
||||
|
||||
return Delete(obj.GetPointerUnsafe(), name);
|
||||
}
|
||||
private:
|
||||
static KScopedAutoObject<KAutoObject> FindImpl(const char *name);
|
||||
|
||||
void Initialize(KAutoObject *obj, const char *name);
|
||||
|
||||
bool MatchesName(const char *name) const;
|
||||
KAutoObject *GetObject() const { return this->object; }
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue