class VmoFile
Defined at line 24 of file ../../sdk/lib/vfs/cpp/vmo_file.h
A file node backed by a range of bytes in a VMO.
The file has a fixed size specified at creating time; it does not grow or shrink even when
written into.
This class is thread-safe.
Public Methods
void VmoFile (zx::vmo vmo, size_t length, WriteMode write_option, DefaultSharingMode vmo_sharing)
Creates a file node backed by a VMO.
Defined at line 65 of file ../../sdk/lib/vfs/cpp/vmo_file.h
zx_status_t Serve (fuchsia_io::Flags flags, fidl::ServerEnd<fuchsia_io::File> server_end, async_dispatcher_t * dispatcher)
Serve a new connection to this VMO-file 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 75 of file ../../sdk/lib/vfs/cpp/vmo_file.h
zx::unowned_vmo vmo ()
Returns a borrowed handle to the VMO backing this file.
Defined at line 85 of file ../../sdk/lib/vfs/cpp/vmo_file.h
Enumerations
enum WriteMode
| Name | Value |
|---|---|
| kReadOnly | VFS_INTERNAL_WRITE_MODE_READ_ONLY |
| kWritable | VFS_INTERNAL_WRITE_MODE_WRITABLE |
Specifies the desired behavior of writes.
Defined at line 27 of file ../../sdk/lib/vfs/cpp/vmo_file.h
enum DefaultSharingMode
| Name | Value |
|---|---|
| kNone | VFS_INTERNAL_SHARING_MODE_NONE |
| kDuplicate | VFS_INTERNAL_SHARING_MODE_DUPLICATE |
| kCloneCow | VFS_INTERNAL_SHARING_MODE_COW |
Specifies the default behavior when a client asks for the file's underlying VMO, but does not
specify if a duplicate handle or copy-on-write clone is required.
*NOTE*: This does not affect the behavior of requests that specify the required sharing mode.
Requests for a specific sharing mode will be fulfilled as requested.
Defined at line 39 of file ../../sdk/lib/vfs/cpp/vmo_file.h