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 3 // found in the LICENSE file. 4 5 #ifndef LIBRARIES_NACL_IO_MOUNT_NODE_MEM_H_ 6 #define LIBRARIES_NACL_IO_MOUNT_NODE_MEM_H_ 7 8 #include "nacl_io/mount_node.h" 9 10 namespace nacl_io { 11 12 class MountNodeMem : public MountNode { 13 public: 14 explicit MountNodeMem(Mount* mount); 15 16 protected: 17 virtual ~MountNodeMem(); 18 19 public: 20 // Normal read/write operations on a file 21 virtual Error Read(size_t offs, void* buf, size_t count, int* out_bytes); 22 virtual Error Write(size_t offs, 23 const void* buf, 24 size_t count, 25 int* out_bytes); 26 virtual Error FTruncate(off_t size); 27 28 private: 29 char* data_; 30 size_t capacity_; 31 friend class MountMem; 32 }; 33 34 } // namespace nacl_io 35 36 #endif // LIBRARIES_NACL_IO_MOUNT_NODE_MEM_H_ 37