blob: af5d254c7a0a04d6f998c66eeef3588c5875c0b0 [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.
#ifndef SRC_STORAGE_MEMFS_VNODE_VMO_H_
#define SRC_STORAGE_MEMFS_VNODE_VMO_H_
#include "src/storage/memfs/memfs.h"
#include "src/storage/memfs/vnode.h"
namespace memfs {
class VnodeVmo final : public Vnode {
public:
VnodeVmo(Memfs& memfs, zx_handle_t vmo, zx_off_t offset, zx_off_t length);
~VnodeVmo() override;
fuchsia_io::NodeProtocolKinds GetProtocols() const final;
bool ValidateRights(fuchsia_io::Rights rights) const final;
private:
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 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
#endif // SRC_STORAGE_MEMFS_VNODE_VMO_H_