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/memfs/mem_fs.h" | 5 #include "nacl_io/memfs/mem_fs.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/dir_node.h" | 12 #include "nacl_io/dir_node.h" |
13 #include "nacl_io/filesystem.h" | 13 #include "nacl_io/filesystem.h" |
14 #include "nacl_io/memfs/mem_fs_node.h" | 14 #include "nacl_io/memfs/mem_fs_node.h" |
15 #include "nacl_io/node.h" | 15 #include "nacl_io/node.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 { | 22 namespace nacl_io { |
23 | 23 |
24 MemFs::MemFs() : root_(NULL) {} | 24 MemFs::MemFs() : root_(NULL) { |
| 25 } |
25 | 26 |
26 Error MemFs::Init(const FsInitArgs& args) { | 27 Error MemFs::Init(const FsInitArgs& args) { |
27 Error error = Filesystem::Init(args); | 28 Error error = Filesystem::Init(args); |
28 if (error) | 29 if (error) |
29 return error; | 30 return error; |
30 | 31 |
31 root_.reset(new DirNode(this)); | 32 root_.reset(new DirNode(this)); |
32 error = root_->Init(0); | 33 error = root_->Init(0); |
33 if (error) { | 34 if (error) { |
34 root_.reset(NULL); | 35 root_.reset(NULL); |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 if (file_only && child->IsaDir()) | 282 if (file_only && child->IsaDir()) |
282 return EISDIR; | 283 return EISDIR; |
283 | 284 |
284 if (remove_dir && child->ChildCount() > 0) | 285 if (remove_dir && child->ChildCount() > 0) |
285 return ENOTEMPTY; | 286 return ENOTEMPTY; |
286 | 287 |
287 return parent->RemoveChild(path.Basename()); | 288 return parent->RemoveChild(path.Basename()); |
288 } | 289 } |
289 | 290 |
290 } // namespace nacl_io | 291 } // namespace nacl_io |
OLD | NEW |