OLD | NEW |
1 /* Copyright (c) 2012 The hromium 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_mem.h" | 5 #include "nacl_io/mount_mem.h" |
6 | 6 |
7 #include <errno.h> | 7 #include <errno.h> |
8 #include <fcntl.h> | 8 #include <fcntl.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "nacl_io/mount.h" | 12 #include "nacl_io/mount.h" |
13 #include "nacl_io/mount_node.h" | 13 #include "nacl_io/mount_node.h" |
14 #include "nacl_io/mount_node_dir.h" | 14 #include "nacl_io/mount_node_dir.h" |
15 #include "nacl_io/mount_node_mem.h" | 15 #include "nacl_io/mount_node_mem.h" |
16 #include "nacl_io/osstat.h" | 16 #include "nacl_io/osstat.h" |
17 #include "nacl_io/osunistd.h" | 17 #include "nacl_io/osunistd.h" |
18 #include "nacl_io/path.h" | 18 #include "nacl_io/path.h" |
19 #include "sdk_util/auto_lock.h" | 19 #include "sdk_util/auto_lock.h" |
20 #include "sdk_util/ref_object.h" | 20 #include "sdk_util/ref_object.h" |
21 | 21 |
| 22 namespace nacl_io { |
| 23 |
22 MountMem::MountMem() : root_(NULL) {} | 24 MountMem::MountMem() : root_(NULL) {} |
23 | 25 |
24 Error MountMem::Init(int dev, StringMap_t& args, PepperInterface* ppapi) { | 26 Error MountMem::Init(int dev, StringMap_t& args, PepperInterface* ppapi) { |
25 Error error = Mount::Init(dev, args, ppapi); | 27 Error error = Mount::Init(dev, args, ppapi); |
26 if (error) | 28 if (error) |
27 return error; | 29 return error; |
28 | 30 |
29 root_.reset(new MountNodeDir(this)); | 31 root_.reset(new MountNodeDir(this)); |
30 error = root_->Init(S_IREAD | S_IWRITE); | 32 error = root_->Init(S_IREAD | S_IWRITE); |
31 if (error) { | 33 if (error) { |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 | 216 |
215 if (file_only && child->IsaDir()) | 217 if (file_only && child->IsaDir()) |
216 return EISDIR; | 218 return EISDIR; |
217 | 219 |
218 if (remove_dir && child->ChildCount() > 0) | 220 if (remove_dir && child->ChildCount() > 0) |
219 return ENOTEMPTY; | 221 return ENOTEMPTY; |
220 | 222 |
221 return parent->RemoveChild(path.Basename()); | 223 return parent->RemoveChild(path.Basename()); |
222 } | 224 } |
223 | 225 |
| 226 } // namespace nacl_io |
| 227 |
OLD | NEW |