class Dnode

Defined at line 36 of file ../../src/storage/memfs/dnode.h

The named portion of a node, representing the named hierarchy.

Dnodes always have one corresponding Vnode (a name represents one vnode).

Vnodes may be represented by multiple Dnodes (a vnode may have many names).

Dnodes are owned by their parents.

Public Methods

zx::result<std::unique_ptr<Dnode>> Create (std::string name, fbl::RefPtr<Vnode> vn)

Allocates a dnode, attached to a vnode

Defined at line 28 of file ../../src/storage/memfs/dnode.cc

void Dnode (const Dnode & )

Defined at line 38 of file ../../src/storage/memfs/dnode.h

void Dnode (Dnode && )

Defined at line 38 of file ../../src/storage/memfs/dnode.h

Dnode & operator= (const Dnode & )

Defined at line 38 of file ../../src/storage/memfs/dnode.h

Dnode & operator= (Dnode && )

Defined at line 38 of file ../../src/storage/memfs/dnode.h

void AddChild (Dnode * parent, std::unique_ptr<Dnode> child)

Takes a parent-less node and makes it a child of the parent node.

Increments child link count by one.

If the child is a directory, increments the parent link count by one.

Defined at line 66 of file ../../src/storage/memfs/dnode.cc

void ~Dnode ()

Defined at line 171 of file ../../src/storage/memfs/dnode.cc

std::unique_ptr<Dnode> RemoveFromParent ()

Removes a dnode from its parent (if dnode has a parent)

Decrements parent link count by one.

Defined at line 36 of file ../../src/storage/memfs/dnode.cc

void Detach ()

Detaches a dnode from its parent / vnode.

Decrements dn->vnode link count by one (if it exists).

Precondition: Dnode has no children.

Postcondition: "this" may be destroyed.

Defined at line 54 of file ../../src/storage/memfs/dnode.cc

bool HasChildren ()

Defined at line 62 of file ../../src/storage/memfs/dnode.h

Dnode * Lookup (std::string_view name)

Look up the child dnode (within a parent directory) by name.

Returns nullptr if the child is not found.

Defined at line 89 of file ../../src/storage/memfs/dnode.cc

fbl::RefPtr<Vnode> AcquireVnode ()

Acquire a pointer to the vnode underneath this dnode.

Acquires a reference to the underlying vnode.

Defined at line 97 of file ../../src/storage/memfs/dnode.cc

Dnode * GetParent ()

Get a pointer to the parent Dnode. If current Dnode is root, return nullptr.

Defined at line 99 of file ../../src/storage/memfs/dnode.cc

zx_status_t CanUnlink ()

Returns ZX_OK if the dnode may be unlinked

Defined at line 101 of file ../../src/storage/memfs/dnode.cc

zx_status_t Readdir (fs::DirentFiller & df, void * cookie)

Populates df with this directory's entries.

Defined at line 120 of file ../../src/storage/memfs/dnode.cc

bool IsSubdirectory (const Dnode * dn)

Answers the question: "Is dn a subdirectory of this?"

Defined at line 145 of file ../../src/storage/memfs/dnode.cc

std::string TakeName ()

Functions to take / steal the allocated dnode name.

Defined at line 158 of file ../../src/storage/memfs/dnode.cc

void PutName (std::string name)

Defined at line 164 of file ../../src/storage/memfs/dnode.cc

bool IsDirectory ()

Defined at line 166 of file ../../src/storage/memfs/dnode.cc

Friends

class TypeChildTraits