Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / native_client_sdk / src / libraries / nacl_io / passthroughfs / real_node.h
blob2bc3ac184c4cefb58987ab32ed9d682c0182fc02
1 // Copyright 2014 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 #ifndef LIBRARIES_NACL_IO_PASSTHROUGHFS_REAL_NODE_H_
6 #define LIBRARIES_NACL_IO_PASSTHROUGHFS_REAL_NODE_H_
8 #include "nacl_io/node.h"
10 namespace nacl_io {
12 class RealNode : public Node {
13 public:
14 RealNode(Filesystem* filesystem, int real_fd, bool close_on_destroy = false);
16 protected:
17 virtual Error Init(int flags) { return 0; }
19 virtual void Destroy();
21 public:
22 // Normal read/write operations on a file
23 virtual Error Read(const HandleAttr& attr,
24 void* buf,
25 size_t count,
26 int* out_bytes);
27 virtual Error Write(const HandleAttr& attr,
28 const void* buf,
29 size_t count,
30 int* out_bytes);
31 virtual Error FTruncate(off_t size);
32 virtual Error GetDents(size_t offs,
33 struct dirent* pdir,
34 size_t count,
35 int* out_bytes);
36 virtual Error GetStat(struct stat* stat);
37 virtual Error Isatty();
38 virtual Error MMap(void* addr,
39 size_t length,
40 int prot,
41 int flags,
42 size_t offset,
43 void** out_addr);
45 private:
46 int real_fd_;
47 bool close_on_destroy_;
50 } // namespace nacl_io
52 #endif // LIBRARIES_NACL_IO_PASSTHROUGHFS_REAL_NODE_H_