class PseudoDir
Defined at line 41 of file ../../src/storage/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 designed to allow programs to publish a relatively small number of entries (up to a
few dozen) such as services, file-system roots, debugging pseudo-files, or other vnodes. It is
not suitable for very large directories (hundreds of entries).
This class is thread-safe.
Public Methods
bool HasWatchers ()
Returns true if there are watchers.
Defined at line 73 of file ../../src/storage/lib/vfs/cpp/pseudo_dir.h
zx_status_t AddEntry (fbl::String name, fbl::RefPtr<fs::Vnode> vn)
Adds a directory entry associating the given |name| with |vn|. It is ok to add the same Vnode
multiple times with different names.
Returns |ZX_OK| on success.
Returns |ZX_ERR_ALREADY_EXISTS| if there is already a node with the given name.
Defined at line 108 of file ../../src/storage/lib/vfs/cpp/pseudo_dir.cc
zx_status_t RemoveEntry (std::string_view name)
Removes a directory entry with the given |name|.
Returns |ZX_OK| on success.
Returns |ZX_ERR_NOT_FOUND| if there is no node with the given name.
Defined at line 128 of file ../../src/storage/lib/vfs/cpp/pseudo_dir.cc
zx_status_t RemoveEntry (std::string_view name, fs::Vnode * vn)
An extension of |RemoveEntry| which additionally verifies
that the target vnode is |vn|.
Returns |ZX_OK| on success.
Returns |ZX_ERR_NOT_FOUND| if there is no node with the given name/vn pair.
Defined at line 142 of file ../../src/storage/lib/vfs/cpp/pseudo_dir.cc
void RemoveAllEntries ()
Removes all directory entries.
Defined at line 156 of file ../../src/storage/lib/vfs/cpp/pseudo_dir.cc
bool IsEmpty ()
Checks if directory is empty. Be careful while using this function if using this Dir in
multiple threads.
Defined at line 166 of file ../../src/storage/lib/vfs/cpp/pseudo_dir.cc
fuchsia_io::NodeProtocolKinds GetProtocols ()
|Vnode| implementation:
Defined at line 100 of file ../../src/storage/lib/vfs/cpp/pseudo_dir.cc
fuchsia_io::Abilities GetAbilities ()
Defined at line 104 of file ../../src/storage/lib/vfs/cpp/pseudo_dir.cc
zx_status_t Lookup (std::string_view name, fbl::RefPtr<fs::Vnode> * out)
Defined at line 43 of file ../../src/storage/lib/vfs/cpp/pseudo_dir.cc
void Notify (std::string_view name, fuchsia_io::wire::WatchEvent event)
Defined at line 55 of file ../../src/storage/lib/vfs/cpp/pseudo_dir.cc
zx_status_t WatchDir (fs::FuchsiaVfs * vfs, fuchsia_io::wire::WatchMask mask, uint32_t options, fidl::ServerEnd<fuchsia_io::DirectoryWatcher> watcher)
Defined at line 59 of file ../../src/storage/lib/vfs/cpp/pseudo_dir.cc
zx_status_t Readdir (VdirCookie * cookie, void * dirents, size_t len, size_t * out_actual)
Defined at line 64 of file ../../src/storage/lib/vfs/cpp/pseudo_dir.cc
Protected Methods
void PseudoDir ()
Creates a directory which is initially empty.
Defined at line 36 of file ../../src/storage/lib/vfs/cpp/pseudo_dir.cc
void ~PseudoDir ()
Destroys the directory and releases the nodes it contains.
Defined at line 38 of file ../../src/storage/lib/vfs/cpp/pseudo_dir.cc
Friends
class RefPtr
class MakeRefCountedHelper