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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 | 85 |
86 if (name.length() >= MEMBER_SIZE(dirent, d_name)) { | 86 if (name.length() >= MEMBER_SIZE(dirent, d_name)) { |
87 LOG_ERROR("Child name is too long: %" PRIuS " >= %" PRIuS, | 87 LOG_ERROR("Child name is too long: %" PRIuS " >= %" PRIuS, |
88 name.length(), | 88 name.length(), |
89 MEMBER_SIZE(dirent, d_name)); | 89 MEMBER_SIZE(dirent, d_name)); |
90 return ENAMETOOLONG; | 90 return ENAMETOOLONG; |
91 } | 91 } |
92 | 92 |
93 NodeMap_t::iterator it = map_.find(name); | 93 NodeMap_t::iterator it = map_.find(name); |
94 if (it != map_.end()) { | 94 if (it != map_.end()) { |
95 LOG_TRACE("Can't add child \"%s\", it already exists.", name); | 95 LOG_TRACE("Can't add child \"%s\", it already exists.", name.c_str()); |
96 return EEXIST; | 96 return EEXIST; |
97 } | 97 } |
98 | 98 |
99 node->Link(); | 99 node->Link(); |
100 map_[name] = node; | 100 map_[name] = node; |
101 ClearCache_Locked(); | 101 ClearCache_Locked(); |
102 return 0; | 102 return 0; |
103 } | 103 } |
104 | 104 |
105 Error DirNode::RemoveChild(const std::string& name) { | 105 Error DirNode::RemoveChild(const std::string& name) { |
(...skipping 38 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 |