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

Unified Diff: native_client_sdk/src/libraries/nacl_io/html5fs/html5_fs_node.cc

Issue 605513002: [NaCl SDK] nacl_io: Replace allocated ino with hash of path. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix test Created 6 years, 3 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/html5fs/html5_fs_node.cc
diff --git a/native_client_sdk/src/libraries/nacl_io/html5fs/html5_fs_node.cc b/native_client_sdk/src/libraries/nacl_io/html5fs/html5_fs_node.cc
index 2f7607d0ff8c06fe9b8d500800c9af5662868b19..8fe4df874f34bbd7ac66fd7935e04403580aeb06 100644
--- a/native_client_sdk/src/libraries/nacl_io/html5fs/html5_fs_node.cc
+++ b/native_client_sdk/src/libraries/nacl_io/html5fs/html5_fs_node.cc
@@ -16,6 +16,7 @@
#include "nacl_io/filesystem.h"
#include "nacl_io/getdents_helper.h"
+#include "nacl_io/html5fs/html5_fs.h"
#include "nacl_io/kernel_handle.h"
#include "nacl_io/osdirent.h"
#include "nacl_io/pepper_interface.h"
@@ -125,8 +126,13 @@ Error Html5FsNode::GetDents(size_t offs,
std::min(static_cast<size_t>(file_name_length),
MEMBER_SIZE(dirent, d_name) - 1); // -1 for NULL.
- // TODO(binji): Better handling of ino numbers.
- helper.AddDirent(1, file_name, file_name_length);
+ // The INO is based on the running hash of fully qualified path, so
+ // a childs INO must be the parent directories hash, plus '/', plus
+ // the filename.
+ ino_t child_ino = Html5Fs::HashPathSegment(stat_.st_ino, file_name,
+ file_name_length);
binji 2014/09/25 21:52:04 nit: file_name_length should align with stat_ abov
noelallen1 2014/09/25 22:39:55 Done.
+
+ helper.AddDirent(child_ino, file_name, file_name_length);
}
var_iface_->Release(file_name_var);

Powered by Google App Engine
This is Rietveld 408576698