OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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 #include "nacl_io/dir_node.h" | 5 #include "nacl_io/dir_node.h" |
6 | 6 |
7 #include <errno.h> | 7 #include <errno.h> |
8 #include <string.h> | 8 #include <string.h> |
9 | 9 |
10 #include "nacl_io/log.h" | 10 #include "nacl_io/log.h" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 dirent* pdir, | 63 dirent* pdir, |
64 size_t size, | 64 size_t size, |
65 int* out_bytes) { | 65 int* out_bytes) { |
66 AUTO_LOCK(node_lock_); | 66 AUTO_LOCK(node_lock_); |
67 BuildCache_Locked(); | 67 BuildCache_Locked(); |
68 return cache_.GetDents(offs, pdir, size, out_bytes); | 68 return cache_.GetDents(offs, pdir, size, out_bytes); |
69 } | 69 } |
70 | 70 |
71 Error DirNode::Fchmod(mode_t mode) { | 71 Error DirNode::Fchmod(mode_t mode) { |
72 AUTO_LOCK(node_lock_); | 72 AUTO_LOCK(node_lock_); |
73 SetMode(mode & ~S_IFMT); | 73 SetMode(mode); |
74 return 0; | 74 return 0; |
75 } | 75 } |
76 | 76 |
77 Error DirNode::AddChild(const std::string& name, const ScopedNode& node) { | 77 Error DirNode::AddChild(const std::string& name, const ScopedNode& node) { |
78 AUTO_LOCK(node_lock_); | 78 AUTO_LOCK(node_lock_); |
79 | 79 |
80 if (name.empty()) { | 80 if (name.empty()) { |
81 LOG_ERROR("Can't add child with no name."); | 81 LOG_ERROR("Can't add child with no name."); |
82 return ENOENT; | 82 return ENOENT; |
83 } | 83 } |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 | 143 |
144 cache_built_ = true; | 144 cache_built_ = true; |
145 } | 145 } |
146 | 146 |
147 void DirNode::ClearCache_Locked() { | 147 void DirNode::ClearCache_Locked() { |
148 cache_built_ = false; | 148 cache_built_ = false; |
149 cache_.Reset(); | 149 cache_.Reset(); |
150 } | 150 } |
151 | 151 |
152 } // namespace nacl_io | 152 } // namespace nacl_io |
OLD | NEW |