Chromium Code Reviews| 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 62 | 62 |
| 63 Error DirNode::GetDents(size_t offs, | 63 Error DirNode::GetDents(size_t offs, |
| 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) { | |
| 73 AUTO_LOCK(node_lock_); | |
| 74 SetMode(mode); | |
| 75 return 0; | |
|
Sam Clegg
2014/09/24 20:48:28
Could we not just put this in the Nade base class?
binji
2014/09/24 21:30:50
I thought about that. It made more sense to me to
| |
| 76 } | |
| 77 | |
| 72 Error DirNode::AddChild(const std::string& name, const ScopedNode& node) { | 78 Error DirNode::AddChild(const std::string& name, const ScopedNode& node) { |
| 73 AUTO_LOCK(node_lock_); | 79 AUTO_LOCK(node_lock_); |
| 74 | 80 |
| 75 if (name.empty()) { | 81 if (name.empty()) { |
| 76 LOG_ERROR("Can't add child with no name."); | 82 LOG_ERROR("Can't add child with no name."); |
| 77 return ENOENT; | 83 return ENOENT; |
| 78 } | 84 } |
| 79 | 85 |
| 80 if (name.length() >= MEMBER_SIZE(dirent, d_name)) { | 86 if (name.length() >= MEMBER_SIZE(dirent, d_name)) { |
| 81 LOG_ERROR("Child name is too long: %" PRIuS " >= %" PRIuS, | 87 LOG_ERROR("Child name is too long: %" PRIuS " >= %" PRIuS, |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 138 | 144 |
| 139 cache_built_ = true; | 145 cache_built_ = true; |
| 140 } | 146 } |
| 141 | 147 |
| 142 void DirNode::ClearCache_Locked() { | 148 void DirNode::ClearCache_Locked() { |
| 143 cache_built_ = false; | 149 cache_built_ = false; |
| 144 cache_.Reset(); | 150 cache_.Reset(); |
| 145 } | 151 } |
| 146 | 152 |
| 147 } // namespace nacl_io | 153 } // namespace nacl_io |
| OLD | NEW |