| 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_mounts/kernel_handle.h" | 5 #include "nacl_mounts/kernel_handle.h" |
| 6 | 6 |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 #include <fcntl.h> | 8 #include <fcntl.h> |
| 9 #include <pthread.h> | 9 #include <pthread.h> |
| 10 #include <unistd.h> |
| 10 | 11 |
| 11 #include "nacl_mounts/mount.h" | 12 #include "nacl_mounts/mount.h" |
| 12 #include "nacl_mounts/mount_node.h" | 13 #include "nacl_mounts/mount_node.h" |
| 13 | 14 |
| 14 // It is only legal to construct a handle while the kernel lock is held. | 15 // It is only legal to construct a handle while the kernel lock is held. |
| 15 KernelHandle::KernelHandle(Mount* mnt, MountNode* node, int mode) | 16 KernelHandle::KernelHandle(Mount* mnt, MountNode* node, int mode) |
| 16 : mount_(mnt), | 17 : mount_(mnt), |
| 17 node_(node), | 18 node_(node), |
| 18 mode_(mode), | 19 mode_(mode), |
| 19 offs_(0) { | 20 offs_(0) { |
| (...skipping 21 matching lines...) Expand all Loading... |
| 41 // end and the new end. | 42 // end and the new end. |
| 42 if (offs_ > node_->GetSize()) { | 43 if (offs_ > node_->GetSize()) { |
| 43 if (node_->Truncate(offs_) < 0) { | 44 if (node_->Truncate(offs_) < 0) { |
| 44 errno = EINVAL; | 45 errno = EINVAL; |
| 45 return -1; | 46 return -1; |
| 46 } | 47 } |
| 47 } | 48 } |
| 48 | 49 |
| 49 return offs_; | 50 return offs_; |
| 50 } | 51 } |
| OLD | NEW |