| // 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. |
| |
| #ifndef SRC_LIB_STORAGE_VFS_CPP_NODE_CONNECTION_H_ |
| #define SRC_LIB_STORAGE_VFS_CPP_NODE_CONNECTION_H_ |
| |
| #ifndef __Fuchsia__ |
| #error "Fuchsia-only header" |
| #endif |
| |
| #include <fidl/fuchsia.io/cpp/wire.h> |
| |
| #include "src/lib/storage/vfs/cpp/connection.h" |
| #include "src/lib/storage/vfs/cpp/vfs_types.h" |
| #include "src/lib/storage/vfs/cpp/vnode.h" |
| |
| namespace fs { |
| |
| namespace internal { |
| |
| class NodeConnection final : public Connection, public fidl::WireServer<fuchsia_io::Node> { |
| public: |
| // Refer to documentation for |Connection::Connection|. |
| NodeConnection(fs::FuchsiaVfs* vfs, fbl::RefPtr<fs::Vnode> vnode, VnodeProtocol protocol, |
| VnodeConnectionOptions options); |
| |
| ~NodeConnection() final = default; |
| |
| private: |
| std::unique_ptr<Binding> Bind(async_dispatcher*, zx::channel, OnUnbound) override; |
| |
| // |
| // |fuchsia.io/Node| operations. |
| // |
| |
| void Clone(CloneRequestView request, CloneCompleter::Sync& completer) final; |
| void Close(CloseCompleter::Sync& completer) final; |
| void Query(QueryCompleter::Sync& completer) final; |
| void GetConnectionInfo(GetConnectionInfoCompleter::Sync& completer) final; |
| void Sync(SyncCompleter::Sync& completer) final; |
| void GetAttr(GetAttrCompleter::Sync& completer) final; |
| void SetAttr(SetAttrRequestView request, SetAttrCompleter::Sync& completer) final; |
| void GetFlags(GetFlagsCompleter::Sync& completer) final; |
| void SetFlags(SetFlagsRequestView request, SetFlagsCompleter::Sync& completer) final; |
| void QueryFilesystem(QueryFilesystemCompleter::Sync& completer) final; |
| void GetAttributes(fuchsia_io::wire::Node2GetAttributesRequest* request, |
| GetAttributesCompleter::Sync& completer) final { |
| completer.ReplyError(ZX_ERR_NOT_SUPPORTED); |
| } |
| void UpdateAttributes(fuchsia_io::wire::MutableNodeAttributes* request, |
| UpdateAttributesCompleter::Sync& completer) final { |
| completer.ReplyError(ZX_ERR_NOT_SUPPORTED); |
| } |
| void Reopen(fuchsia_io::wire::Node2ReopenRequest* request, |
| ReopenCompleter::Sync& completer) final { |
| request->object_request.Close(ZX_ERR_NOT_SUPPORTED); |
| } |
| }; |
| |
| } // namespace internal |
| |
| } // namespace fs |
| |
| #endif // SRC_LIB_STORAGE_VFS_CPP_NODE_CONNECTION_H_ |