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_t length, size_t offset, 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_t length, size_t offset, 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::vmo vmo, size_t length, bool writable, DefaultSharingMode vmo_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 DefaultSharingMode
Name Value
kNone 0
kDuplicate 1
kCloneCow 2

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