| 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 #ifndef LIBRARIES_NACL_IO_MOUNT_NODE_DIR_H_ | 5 #ifndef LIBRARIES_NACL_IO_MOUNT_NODE_DIR_H_ |
| 6 #define LIBRARIES_NACL_IO_MOUNT_NODE_DIR_H_ | 6 #define LIBRARIES_NACL_IO_MOUNT_NODE_DIR_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "nacl_io/mount_node.h" | 11 #include "nacl_io/mount_node.h" |
| 12 | 12 |
| 13 struct dirent; | 13 struct dirent; |
| 14 | 14 |
| 15 class MountDev; | 15 class MountDev; |
| 16 class MountHtml5Fs; | 16 class MountHtml5Fs; |
| 17 class MountHttp; | 17 class MountHttp; |
| 18 class MountMem; | 18 class MountMem; |
| 19 | 19 |
| 20 class MountNodeDir : public MountNode { | 20 class MountNodeDir : public MountNode { |
| 21 protected: | 21 protected: |
| 22 explicit MountNodeDir(Mount* mnt); | 22 explicit MountNodeDir(Mount* mnt); |
| 23 virtual ~MountNodeDir(); | 23 virtual ~MountNodeDir(); |
| 24 | 24 |
| 25 public: | 25 public: |
| 26 typedef std::map<std::string, MountNode*> MountNodeMap_t; | 26 typedef std::map<std::string, MountNode*> MountNodeMap_t; |
| 27 | 27 |
| 28 virtual int FTruncate(off_t size); | 28 virtual Error FTruncate(off_t size); |
| 29 virtual int GetDents(size_t offs, struct dirent* pdir, size_t count); | 29 virtual Error GetDents(size_t offs, |
| 30 virtual int Read(size_t offs, void *buf, size_t count); | 30 struct dirent* pdir, |
| 31 virtual int Write(size_t offs, void *buf, size_t count); | 31 size_t count, |
| 32 int* out_bytes); |
| 33 virtual Error Read(size_t offs, void *buf, size_t count, int* out_bytes); |
| 34 virtual Error Write(size_t offs, void *buf, size_t count, int* out_bytes); |
| 32 | 35 |
| 33 // Adds a finds or adds a directory entry as an INO, updating the refcount | 36 // Adds a finds or adds a directory entry as an INO, updating the refcount |
| 34 virtual int AddChild(const std::string& name, MountNode *node); | 37 virtual Error AddChild(const std::string& name, MountNode *node); |
| 35 virtual int RemoveChild(const std::string& name); | 38 virtual Error RemoveChild(const std::string& name); |
| 36 virtual MountNode* FindChild(const std::string& name); | 39 virtual Error FindChild(const std::string& name, MountNode** out_node); |
| 37 virtual int ChildCount(); | 40 virtual int ChildCount(); |
| 38 | 41 |
| 39 | 42 |
| 40 protected: | 43 protected: |
| 41 void ClearCache(); | 44 void ClearCache(); |
| 42 void BuildCache(); | 45 void BuildCache(); |
| 43 | 46 |
| 44 private: | 47 private: |
| 45 struct dirent* cache_; | 48 struct dirent* cache_; |
| 46 MountNodeMap_t map_; | 49 MountNodeMap_t map_; |
| 47 | 50 |
| 48 friend class MountDev; | 51 friend class MountDev; |
| 49 friend class MountMem; | 52 friend class MountMem; |
| 50 friend class MountHttp; | 53 friend class MountHttp; |
| 51 friend class MountHtml5Fs; | 54 friend class MountHtml5Fs; |
| 52 }; | 55 }; |
| 53 | 56 |
| 54 #endif // LIBRARIES_NACL_IO_MOUNT_NODE_DIR_H_ | 57 #endif // LIBRARIES_NACL_IO_MOUNT_NODE_DIR_H_ |
| OLD | NEW |