blob: 266638c7a9136c63d130d825b26a135a0a4d70d1 [file] [log] [blame]
// Copyright 2019 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 <lib/vfs/cpp/internal/directory.h>
namespace vfs {
// A remote directory holds a channel to a remotely hosted directory to
// which requests are delegated when opened.
// This class is designed to allow programs to publish remote filesystems
// as directories without requiring a separate "mount" step. In effect,
// a remote directory is "mounted" at creation time.
// It is not possible for the client to detach the remote directory or
// to mount a new one in its place.
class RemoteDir final : public vfs::internal::Directory {
// Binds to a remotely hosted directory using the specified
// || client channel endpoint.The channel must be valid.
explicit RemoteDir(zx::channel remote_dir);
// Binds to a remotely hosted directory using the specified
// InterfaceHandle. Handle must be valid.
explicit RemoteDir(fidl::InterfaceHandle<fuchsia::io::Directory> dir);
~RemoteDir() override;
// |Node| implementation
zx_status_t Connect(uint32_t flags, zx::channel request, async_dispatcher_t* dispatcher) final;
// |Directory| implementation
zx_status_t Readdir(uint64_t offset, void* data, uint64_t len, uint64_t* out_offset,
uint64_t* out_actual) final;
NodeKind::Type GetKind() const final;
fuchsia::io::DirectorySyncPtr dir_ptr_;
} // namespace vfs