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/filesystem.h" | 5 #include "nacl_io/filesystem.h" |
6 | 6 |
7 #include <errno.h> | 7 #include <errno.h> |
8 #include <fcntl.h> | 8 #include <fcntl.h> |
9 #include <stdarg.h> | 9 #include <stdarg.h> |
10 | 10 |
11 #include <string> | 11 #include <string> |
12 | 12 |
13 #include "nacl_io/dir_node.h" | 13 #include "nacl_io/dir_node.h" |
| 14 #include "nacl_io/log.h" |
14 #include "nacl_io/node.h" | 15 #include "nacl_io/node.h" |
15 #include "nacl_io/osstat.h" | 16 #include "nacl_io/osstat.h" |
16 #include "nacl_io/path.h" | 17 #include "nacl_io/path.h" |
17 #include "sdk_util/auto_lock.h" | 18 #include "sdk_util/auto_lock.h" |
18 #include "sdk_util/ref_object.h" | 19 #include "sdk_util/ref_object.h" |
19 | 20 |
20 #if defined(WIN32) | 21 #if defined(WIN32) |
21 #include <windows.h> | 22 #include <windows.h> |
22 #endif | 23 #endif |
23 | 24 |
24 namespace nacl_io { | 25 namespace nacl_io { |
25 | 26 |
26 Filesystem::Filesystem() : dev_(0) { | 27 Filesystem::Filesystem() : dev_(0) { |
27 } | 28 } |
28 | 29 |
29 Filesystem::~Filesystem() { | 30 Filesystem::~Filesystem() { |
30 } | 31 } |
31 | 32 |
32 Error Filesystem::Init(const FsInitArgs& args) { | 33 Error Filesystem::Init(const FsInitArgs& args) { |
33 dev_ = args.dev; | 34 dev_ = args.dev; |
34 ppapi_ = args.ppapi; | 35 ppapi_ = args.ppapi; |
35 return 0; | 36 return 0; |
36 } | 37 } |
37 | 38 |
38 void Filesystem::Destroy() { | 39 void Filesystem::Destroy() { |
39 } | 40 } |
40 | 41 |
41 Error Filesystem::OpenResource(const Path& path, ScopedNode* out_node) { | 42 Error Filesystem::OpenResource(const Path& path, ScopedNode* out_node) { |
42 out_node->reset(NULL); | 43 out_node->reset(NULL); |
| 44 LOG_TRACE("Can't open resource: %s", path.Join().c_str()); |
43 return EINVAL; | 45 return EINVAL; |
44 } | 46 } |
45 | 47 |
46 void Filesystem::OnNodeCreated(Node* node) { | 48 void Filesystem::OnNodeCreated(Node* node) { |
47 node->stat_.st_ino = inode_pool_.Acquire(); | 49 node->stat_.st_ino = inode_pool_.Acquire(); |
48 node->stat_.st_dev = dev_; | 50 node->stat_.st_dev = dev_; |
49 } | 51 } |
50 | 52 |
51 void Filesystem::OnNodeDestroyed(Node* node) { | 53 void Filesystem::OnNodeDestroyed(Node* node) { |
52 if (node->stat_.st_ino) | 54 if (node->stat_.st_ino) |
53 inode_pool_.Release(node->stat_.st_ino); | 55 inode_pool_.Release(node->stat_.st_ino); |
54 } | 56 } |
55 | 57 |
56 Error Filesystem::Filesystem_VIoctl(int request, va_list args) { | 58 Error Filesystem::Filesystem_VIoctl(int request, va_list args) { |
| 59 LOG_ERROR("Unsupported ioctl: %#x", request); |
57 return EINVAL; | 60 return EINVAL; |
58 } | 61 } |
59 | 62 |
60 Error Filesystem::Filesystem_Ioctl(int request, ...) { | 63 Error Filesystem::Filesystem_Ioctl(int request, ...) { |
61 va_list args; | 64 va_list args; |
62 va_start(args, request); | 65 va_start(args, request); |
63 Error error = Filesystem_VIoctl(request, args); | 66 Error error = Filesystem_VIoctl(request, args); |
64 va_end(args); | 67 va_end(args); |
65 return error; | 68 return error; |
66 } | 69 } |
67 | 70 |
68 } // namespace nacl_io | 71 } // namespace nacl_io |
OLD | NEW |