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 | 5 |
6 #include <dirent.h> | 6 #include <dirent.h> |
7 #include <errno.h> | 7 #include <errno.h> |
8 #include <fcntl.h> | 8 #include <fcntl.h> |
9 #include <sys/stat.h> | 9 #include <sys/stat.h> |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "auto_lock.h" | 12 #include "auto_lock.h" |
13 #include "mount.h" | 13 #include "mount.h" |
14 #include "mount_node.h" | 14 #include "mount_node.h" |
15 | 15 |
16 MountNode::MountNode(Mount* mount, int ino, int dev) : | 16 MountNode::MountNode(Mount* mount, int ino, int dev) |
17 mount_(mount) { | 17 : mount_(mount) { |
18 memset(&stat_, 0, sizeof(stat_)); | 18 memset(&stat_, 0, sizeof(stat_)); |
19 stat_.st_ino = ino; | 19 stat_.st_ino = ino; |
20 stat_.st_dev = dev; | 20 stat_.st_dev = dev; |
21 } | 21 } |
22 | 22 |
23 MountNode::~MountNode() { | 23 MountNode::~MountNode() { |
24 } | 24 } |
25 | 25 |
26 bool MountNode::Init(int mode, short gid, short uid) { | 26 bool MountNode::Init(int mode, short uid, short gid) { |
27 stat_.st_mode = mode; | 27 stat_.st_mode = mode; |
28 stat_.st_gid = gid; | 28 stat_.st_gid = gid; |
29 stat_.st_uid = uid; | 29 stat_.st_uid = uid; |
30 return true; | 30 return true; |
31 } | 31 } |
32 | 32 |
33 void MountNode::Destroy() { | 33 int MountNode::Close() { |
34 FSync(); | 34 FSync(); |
35 mount_->FreeNode(this); | 35 return 0; |
36 } | 36 } |
37 | 37 |
38 int MountNode::FSync() { | 38 int MountNode::FSync() { |
39 return 0; | 39 return 0; |
40 } | 40 } |
41 | 41 |
42 int MountNode::GetDents(size_t offs, struct dirent* pdir, size_t count) { | 42 int MountNode::GetDents(size_t offs, struct dirent* pdir, size_t count) { |
43 errno = ENOTDIR; | 43 errno = ENOTDIR; |
44 return -1; | 44 return -1; |
45 } | 45 } |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 int MountNode::RemoveChild(const std::string& name) { | 106 int MountNode::RemoveChild(const std::string& name) { |
107 errno = ENOTDIR; | 107 errno = ENOTDIR; |
108 return -1; | 108 return -1; |
109 } | 109 } |
110 | 110 |
111 MountNode* MountNode::FindChild(const std::string& name) { | 111 MountNode* MountNode::FindChild(const std::string& name) { |
112 errno = ENOTDIR; | 112 errno = ENOTDIR; |
113 return NULL; | 113 return NULL; |
114 } | 114 } |
115 | 115 |
| 116 int MountNode::ChildCount() { |
| 117 errno = ENOTDIR; |
| 118 return -1; |
| 119 } |
| 120 |
116 void MountNode::Link() { | 121 void MountNode::Link() { |
117 Acquire(); | 122 Acquire(); |
118 stat_.st_nlink++; | 123 stat_.st_nlink++; |
119 } | 124 } |
120 | 125 |
121 void MountNode::Unlink() { | 126 void MountNode::Unlink() { |
122 stat_.st_nlink--; | 127 stat_.st_nlink--; |
123 Release(); | 128 Release(); |
124 } | 129 } |
125 | 130 |
OLD | NEW |