1 // Copyright 2016 The Chromium 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 "nacl_io/googledrivefs/googledrivefs_node.h"
6 
7 #include <sys/stat.h>
8 
9 #include "nacl_io/googledrivefs/googledrivefs.h"
10 #include "nacl_io/kernel_handle.h"
11 #include "nacl_io/node.h"
12 #include "nacl_io/osdirent.h"
13 
14 namespace nacl_io {
15 
16 // This is not further implemented.
17 // PNaCl is on a path to deprecation, and WebAssembly is
18 // the focused technology.
19 
GoogleDriveFsNode(GoogleDriveFs * googledrivefs)20 GoogleDriveFsNode::GoogleDriveFsNode(GoogleDriveFs* googledrivefs)
21     : Node(googledrivefs) {}
22 
GetDents(size_t offs,struct dirent * pdir,size_t size,int * out_bytes)23 Error GoogleDriveFsNode::GetDents(size_t offs,
24                                   struct dirent* pdir,
25                                   size_t size,
26                                   int* out_bytes) {
27   // TODO: support getdents
28   LOG_ERROR("getdents not supported.");
29   return EPERM;
30 }
31 
GetStat(struct stat * pstat)32 Error GoogleDriveFsNode::GetStat(struct stat* pstat) {
33   // TODO: support getstat
34   LOG_ERROR("getstat not supported.");
35   return EPERM;
36 }
37 
Write(const HandleAttr & attr,const void * buf,size_t count,int * out_bytes)38 Error GoogleDriveFsNode::Write(const HandleAttr& attr,
39                                const void* buf,
40                                size_t count,
41                                int* out_bytes) {
42   // TODO: support write
43   LOG_ERROR("write not supported.");
44   return EPERM;
45 }
46 
FTruncate(off_t length)47 Error GoogleDriveFsNode::FTruncate(off_t length) {
48   // TODO: support ftruncate
49   LOG_ERROR("ftruncate not supported.");
50   return EPERM;
51 }
52 
Read(const HandleAttr & attr,void * buf,size_t count,int * out_bytes)53 Error GoogleDriveFsNode::Read(const HandleAttr& attr,
54                               void* buf,
55                               size_t count,
56                               int* out_bytes) {
57   // TODO: support read
58   LOG_ERROR("read not supported.");
59   return EPERM;
60 }
61 
GetSize(off_t * out_size)62 Error GoogleDriveFsNode::GetSize(off_t* out_size) {
63   // TODO: support getsize
64   LOG_ERROR("getsize not supported.");
65   return EPERM;
66 }
67 
Init(int open_flags)68 Error GoogleDriveFsNode::Init(int open_flags) {
69   // TODO: support init
70   LOG_ERROR("init not supported.");
71   return EPERM;
72 }
73 
74 }  // namespace nacl_io
75