1 // Copyright 2017 The Fuchsia Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #include <fs/remote-dir.h>
6 
7 #include <utility>
8 
9 namespace fs {
10 
RemoteDir(zx::channel remote_dir_client)11 RemoteDir::RemoteDir(zx::channel remote_dir_client)
12     : remote_dir_client_(std::move(remote_dir_client)) {
13     ZX_DEBUG_ASSERT(remote_dir_client_);
14 }
15 
16 RemoteDir::~RemoteDir() = default;
17 
Getattr(vnattr_t * attr)18 zx_status_t RemoteDir::Getattr(vnattr_t* attr) {
19     memset(attr, 0, sizeof(vnattr_t));
20     attr->mode = V_TYPE_DIR | V_IRUSR;
21     attr->nlink = 1;
22     return ZX_OK;
23 }
24 
IsRemote() const25 bool RemoteDir::IsRemote() const {
26     return true;
27 }
28 
GetRemote() const29 zx_handle_t RemoteDir::GetRemote() const {
30     return remote_dir_client_.get();
31 }
32 
33 } // namespace fs
34