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