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

Side by Side Diff: native_client_sdk/src/libraries/nacl_io/mount_html5fs.cc

Issue 15800004: [NaCl SDK] nacl_io: Added support for access() syscall. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fixes, implement httpfs, and write tests. Created 7 years, 6 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 unified diff | Download patch
OLDNEW
1 /* Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 /* Copyright (c) 2012 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 5
6 #include "nacl_io/mount_html5fs.h" 6 #include "nacl_io/mount_html5fs.h"
7 7
8 #include <errno.h> 8 #include <errno.h>
9 #include <fcntl.h>
9 #include <ppapi/c/pp_completion_callback.h> 10 #include <ppapi/c/pp_completion_callback.h>
10 #include <ppapi/c/pp_errors.h> 11 #include <ppapi/c/pp_errors.h>
11 #include <stdlib.h> 12 #include <stdlib.h>
12 #include <string.h> 13 #include <string.h>
13 #include <algorithm> 14 #include <algorithm>
14 #include "nacl_io/mount_node_html5fs.h" 15 #include "nacl_io/mount_node_html5fs.h"
15 #include "sdk_util/auto_lock.h" 16 #include "sdk_util/auto_lock.h"
16 17
17 namespace { 18 namespace {
18 19
19 #if defined(WIN32) 20 #if defined(WIN32)
20 int64_t strtoull(const char* nptr, char** endptr, int base) { 21 int64_t strtoull(const char* nptr, char** endptr, int base) {
21 return _strtoui64(nptr, endptr, base); 22 return _strtoui64(nptr, endptr, base);
22 } 23 }
23 #endif 24 #endif
24 25
25 } // namespace 26 } // namespace
26 27
28 Error MountHtml5Fs::Access(const Path& path, int a_mode) {
29 // a_mode is unused, since all files are readable, writable and executable.
binji 2013/06/19 16:46:28 probably shouldn't allow executable for any mount
Matt Giuca 2013/06/20 01:43:14 OK let's discuss this here. You said in the email:
binji 2013/06/20 16:07:21 OK, I agree. :) I like a) better too..
30 if (BlockUntilFilesystemOpen() != PP_OK)
31 return ENODEV;
binji 2013/06/19 16:46:28 do you think this is the correct error value to re
Matt Giuca 2013/06/20 01:43:14 Oh wow, this was copied from Open() but then you c
32
33 PP_Resource fileref = ppapi()->GetFileRefInterface()->Create(
34 filesystem_resource_, path.Join().c_str());
35 if (!fileref)
36 return ENOENT;
37
38 MountNodeHtml5Fs* node = new MountNodeHtml5Fs(this, fileref);
binji 2013/06/19 16:46:28 does this do much more than querying the fileref?
Matt Giuca 2013/06/20 01:43:14 I don't know what you mean. Calling node->Init is
binji 2013/06/20 16:07:21 Yes, you're right about Init. It seemed like a pot
39 Error error = node->Init(O_RDONLY);
40 node->Release();
41 return error;
42 }
43
27 Error MountHtml5Fs::Open(const Path& path, int mode, MountNode** out_node) { 44 Error MountHtml5Fs::Open(const Path& path, int mode, MountNode** out_node) {
28 *out_node = NULL; 45 *out_node = NULL;
29 46
30 Error error = BlockUntilFilesystemOpen(); 47 Error error = BlockUntilFilesystemOpen();
31 if (error) 48 if (error)
32 return error; 49 return error;
33 50
34 PP_Resource fileref = ppapi()->GetFileRefInterface() 51 PP_Resource fileref = ppapi()->GetFileRefInterface()
35 ->Create(filesystem_resource_, path.Join().c_str()); 52 ->Create(filesystem_resource_, path.Join().c_str());
36 if (!fileref) 53 if (!fileref)
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 MountHtml5Fs* self = static_cast<MountHtml5Fs*>(user_data); 188 MountHtml5Fs* self = static_cast<MountHtml5Fs*>(user_data);
172 self->FilesystemOpenCallback(result); 189 self->FilesystemOpenCallback(result);
173 } 190 }
174 191
175 void MountHtml5Fs::FilesystemOpenCallback(int32_t result) { 192 void MountHtml5Fs::FilesystemOpenCallback(int32_t result) {
176 AutoLock lock(&lock_); 193 AutoLock lock(&lock_);
177 filesystem_open_has_result_ = true; 194 filesystem_open_has_result_ = true;
178 filesystem_open_error_ = PPErrorToErrno(result); 195 filesystem_open_error_ = PPErrorToErrno(result);
179 pthread_cond_signal(&filesystem_open_cond_); 196 pthread_cond_signal(&filesystem_open_cond_);
180 } 197 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698