class VmoFile
Defined at line 32 of file ../../src/storage/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
fuchsia_io::NodeProtocolKinds GetProtocols ()
|Vnode| implementation:
Defined at line 37 of file ../../src/storage/lib/vfs/cpp/vmo_file.cc
bool ValidateRights (fuchsia_io::Rights rights)
Defined at line 41 of file ../../src/storage/lib/vfs/cpp/vmo_file.cc
zx::result<fs::VnodeAttributes> GetAttributes ()
Defined at line 54 of file ../../src/storage/lib/vfs/cpp/vmo_file.cc
zx_status_t Read (void *data,size_tlength,size_toffset,size_t *out_actual)
Defined at line 61 of file ../../src/storage/lib/vfs/cpp/vmo_file.cc
const zx::vmo & vmo ()
The underlying VMO handle.
Defined at line 70 of file ../../src/storage/lib/vfs/cpp/vmo_file.h
size_t length ()
The length of the file in bytes.
Defined at line 73 of file ../../src/storage/lib/vfs/cpp/vmo_file.h
bool is_writable ()
True if the file is writable.
If false, attempts to open the file for write will fail.
Defined at line 77 of file ../../src/storage/lib/vfs/cpp/vmo_file.h
zx_status_t Write (const void *data,size_tlength,size_toffset,size_t *out_actual)
Defined at line 77 of file ../../src/storage/lib/vfs/cpp/vmo_file.cc
zx_status_t GetVmo (fuchsia_io::wire::VmoFlags flags, zx::vmo * out_vmo)
Defined at line 95 of file ../../src/storage/lib/vfs/cpp/vmo_file.cc
Protected Methods
void VmoFile (zx::vmovmo,size_tlength,boolwritable,DefaultSharingModevmo_sharing)
Creates a file node backed by a VMO.
Defined at line 30 of file ../../src/storage/lib/vfs/cpp/vmo_file.cc
void ~VmoFile ()
Defined at line 35 of file ../../src/storage/lib/vfs/cpp/vmo_file.cc
Enumerations
enum class DefaultSharingMode : uint8_t
| Name | Value | Comments |
|---|---|---|
| kNone | 0 |
NOT_SUPPORTED will be returned, unless a sharing mode is specified in the request. |
| kDuplicate | 1 |
The VMO handle is duplicated for each client.
This is appropriate when it is okay for clients to access the entire
This mode is significantly more efficient than |CLONE_COW| and should be
As size changes are currently untracked, all handles given out in this |
| kCloneCow | 2 |
The VMO range spanned by the file is cloned on demand, using
This is appropriate when clients need to be restricted from accessing |
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,
those requests will still be fulfilled.
Defined at line 41 of file ../../src/storage/lib/vfs/cpp/vmo_file.h
Friends
class RefPtr
class MakeRefCountedHelper