OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "nacl_io/html5fs/html5_fs_node.h" | 5 #include "nacl_io/html5fs/html5_fs_node.h" |
6 | 6 |
7 #include <errno.h> | 7 #include <errno.h> |
8 #include <fcntl.h> | 8 #include <fcntl.h> |
9 #include <ppapi/c/pp_completion_callback.h> | 9 #include <ppapi/c/pp_completion_callback.h> |
10 #include <ppapi/c/pp_directory_entry.h> | 10 #include <ppapi/c/pp_directory_entry.h> |
11 #include <ppapi/c/pp_errors.h> | 11 #include <ppapi/c/pp_errors.h> |
12 #include <ppapi/c/pp_file_info.h> | 12 #include <ppapi/c/pp_file_info.h> |
13 #include <ppapi/c/ppb_file_io.h> | 13 #include <ppapi/c/ppb_file_io.h> |
14 #include <string.h> | 14 #include <string.h> |
15 #include <vector> | 15 #include <vector> |
16 | 16 |
17 #include "nacl_io/filesystem.h" | 17 #include "nacl_io/filesystem.h" |
18 #include "nacl_io/getdents_helper.h" | 18 #include "nacl_io/getdents_helper.h" |
| 19 #include "nacl_io/hash.h" |
19 #include "nacl_io/html5fs/html5_fs.h" | 20 #include "nacl_io/html5fs/html5_fs.h" |
20 #include "nacl_io/kernel_handle.h" | 21 #include "nacl_io/kernel_handle.h" |
21 #include "nacl_io/osdirent.h" | 22 #include "nacl_io/osdirent.h" |
22 #include "nacl_io/pepper_interface.h" | 23 #include "nacl_io/pepper_interface.h" |
23 #include "sdk_util/auto_lock.h" | 24 #include "sdk_util/auto_lock.h" |
24 | 25 |
25 namespace nacl_io { | 26 namespace nacl_io { |
26 | 27 |
27 namespace { | 28 namespace { |
28 | 29 |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 var_iface_->VarToUtf8(file_name_var, &file_name_length); | 123 var_iface_->VarToUtf8(file_name_var, &file_name_length); |
123 | 124 |
124 if (file_name) { | 125 if (file_name) { |
125 file_name_length = | 126 file_name_length = |
126 std::min(static_cast<size_t>(file_name_length), | 127 std::min(static_cast<size_t>(file_name_length), |
127 MEMBER_SIZE(dirent, d_name) - 1); // -1 for NULL. | 128 MEMBER_SIZE(dirent, d_name) - 1); // -1 for NULL. |
128 | 129 |
129 // The INO is based on the running hash of fully qualified path, so | 130 // The INO is based on the running hash of fully qualified path, so |
130 // a childs INO must be the parent directories hash, plus '/', plus | 131 // a childs INO must be the parent directories hash, plus '/', plus |
131 // the filename. | 132 // the filename. |
132 ino_t child_ino = Html5Fs::HashPathSegment(stat_.st_ino, file_name, | 133 ino_t child_ino = HashPathSegment(stat_.st_ino, file_name, |
133 file_name_length); | 134 file_name_length); |
134 | 135 |
135 helper.AddDirent(child_ino, file_name, file_name_length); | 136 helper.AddDirent(child_ino, file_name, file_name_length); |
136 } | 137 } |
137 | 138 |
138 var_iface_->Release(file_name_var); | 139 var_iface_->Release(file_name_var); |
139 } | 140 } |
140 | 141 |
141 // Release the output buffer. | 142 // Release the output buffer. |
142 free(output_buf.data); | 143 free(output_buf.data); |
143 | 144 |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 fileref_resource_ = 0; | 317 fileref_resource_ = 0; |
317 Node::Destroy(); | 318 Node::Destroy(); |
318 } | 319 } |
319 | 320 |
320 Error Html5FsNode::Fchmod(mode_t mode) { | 321 Error Html5FsNode::Fchmod(mode_t mode) { |
321 // html5fs does not support any kinds of permissions or mode bits. | 322 // html5fs does not support any kinds of permissions or mode bits. |
322 return 0; | 323 return 0; |
323 } | 324 } |
324 | 325 |
325 } // namespace nacl_io | 326 } // namespace nacl_io |
OLD | NEW |