Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(37)

Unified Diff: native_client_sdk/src/libraries/nacl_io/dir_node.cc

Issue 349703003: [NaCl SDK] Add some more logging to nacl_io. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix linux host build Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: native_client_sdk/src/libraries/nacl_io/dir_node.cc
diff --git a/native_client_sdk/src/libraries/nacl_io/dir_node.cc b/native_client_sdk/src/libraries/nacl_io/dir_node.cc
index 0486198cc70b3ee25b0a85bd523c7925ac3cac8e..e16c0c7d173630bfa654d763632b7147079b6892 100644
--- a/native_client_sdk/src/libraries/nacl_io/dir_node.cc
+++ b/native_client_sdk/src/libraries/nacl_io/dir_node.cc
@@ -7,7 +7,9 @@
#include <errno.h>
#include <string.h>
+#include "nacl_io/log.h"
#include "nacl_io/osdirent.h"
+#include "nacl_io/osinttypes.h"
#include "nacl_io/osstat.h"
#include "sdk_util/auto_lock.h"
#include "sdk_util/macros.h"
@@ -40,10 +42,12 @@ Error DirNode::Read(const HandleAttr& attr,
size_t count,
int* out_bytes) {
*out_bytes = 0;
+ LOG_TRACE("Can't read a directory.");
return EISDIR;
}
Error DirNode::FTruncate(off_t size) {
+ LOG_TRACE("Can't truncate a directory.");
return EISDIR;
}
@@ -52,6 +56,7 @@ Error DirNode::Write(const HandleAttr& attr,
size_t count,
int* out_bytes) {
*out_bytes = 0;
+ LOG_TRACE("Can't write to a directory.");
return EISDIR;
}
@@ -67,15 +72,23 @@ Error DirNode::GetDents(size_t offs,
Error DirNode::AddChild(const std::string& name, const ScopedNode& node) {
AUTO_LOCK(node_lock_);
- if (name.empty())
+ if (name.empty()) {
+ LOG_ERROR("Can't add child with no name.");
return ENOENT;
+ }
- if (name.length() >= MEMBER_SIZE(dirent, d_name))
+ if (name.length() >= MEMBER_SIZE(dirent, d_name)) {
+ LOG_ERROR("Child name is too long: %" PRIuS " >= %" PRIuS,
+ name.length(),
+ MEMBER_SIZE(dirent, d_name));
return ENAMETOOLONG;
+ }
NodeMap_t::iterator it = map_.find(name);
- if (it != map_.end())
+ if (it != map_.end()) {
+ LOG_TRACE("Can't add child \"%s\", it already exists.", name);
return EEXIST;
+ }
node->Link();
map_[name] = node;
« no previous file with comments | « native_client_sdk/src/libraries/nacl_io/devfs/tty_node.cc ('k') | native_client_sdk/src/libraries/nacl_io/filesystem.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698