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.h" | 5 #include "nacl_io/html5fs/html5_fs.h" |
6 | 6 |
7 #include <errno.h> | 7 #include <errno.h> |
8 #include <fcntl.h> | 8 #include <fcntl.h> |
9 #include <stdlib.h> | 9 #include <stdlib.h> |
10 #include <string.h> | 10 #include <string.h> |
(...skipping 11 matching lines...) Expand all Loading... |
22 namespace { | 22 namespace { |
23 | 23 |
24 #if defined(WIN32) | 24 #if defined(WIN32) |
25 int64_t strtoull(const char* nptr, char** endptr, int base) { | 25 int64_t strtoull(const char* nptr, char** endptr, int base) { |
26 return _strtoui64(nptr, endptr, base); | 26 return _strtoui64(nptr, endptr, base); |
27 } | 27 } |
28 #endif | 28 #endif |
29 | 29 |
30 } // namespace | 30 } // namespace |
31 | 31 |
32 Error Html5Fs::Access(const Path& path, int a_mode) { | |
33 // a_mode is unused, since all files are readable, writable and executable. | |
34 ScopedNode node; | |
35 return Open(path, O_RDONLY, &node); | |
36 } | |
37 | |
38 Error Html5Fs::Open(const Path& path, int open_flags, ScopedNode* out_node) { | 32 Error Html5Fs::Open(const Path& path, int open_flags, ScopedNode* out_node) { |
39 out_node->reset(NULL); | 33 out_node->reset(NULL); |
40 Error error = BlockUntilFilesystemOpen(); | 34 Error error = BlockUntilFilesystemOpen(); |
41 if (error) | 35 if (error) |
42 return error; | 36 return error; |
43 | 37 |
44 PP_Resource fileref = file_ref_iface_->Create( | 38 PP_Resource fileref = file_ref_iface_->Create( |
45 filesystem_resource_, GetFullPath(path).Join().c_str()); | 39 filesystem_resource_, GetFullPath(path).Join().c_str()); |
46 if (!fileref) | 40 if (!fileref) |
47 return ENOENT; | 41 return ENOENT; |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 } | 291 } |
298 | 292 |
299 void Html5Fs::FilesystemOpenCallback(int32_t result) { | 293 void Html5Fs::FilesystemOpenCallback(int32_t result) { |
300 AUTO_LOCK(filesysem_open_lock_); | 294 AUTO_LOCK(filesysem_open_lock_); |
301 filesystem_open_has_result_ = true; | 295 filesystem_open_has_result_ = true; |
302 filesystem_open_error_ = PPErrorToErrno(result); | 296 filesystem_open_error_ = PPErrorToErrno(result); |
303 pthread_cond_signal(&filesystem_open_cond_); | 297 pthread_cond_signal(&filesystem_open_cond_); |
304 } | 298 } |
305 | 299 |
306 } // namespace nacl_io | 300 } // namespace nacl_io |
OLD | NEW |