| 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/node.h" | 5 #include "nacl_io/node.h" |
| 6 | 6 |
| 7 #include <assert.h> | 7 #include <assert.h> |
| 8 #include <errno.h> | 8 #include <errno.h> |
| 9 #include <fcntl.h> | 9 #include <fcntl.h> |
| 10 #include <poll.h> | 10 #include <poll.h> |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 int Node::GetType() { | 192 int Node::GetType() { |
| 193 return stat_.st_mode & S_IFMT; | 193 return stat_.st_mode & S_IFMT; |
| 194 } | 194 } |
| 195 | 195 |
| 196 void Node::SetType(int type) { | 196 void Node::SetType(int type) { |
| 197 assert((type & ~S_IFMT) == 0); | 197 assert((type & ~S_IFMT) == 0); |
| 198 stat_.st_mode &= ~S_IFMT; | 198 stat_.st_mode &= ~S_IFMT; |
| 199 stat_.st_mode |= type; | 199 stat_.st_mode |= type; |
| 200 } | 200 } |
| 201 | 201 |
| 202 void Node::SetMode(int mode) { |
| 203 assert((mode & S_IFMT) == 0); |
| 204 stat_.st_mode &= S_IFMT; |
| 205 stat_.st_mode |= mode; |
| 206 } |
| 207 |
| 202 bool Node::IsaDir() { | 208 bool Node::IsaDir() { |
| 203 return GetType() == S_IFDIR; | 209 return GetType() == S_IFDIR; |
| 204 } | 210 } |
| 205 | 211 |
| 206 bool Node::IsaFile() { | 212 bool Node::IsaFile() { |
| 207 return GetType() == S_IFREG; | 213 return GetType() == S_IFREG; |
| 208 } | 214 } |
| 209 | 215 |
| 210 bool Node::IsaSock() { | 216 bool Node::IsaSock() { |
| 211 return GetType() == S_IFSOCK; | 217 return GetType() == S_IFSOCK; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 234 | 240 |
| 235 void Node::Link() { | 241 void Node::Link() { |
| 236 stat_.st_nlink++; | 242 stat_.st_nlink++; |
| 237 } | 243 } |
| 238 | 244 |
| 239 void Node::Unlink() { | 245 void Node::Unlink() { |
| 240 stat_.st_nlink--; | 246 stat_.st_nlink--; |
| 241 } | 247 } |
| 242 | 248 |
| 243 } // namespace nacl_io | 249 } // namespace nacl_io |
| OLD | NEW |