1 // Copyright 2013 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_DIR_NODE_H_
6 #define LIBRARIES_NACL_IO_DIR_NODE_H_
12 #include "nacl_io/getdents_helper.h"
13 #include "nacl_io/node.h"
23 typedef sdk_util::ScopedRef
<DirNode
> ScopedDirNode
;
25 class DirNode
: public Node
{
27 DirNode(Filesystem
* fs
, mode_t mode
);
31 typedef std::map
<std::string
, ScopedNode
> NodeMap_t
;
33 virtual Error
FTruncate(off_t size
);
34 virtual Error
GetDents(size_t offs
,
38 virtual Error
Read(const HandleAttr
& attr
,
42 virtual Error
Write(const HandleAttr
& attr
,
46 virtual Error
Fchmod(mode_t mode
);
48 // Adds a finds or adds a directory entry as an INO, updating the refcount
49 virtual Error
AddChild(const std::string
& name
, const ScopedNode
& node
);
50 virtual Error
RemoveChild(const std::string
& name
);
51 virtual Error
FindChild(const std::string
& name
, ScopedNode
* out_node
);
52 virtual int ChildCount();
55 void BuildCache_Locked();
56 void ClearCache_Locked();
59 GetDentsHelper cache_
;
69 } // namespace nacl_io
71 #endif // LIBRARIES_NACL_IO_DIR_NODE_H_