|
@@ -12,6 +12,7 @@
|
|
#include <Kernel/Forward.h>
|
|
#include <Kernel/Forward.h>
|
|
#include <Kernel/Heap/SlabAllocator.h>
|
|
#include <Kernel/Heap/SlabAllocator.h>
|
|
#include <Kernel/KResult.h>
|
|
#include <Kernel/KResult.h>
|
|
|
|
+#include <Kernel/KString.h>
|
|
|
|
|
|
namespace Kernel {
|
|
namespace Kernel {
|
|
|
|
|
|
@@ -20,14 +21,7 @@ namespace Kernel {
|
|
class Custody : public RefCounted<Custody> {
|
|
class Custody : public RefCounted<Custody> {
|
|
MAKE_SLAB_ALLOCATED(Custody)
|
|
MAKE_SLAB_ALLOCATED(Custody)
|
|
public:
|
|
public:
|
|
- static KResultOr<NonnullRefPtr<Custody>> create(Custody* parent, const StringView& name, Inode& inode, int mount_flags)
|
|
|
|
- {
|
|
|
|
- auto custody = adopt_ref_if_nonnull(new Custody(parent, name, inode, mount_flags));
|
|
|
|
- if (!custody)
|
|
|
|
- return ENOMEM;
|
|
|
|
-
|
|
|
|
- return custody.release_nonnull();
|
|
|
|
- }
|
|
|
|
|
|
+ static KResultOr<NonnullRefPtr<Custody>> create(Custody* parent, StringView name, Inode& inode, int mount_flags);
|
|
|
|
|
|
~Custody();
|
|
~Custody();
|
|
|
|
|
|
@@ -35,17 +29,17 @@ public:
|
|
const Custody* parent() const { return m_parent.ptr(); }
|
|
const Custody* parent() const { return m_parent.ptr(); }
|
|
Inode& inode() { return *m_inode; }
|
|
Inode& inode() { return *m_inode; }
|
|
const Inode& inode() const { return *m_inode; }
|
|
const Inode& inode() const { return *m_inode; }
|
|
- const String& name() const { return m_name; }
|
|
|
|
|
|
+ StringView name() const { return m_name->view(); }
|
|
String absolute_path() const;
|
|
String absolute_path() const;
|
|
|
|
|
|
int mount_flags() const { return m_mount_flags; }
|
|
int mount_flags() const { return m_mount_flags; }
|
|
bool is_readonly() const;
|
|
bool is_readonly() const;
|
|
|
|
|
|
private:
|
|
private:
|
|
- Custody(Custody* parent, const StringView& name, Inode&, int mount_flags);
|
|
|
|
|
|
+ Custody(Custody* parent, NonnullOwnPtr<KString> name, Inode&, int mount_flags);
|
|
|
|
|
|
RefPtr<Custody> m_parent;
|
|
RefPtr<Custody> m_parent;
|
|
- String m_name;
|
|
|
|
|
|
+ NonnullOwnPtr<KString> m_name;
|
|
NonnullRefPtr<Inode> m_inode;
|
|
NonnullRefPtr<Inode> m_inode;
|
|
int m_mount_flags { 0 };
|
|
int m_mount_flags { 0 };
|
|
};
|
|
};
|