class PseudoDir
Defined at line 25 of file ../../sdk/lib/vfs/cpp/pseudo_dir.h
A pseudo-directory is a directory-like object whose entries are constructed by a program at
runtime. The client can lookup, enumerate, and watch these directory entries but it cannot
create, remove, or rename them.
This class is thread-safe.
Public Methods
void PseudoDir ()
Defined at line 27 of file ../../sdk/lib/vfs/cpp/pseudo_dir.h
void ~PseudoDir ()
Defined at line 29 of file ../../sdk/lib/vfs/cpp/pseudo_dir.h
zx_status_t Serve (fuchsia_io::Flags flags, fidl::ServerEnd<fuchsia_io::Directory> server_end, async_dispatcher_t * dispatcher)
Serve a new connection to this pseudo-directory on `server_end` using specified `flags`.
This method must only be used with a single-threaded asynchronous dispatcher. If `dispatcher`
is `nullptr`, the current thread's default dispatcher will be used via
`async_get_default_dispatcher`. The same `dispatcher` must be used if multiple connections are
served for the same node, otherwise `ZX_ERR_INVALID_ARGS` will be returned.
Defined at line 41 of file ../../sdk/lib/vfs/cpp/pseudo_dir.h
zx_status_t AddSharedEntry (std::string name, std::shared_ptr<Node> vn)
Adds a directory entry associating the given `name` with `vn`. The same node may be added
multiple times with different names. Returns `ZX_ERR_ALREADY_EXISTS` if there is already a node
associated with `name`.
Defined at line 53 of file ../../sdk/lib/vfs/cpp/pseudo_dir.h
zx_status_t AddEntry (std::string name, std::unique_ptr<Node> vn)
Adds a directory entry associating the given `name` with `vn`. Returns `ZX_ERR_ALREADY_EXISTS`
if there is already a node associated with `name`.
Defined at line 68 of file ../../sdk/lib/vfs/cpp/pseudo_dir.h
zx_status_t RemoveEntry (const std::string & name)
Removes a directory entry with the given `name`, closing any active connections to the node
in the process. Returns `ZX_ERR_NOT_FOUND` there is no node with `name`.
Defined at line 74 of file ../../sdk/lib/vfs/cpp/pseudo_dir.h
zx_status_t RemoveEntry (const std::string & name, const Node * node)
Removes a directory entry with the given `name` that matches `node`, closing any active
connections to the node in the process. Returns `ZX_ERR_NOT_FOUND` there is no node that
matches both `name` and `node`.
Defined at line 79 of file ../../sdk/lib/vfs/cpp/pseudo_dir.h
bool IsEmpty ()
Checks if directory is empty. Use caution if modifying this directory from multiple threads.
Defined at line 84 of file ../../sdk/lib/vfs/cpp/pseudo_dir.h
zx_status_t Lookup (std::string_view name, Node ** out_node)
Finds and returns a node matching `name` as `out_node`. This directory maintains ownership
of `out_node`. Returns `ZX_ERR_NOT_FOUND` if there is no node with `name`.
Defined at line 91 of file ../../sdk/lib/vfs/cpp/pseudo_dir.h