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.
5 #ifndef LIBRARIES_NACL_IO_MOUNT_NODE_DIR_H_
6 #define LIBRARIES_NACL_IO_MOUNT_NODE_DIR_H_
12 #include "nacl_io/getdents_helper.h"
13 #include "nacl_io/mount_node.h"
23 typedef sdk_util::ScopedRef<MountNodeDir> ScopedMountNodeDir;
25 class MountNodeDir : public MountNode {
27 explicit MountNodeDir(Mount* mnt);
28 virtual ~MountNodeDir();
31 typedef std::map<std::string, ScopedMountNode> MountNodeMap_t;
33 virtual Error FTruncate(off_t size);
34 virtual Error GetDents(size_t offs,
38 virtual Error Read(const HandleAttr& attr, void *buf,
39 size_t count, int* out_bytes);
40 virtual Error Write(const HandleAttr& attr, const void *buf,
41 size_t count, int* out_bytes);
43 // Adds a finds or adds a directory entry as an INO, updating the refcount
44 virtual Error AddChild(const std::string& name, const ScopedMountNode& node);
45 virtual Error RemoveChild(const std::string& name);
46 virtual Error FindChild(const std::string& name, ScopedMountNode* out_node);
47 virtual int ChildCount();
51 void BuildCache_Locked();
52 void ClearCache_Locked();
55 GetDentsHelper cache_;
59 friend class MountDev;
60 friend class MountMem;
61 friend class MountHttp;
62 friend class MountHtml5Fs;
65 } // namespace nacl_io
67 #endif // LIBRARIES_NACL_IO_MOUNT_NODE_DIR_H_