OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef LIBRARIES_NACL_IO_MEMFS_MEM_FS_NODE_H_ | 5 #ifndef LIBRARIES_NACL_IO_MEMFS_MEM_FS_NODE_H_ |
6 #define LIBRARIES_NACL_IO_MEMFS_MEM_FS_NODE_H_ | 6 #define LIBRARIES_NACL_IO_MEMFS_MEM_FS_NODE_H_ |
7 | 7 |
8 #include "nacl_io/node.h" | 8 #include "nacl_io/node.h" |
9 | 9 |
10 namespace nacl_io { | 10 namespace nacl_io { |
11 | 11 |
12 class MemFsNode : public Node { | 12 class MemFsNode : public Node { |
13 public: | 13 public: |
14 explicit MemFsNode(Filesystem* filesystem); | 14 explicit MemFsNode(Filesystem* filesystem); |
15 | 15 |
16 protected: | 16 protected: |
17 virtual ~MemFsNode(); | 17 virtual ~MemFsNode(); |
18 | 18 |
19 public: | 19 public: |
20 // Normal read/write operations on a file | 20 // Normal read/write operations on a file |
21 virtual Error Read(const HandleAttr& attr, | 21 virtual Error Read(const HandleAttr& attr, |
22 void* buf, | 22 void* buf, |
23 size_t count, | 23 size_t count, |
24 int* out_bytes); | 24 int* out_bytes); |
25 virtual Error Write(const HandleAttr& attr, | 25 virtual Error Write(const HandleAttr& attr, |
26 const void* buf, | 26 const void* buf, |
27 size_t count, | 27 size_t count, |
28 int* out_bytes); | 28 int* out_bytes); |
29 virtual Error FTruncate(off_t size); | 29 virtual Error FTruncate(off_t size); |
| 30 virtual Error Fchmod(mode_t mode); |
30 | 31 |
31 private: | 32 private: |
32 Error Resize(off_t size); | 33 Error Resize(off_t size); |
33 | 34 |
34 char* data_; | 35 char* data_; |
35 size_t data_capacity_; | 36 size_t data_capacity_; |
36 friend class MemFs; | 37 friend class MemFs; |
37 }; | 38 }; |
38 | 39 |
39 } // namespace nacl_io | 40 } // namespace nacl_io |
40 | 41 |
41 #endif // LIBRARIES_NACL_IO_MEMFS_MEM_FS_NODE_H_ | 42 #endif // LIBRARIES_NACL_IO_MEMFS_MEM_FS_NODE_H_ |
OLD | NEW |