| 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 <poll.h> | 9 #include <poll.h> |
| 10 #include <string.h> | 10 #include <string.h> |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 stat_.st_mode |= perm; | 42 stat_.st_mode |= perm; |
| 43 return 0; | 43 return 0; |
| 44 } | 44 } |
| 45 | 45 |
| 46 void MountNode::Destroy() { | 46 void MountNode::Destroy() { |
| 47 if (mount_) { | 47 if (mount_) { |
| 48 mount_->OnNodeDestroyed(this); | 48 mount_->OnNodeDestroyed(this); |
| 49 } | 49 } |
| 50 } | 50 } |
| 51 | 51 |
| 52 // Declared in EventEmitter, default to regular files which always return | 52 EventEmitter* MountNode::GetEventEmitter() { return NULL; } |
| 53 // a ready of TRUE for read, write, or error. | 53 |
| 54 uint32_t MountNode::GetEventStatus() { | 54 uint32_t MountNode::GetEventStatus() { |
| 55 uint32_t val = POLLIN | POLLOUT | POLLERR; | 55 if (GetEventEmitter()) |
| 56 return val; | 56 return GetEventEmitter()->GetEventStatus(); |
| 57 |
| 58 return POLLIN | POLLOUT; |
| 57 } | 59 } |
| 58 | 60 |
| 59 | |
| 60 Error MountNode::FSync() { return 0; } | 61 Error MountNode::FSync() { return 0; } |
| 61 | 62 |
| 62 Error MountNode::FTruncate(off_t length) { return EINVAL; } | 63 Error MountNode::FTruncate(off_t length) { return EINVAL; } |
| 63 | 64 |
| 64 Error MountNode::GetDents(size_t offs, | 65 Error MountNode::GetDents(size_t offs, |
| 65 struct dirent* pdir, | 66 struct dirent* pdir, |
| 66 size_t count, | 67 size_t count, |
| 67 int* out_bytes) { | 68 int* out_bytes) { |
| 68 *out_bytes = 0; | 69 *out_bytes = 0; |
| 69 return ENOTDIR; | 70 return ENOTDIR; |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 } | 171 } |
| 171 | 172 |
| 172 int MountNode::ChildCount() { return 0; } | 173 int MountNode::ChildCount() { return 0; } |
| 173 | 174 |
| 174 void MountNode::Link() { stat_.st_nlink++; } | 175 void MountNode::Link() { stat_.st_nlink++; } |
| 175 | 176 |
| 176 void MountNode::Unlink() { stat_.st_nlink--; } | 177 void MountNode::Unlink() { stat_.st_nlink--; } |
| 177 | 178 |
| 178 } // namespace nacl_io | 179 } // namespace nacl_io |
| 179 | 180 |
| OLD | NEW |