OLD | NEW |
---|---|
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 #include "nacl_io/mount.h" | 5 #include "nacl_io/mount.h" |
6 | 6 |
7 #include <errno.h> | 7 #include <errno.h> |
8 #include <fcntl.h> | 8 #include <fcntl.h> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "nacl_io/mount_node.h" | 11 #include "nacl_io/mount_node.h" |
12 #include "nacl_io/mount_node_dir.h" | 12 #include "nacl_io/mount_node_dir.h" |
13 #include "nacl_io/mount_node_mem.h" | 13 #include "nacl_io/mount_node_mem.h" |
14 #include "nacl_io/osstat.h" | 14 #include "nacl_io/osstat.h" |
15 #include "nacl_io/path.h" | 15 #include "nacl_io/path.h" |
16 #include "utils/auto_lock.h" | 16 #include "utils/auto_lock.h" |
17 #include "utils/ref_object.h" | 17 #include "utils/ref_object.h" |
18 | 18 |
19 #if defined(WIN32) | 19 #if defined(WIN32) |
20 #include <windows.h> | 20 #include <windows.h> |
21 #endif | 21 #endif |
22 | 22 |
23 Mount::Mount() | 23 Mount::Mount() : dev_(0) {} |
24 : dev_(0) { | |
25 } | |
26 | 24 |
27 Mount::~Mount() {} | 25 Mount::~Mount() {} |
28 | 26 |
29 bool Mount::Init(int dev, StringMap_t& args, PepperInterface* ppapi) { | 27 Error Mount::Init(int dev, StringMap_t& args, PepperInterface* ppapi) { |
30 dev_ = dev; | 28 dev_ = dev; |
31 ppapi_ = ppapi; | 29 ppapi_ = ppapi; |
32 return true; | 30 return 0; |
33 } | 31 } |
34 | 32 |
35 void Mount::Destroy() {} | 33 void Mount::Destroy() {} |
36 | 34 |
37 void Mount::AcquireNode(MountNode* node) { | 35 void Mount::AcquireNode(MountNode* node) { |
38 AutoLock lock(&lock_); | 36 AutoLock lock(&lock_); |
39 node->Acquire(); | 37 node->Acquire(); |
40 } | 38 } |
41 | 39 |
42 void Mount::ReleaseNode(MountNode* node) { | 40 void Mount::ReleaseNode(MountNode* node) { |
43 AutoLock lock(&lock_); | 41 AutoLock lock(&lock_); |
44 node->Release(); | 42 node->Release(); |
45 } | 43 } |
46 | 44 |
45 Error Mount::OpenResource(const Path& path, MountNode** out_node) { | |
46 *out_node = NULL; | |
47 return EINVAL; | |
48 } | |
49 | |
47 int Mount::OpenModeToPermission(int mode) { | 50 int Mount::OpenModeToPermission(int mode) { |
48 int out; | 51 int out; |
49 switch (mode & 3) { | 52 switch (mode & 3) { |
50 case O_RDONLY: out = S_IREAD; | 53 case O_RDONLY: |
noelallen1
2013/06/07 21:48:43
out = S_IREAD; break;
Doesn't match single line ke
binji
2013/06/07 23:23:11
Ran clang-format on this and it did this. I just r
| |
51 case O_WRONLY: out = S_IWRITE; | 54 out = S_IREAD; |
52 case O_RDWR: out = S_IREAD | S_IWRITE; | 55 case O_WRONLY: |
56 out = S_IWRITE; | |
57 case O_RDWR: | |
58 out = S_IREAD | S_IWRITE; | |
53 } | 59 } |
54 return out; | 60 return out; |
55 } | 61 } |
56 | 62 |
57 | |
58 void Mount::OnNodeCreated(MountNode* node) { | 63 void Mount::OnNodeCreated(MountNode* node) { |
59 node->stat_.st_ino = inode_pool_.Acquire(); | 64 node->stat_.st_ino = inode_pool_.Acquire(); |
60 node->stat_.st_dev = dev_; | 65 node->stat_.st_dev = dev_; |
61 } | 66 } |
62 | 67 |
63 void Mount::OnNodeDestroyed(MountNode* node) { | 68 void Mount::OnNodeDestroyed(MountNode* node) { |
64 if (node->stat_.st_ino) inode_pool_.Release(node->stat_.st_ino); | 69 if (node->stat_.st_ino) |
65 } | 70 inode_pool_.Release(node->stat_.st_ino); |
71 } | |
OLD | NEW |