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_node.h" | 5 #include "nacl_io/mount_node.h" |
6 | 6 |
7 #include <errno.h> | 7 #include <errno.h> |
8 #include <fcntl.h> | 8 #include <fcntl.h> |
9 #include <string.h> | 9 #include <string.h> |
10 #include <sys/stat.h> | 10 #include <sys/stat.h> |
11 | 11 |
12 #include <algorithm> | 12 #include <algorithm> |
13 #include <string> | 13 #include <string> |
14 | 14 |
15 #include "nacl_io/kernel_wrap_real.h" | 15 #include "nacl_io/kernel_wrap_real.h" |
16 #include "nacl_io/mount.h" | 16 #include "nacl_io/mount.h" |
17 #include "nacl_io/osmman.h" | 17 #include "nacl_io/osmman.h" |
18 #include "sdk_util/auto_lock.h" | 18 #include "sdk_util/auto_lock.h" |
19 | 19 |
| 20 namespace nacl_io { |
| 21 |
20 static const int USR_ID = 1001; | 22 static const int USR_ID = 1001; |
21 static const int GRP_ID = 1002; | 23 static const int GRP_ID = 1002; |
22 | 24 |
23 MountNode::MountNode(Mount* mount) : mount_(mount) { | 25 MountNode::MountNode(Mount* mount) : mount_(mount) { |
24 memset(&stat_, 0, sizeof(stat_)); | 26 memset(&stat_, 0, sizeof(stat_)); |
25 stat_.st_gid = GRP_ID; | 27 stat_.st_gid = GRP_ID; |
26 stat_.st_uid = USR_ID; | 28 stat_.st_uid = USR_ID; |
27 | 29 |
28 // Mount should normally never be NULL, but may be null in tests. | 30 // Mount should normally never be NULL, but may be null in tests. |
29 // If NULL, at least set the inode to a valid (nonzero) value. | 31 // If NULL, at least set the inode to a valid (nonzero) value. |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 out_node->reset(NULL); | 144 out_node->reset(NULL); |
143 return ENOTDIR; | 145 return ENOTDIR; |
144 } | 146 } |
145 | 147 |
146 int MountNode::ChildCount() { return 0; } | 148 int MountNode::ChildCount() { return 0; } |
147 | 149 |
148 void MountNode::Link() { stat_.st_nlink++; } | 150 void MountNode::Link() { stat_.st_nlink++; } |
149 | 151 |
150 void MountNode::Unlink() { stat_.st_nlink--; } | 152 void MountNode::Unlink() { stat_.st_nlink--; } |
151 | 153 |
| 154 } // namespace nacl_io |
| 155 |
OLD | NEW |