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

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

Issue 1293543006: Make the default directory size returned by stat to be 4096 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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
« no previous file with comments | « no previous file | native_client_sdk/src/tests/nacl_io_test/html5_fs_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 bb3a8f5ac3524d3370ddc2f6f73b2b4aff2b9f08..e9c8044d02621321a3f5b8d77bd62a34999bfe28 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
@@ -26,6 +26,8 @@ namespace nacl_io {
namespace {
+const int DIR_SIZE = 4096;
Sam Clegg 2015/08/13 21:33:48 How about EMPTY_DIR_SIZE?
binji 2015/08/13 21:44:52 Actually, Chromium style would be more like kEmpty
zhitingzhu 2015/08/13 22:26:00 Done.
+
struct OutputBuffer {
void* data;
int element_count;
@@ -169,6 +171,10 @@ Error Html5FsNode::GetStat(struct stat* stat) {
break;
}
stat->st_size = static_cast<off_t>(info.size);
+ // Hack the directory size
+ // In Linux, even a empty directory has size 4096
+ if (info.type == PP_FILETYPE_DIRECTORY && info.size == 0)
+ stat->st_size = DIR_SIZE;
Sam Clegg 2015/08/13 21:33:48 Move this up into the existing switch statement?
zhitingzhu 2015/08/13 22:26:00 I try to look at the source code to see how the di
stat->st_atime = info.last_access_time;
stat->st_mtime = info.last_modified_time;
stat->st_ctime = info.creation_time;
« no previous file with comments | « no previous file | native_client_sdk/src/tests/nacl_io_test/html5_fs_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698