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

Unified Diff: native_client_sdk/src/libraries/nacl_mounts/mount.cc

Issue 12166002: Cleanup (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge Created 7 years, 11 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_mounts/mount.cc
diff --git a/native_client_sdk/src/libraries/nacl_mounts/mount.cc b/native_client_sdk/src/libraries/nacl_mounts/mount.cc
index 8c73594422711c9e5e9eb784cbddecf180fef8e4..07be9b3961e91e7352cb3596712f7362789cff32 100644
--- a/native_client_sdk/src/libraries/nacl_mounts/mount.cc
+++ b/native_client_sdk/src/libraries/nacl_mounts/mount.cc
@@ -21,8 +21,7 @@
#endif
Mount::Mount()
- : dev_(0),
- num_nodes_(0) {
+ : dev_(0) {
}
Mount::~Mount() {}
@@ -55,22 +54,12 @@ int Mount::OpenModeToPermission(int mode) {
return out;
}
-void Mount::OnNodeCreated() {
-#if defined(__native_client__)
- __sync_add_and_fetch(&num_nodes_, 1);
-#elif defined(WIN32)
- InterlockedIncrement(&num_nodes_);
-#else
-#error Implement atomic functions for this platform.
-#endif
-}
-void Mount::OnNodeDestroyed() {
-#if defined(__native_client__)
- __sync_sub_and_fetch(&num_nodes_, 1);
-#elif defined(WIN32)
- InterlockedDecrement(&num_nodes_);
-#else
-#error Implement atomic functions for this platform.
-#endif
+void Mount::OnNodeCreated(MountNode* node) {
+ node->stat_.st_ino = inode_pool_.Acquire();
+ node->stat_.st_dev = dev_;
}
+
+void Mount::OnNodeDestroyed(MountNode* node) {
+ if (node->stat_.st_ino) inode_pool_.Release(node->stat_.st_ino);
+}
« no previous file with comments | « native_client_sdk/src/libraries/nacl_mounts/mount.h ('k') | native_client_sdk/src/libraries/nacl_mounts/mount_dev.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698