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

Unified Diff: native_client_sdk/src/libraries/nacl_mounts/mount_mem.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_mem.cc
diff --git a/native_client_sdk/src/libraries/nacl_mounts/mount_mem.cc b/native_client_sdk/src/libraries/nacl_mounts/mount_mem.cc
index 3a81dd35bb0d3fd592ec31f80ad10ea879ce2877..8a61dc005b6bec7eb96d990c256eb366d927390d 100644
--- a/native_client_sdk/src/libraries/nacl_mounts/mount_mem.cc
+++ b/native_client_sdk/src/libraries/nacl_mounts/mount_mem.cc
@@ -39,53 +39,23 @@ void MountMem::Destroy() {
}
MountNode* MountMem::AllocatePath(int mode) {
- ino_t ino = AllocateINO();
-
- MountNode *ptr = new MountNodeDir(this, ino, dev_);
- if (!ptr->Init(mode, USR_ID, GRP_ID)) {
+ MountNode *ptr = new MountNodeDir(this);
+ if (!ptr->Init(mode)) {
ptr->Release();
- FreeINO(ino);
return NULL;
}
return ptr;
}
MountNode* MountMem::AllocateData(int mode) {
- ino_t ino = AllocateINO();
-
- MountNode* ptr = new MountNodeMem(this, ino, dev_);
- //if (!ptr->Init(mode, getuid(), getgid())) {
- if (!ptr->Init(mode, USR_ID, GRP_ID)) {
+ MountNode* ptr = new MountNodeMem(this);
+ if (!ptr->Init(mode)) {
ptr->Release();
- FreeINO(ino);
return NULL;
}
return ptr;
}
-int MountMem::AllocateINO() {
- const int INO_CNT = 8;
-
- // If we run out of INO numbers, then allocate 8 more
- if (inos_.size() == 0) {
- max_ino_ += INO_CNT;
- // Add eight more to the stack in reverse order, offset by 1
- // since '0' refers to no INO.
- for (int a = 0; a < INO_CNT; a++) {
- inos_.push_back(max_ino_ - a);
- }
- }
-
- // Return the INO at the top of the stack.
- int val = inos_.back();
- inos_.pop_back();
- return val;
-}
-
-void MountMem::FreeINO(int ino) {
- inos_.push_back(ino);
-}
-
MountNode* MountMem::FindNode(const Path& path, int type) {
MountNode* node = root_;
« no previous file with comments | « native_client_sdk/src/libraries/nacl_mounts/mount_mem.h ('k') | native_client_sdk/src/libraries/nacl_mounts/mount_node.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698