blob: bb3b14c04b19eeb22c26987d44743120f97f95c5 [file] [log] [blame]
// Copyright 2017 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "src/storage/memfs/memfs.h"
#include "src/storage/memfs/vnode.h"
namespace memfs {
class VnodeVmo final : public Vnode {
VnodeVmo(Memfs& memfs, zx_handle_t vmo, zx_off_t offset, zx_off_t length);
~VnodeVmo() override;
fs::VnodeProtocolSet GetProtocols() const final;
bool ValidateRights(fs::Rights rights) const final;
zx_status_t Read(void* data, size_t len, size_t off, size_t* out_actual) final;
zx_status_t GetAttributes(fs::VnodeAttributes* a) final;
zx_status_t GetNodeInfoForProtocol(fs::VnodeProtocol protocol, fs::Rights rights,
fs::VnodeRepresentation* info) final;
zx_status_t GetVmo(fuchsia_io::wire::VmoFlags flags, zx::vmo* out_vmo) final;
zx_status_t MakeLocalClone();
zx_handle_t vmo_ = ZX_HANDLE_INVALID;
zx_off_t offset_ = 0;
zx_off_t length_ = 0;
bool executable_ = false;
bool have_local_clone_ = false;
} // namespace memfs