OLD | NEW |
1 /* Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 /* Copyright (c) 2012 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 | |
6 #ifndef LIBRARIES_NACL_MOUNTS_MOUNT_NODE_MEM_H_ | 5 #ifndef LIBRARIES_NACL_MOUNTS_MOUNT_NODE_MEM_H_ |
7 #define LIBRARIES_NACL_MOUNTS_MOUNT_NODE_MEM_H_ | 6 #define LIBRARIES_NACL_MOUNTS_MOUNT_NODE_MEM_H_ |
8 | 7 |
9 #include "nacl_mounts/mount_node.h" | 8 #include "nacl_mounts/mount_node.h" |
10 | 9 |
11 class MountNodeMem : public MountNode { | 10 class MountNodeMem : public MountNode { |
12 public: | 11 public: |
13 MountNodeMem(Mount* mount, int ino, int dev); | 12 MountNodeMem(Mount* mount, int ino, int dev); |
14 | 13 |
15 protected: | 14 protected: |
16 virtual ~MountNodeMem(); | 15 virtual ~MountNodeMem(); |
17 virtual bool Init(int mode, short uid, short gid); | 16 virtual bool Init(int mode, short uid, short gid); |
18 | 17 |
19 public: | 18 public: |
20 // Normal read/write operations on a file | 19 // Normal read/write operations on a file |
21 virtual int Read(size_t offs, void* buf, size_t count); | 20 virtual int Read(size_t offs, void* buf, size_t count); |
22 virtual int Write(size_t offs, const void* buf, size_t count); | 21 virtual int Write(size_t offs, const void* buf, size_t count); |
23 virtual int Truncate(size_t size); | 22 virtual int Truncate(size_t size); |
24 | 23 |
25 private: | 24 private: |
26 char* data_; | 25 char* data_; |
27 size_t capacity_; | 26 size_t capacity_; |
28 friend class MountMem; | 27 friend class MountMem; |
29 }; | 28 }; |
30 | 29 |
31 #endif // LIBRARIES_NACL_MOUNTS_MOUNT_NODE_MEM_H_ | 30 #endif // LIBRARIES_NACL_MOUNTS_MOUNT_NODE_MEM_H_ |
32 | |
OLD | NEW |