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

Unified Diff: native_client_sdk/src/libraries/nacl_io/kernel_object.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/kernel_object.cc
diff --git a/native_client_sdk/src/libraries/nacl_io/kernel_object.cc b/native_client_sdk/src/libraries/nacl_io/kernel_object.cc
index 81e57297a7317059891e6632d29ebfacb838e8ca..69cd7ab213702669fd0d0a89f6eaf4418d62ad58 100644
--- a/native_client_sdk/src/libraries/nacl_io/kernel_object.cc
+++ b/native_client_sdk/src/libraries/nacl_io/kernel_object.cc
@@ -16,6 +16,7 @@
#include "nacl_io/filesystem.h"
#include "nacl_io/kernel_handle.h"
+#include "nacl_io/log.h"
#include "nacl_io/node.h"
#include "sdk_util/auto_lock.h"
@@ -35,8 +36,10 @@ Error KernelObject::AttachFsAtPath(const ScopedFilesystem& fs,
std::string abs_path = GetAbsParts(path).Join();
AUTO_LOCK(fs_lock_);
- if (filesystems_.find(abs_path) != filesystems_.end())
+ if (filesystems_.find(abs_path) != filesystems_.end()) {
+ LOG_ERROR("Can't mount at %s, it is already mounted.", path.c_str());
return EBUSY;
+ }
filesystems_[abs_path] = fs;
return 0;
@@ -48,12 +51,16 @@ Error KernelObject::DetachFsAtPath(const std::string& path,
AUTO_LOCK(fs_lock_);
FsMap_t::iterator it = filesystems_.find(abs_path);
- if (filesystems_.end() == it)
+ if (filesystems_.end() == it) {
+ LOG_TRACE("Can't unmount at %s, nothing is mounted.", path.c_str());
return EINVAL;
+ }
// It is only legal to unmount if there are no open references
- if (it->second->RefCount() != 1)
+ if (it->second->RefCount() != 1) {
+ LOG_TRACE("Can't unmount at %s, refcount is != 1.", path.c_str());
return EBUSY;
+ }
*out_fs = it->second;
« no previous file with comments | « native_client_sdk/src/libraries/nacl_io/kernel_handle.cc ('k') | native_client_sdk/src/libraries/nacl_io/kernel_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698