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