class Vfs
Defined at line 51 of file ../../src/storage/lib/vfs/cpp/vfs.h
The Vfs object contains global per-filesystem state, which may be valid across a collection of
Vnodes. It dispatches requests to per-file/directory Vnode objects.
This class can be used on a Fuchsia system or on the host computer where the compilation is done
(the host builds of the filesystems are how system images are created). Normally Fuchsia builds
will use the ManagedVfs subclass which handles the FIDL-to-vnode connections.
The Vfs object must outlive the Vnodes which it serves. This class is thread-safe.
Protected Members
mutex vfs_lock_
mutex live_nodes_lock_
Public Methods
void ~Vfs ()
Defined at line 57 of file ../../src/storage/lib/vfs/cpp/vfs.h
bool IsReadonly ()
Query if this file system is read-only.
Defined at line 87 of file ../../src/storage/lib/vfs/cpp/vfs.h
void Vfs ()
Defined at line 117 of file ../../src/storage/lib/vfs/cpp/vfs.cc
DeprecatedOpenResult DeprecatedOpen (fbl::RefPtr<Vnode> vn, std::string_view path, DeprecatedOptions options, fuchsia_io::Rights connection_rights)
Traverse the path to the target vnode, and create / open it using the underlying filesystem
functions (lookup, create, open).
The return value will suggest the next action to take. Refer to the variants in
|DeprecatedOpenResult| for more information.
Defined at line 119 of file ../../src/storage/lib/vfs/cpp/vfs.cc
zx::result<OpenResult> Open (fbl::RefPtr<Vnode> vndir, std::string_view path, fuchsia_io::Flags flags, const fuchsia_io::wire::Options * options, fuchsia_io::Rights connection_rights)
Traverse the path to the target node, and create or open it.
Defined at line 205 of file ../../src/storage/lib/vfs/cpp/vfs.cc
zx_status_t Unlink (fbl::RefPtr<Vnode> vn, std::string_view name, bool must_be_dir)
Implements Unlink for a pre-validated and trimmed name.
Defined at line 316 of file ../../src/storage/lib/vfs/cpp/vfs.cc
zx_status_t Readdir (Vnode * vn, VdirCookie * cookie, void * dirents, size_t len, size_t * out_actual)
Calls readdir on the Vnode while holding the vfs_lock, preventing path modification operations
for the duration of the operation.
Defined at line 413 of file ../../src/storage/lib/vfs/cpp/vfs.cc
void SetReadonly (bool value)
Sets whether this file system is read-only.
Defined at line 419 of file ../../src/storage/lib/vfs/cpp/vfs.cc
Protected Methods
bool ReadonlyLocked ()
Whether this file system is read-only.
Defined at line 94 of file ../../src/storage/lib/vfs/cpp/vfs.h
zx::result<bool> TrimName (std::string_view & name)
Trim trailing slashes from name before sending it to internal filesystem functions. This also
validates whether the name has internal slashes and rejects them. Returns failure if the
resulting name is too long, empty, or contains slashes after trimming.
Returns true iff name is suffixed with a trailing slash indicating an explicit reference to a
directory.
Defined at line 390 of file ../../src/storage/lib/vfs/cpp/vfs.cc
zx::result<std::tuple<fbl::RefPtr<Vnode>, bool>> CreateOrLookup (fbl::RefPtr<fs::Vnode> vndir, std::string_view name, CreationMode mode, std::optional<CreationType> type, fuchsia_io::Rights connection_rights)
Defined at line 329 of file ../../src/storage/lib/vfs/cpp/vfs.cc