| 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 | |
| 6 #ifndef LIBRARIES_NACL_MOUNTS_KERNEL_HANDLE_H_ | 5 #ifndef LIBRARIES_NACL_MOUNTS_KERNEL_HANDLE_H_ |
| 7 #define LIBRARIES_NACL_MOUNTS_KERNEL_HANDLE_H_ | 6 #define LIBRARIES_NACL_MOUNTS_KERNEL_HANDLE_H_ |
| 8 | 7 |
| 9 #include <pthread.h> | 8 #include <pthread.h> |
| 10 | 9 |
| 11 #include "utils/macros.h" | 10 #include "utils/macros.h" |
| 12 #include "utils/ref_object.h" | 11 #include "utils/ref_object.h" |
| 13 | 12 |
| 14 class Mount; | 13 class Mount; |
| 15 class MountNode; | 14 class MountNode; |
| 16 | 15 |
| 17 // KernelHandle provides a reference counted container for the open | 16 // KernelHandle provides a reference counted container for the open |
| 18 // file information, such as it's mount, node, access type and offset. | 17 // file information, such as it's mount, node, access type and offset. |
| 19 // KernelHandle can only be referenced when the KernelProxy lock is held. | 18 // KernelHandle can only be referenced when the KernelProxy lock is held. |
| 20 class KernelHandle : public RefObject { | 19 class KernelHandle : public RefObject { |
| 21 public: | 20 public: |
| 22 KernelHandle(Mount* mnt, MountNode* node, int oflags); | 21 KernelHandle(Mount* mnt, MountNode* node, int oflags); |
| 23 | 22 |
| 24 Mount* mount_; | 23 Mount* mount_; |
| 25 MountNode* node_; | 24 MountNode* node_; |
| 26 int mode_; | 25 int mode_; |
| 27 size_t offs_; | 26 size_t offs_; |
| 28 | 27 |
| 29 private: | 28 private: |
| 30 // May only be called by the KernelProxy when the Kernel's | 29 // May only be called by the KernelProxy when the Kernel's |
| 31 // lock is held. | 30 // lock is held. |
| 32 friend class KernelObject; | 31 friend class KernelObject; |
| 33 friend class KernelProxy; | 32 friend class KernelProxy; |
| 34 void Acquire() { RefObject::Acquire(); } | 33 void Acquire() { RefObject::Acquire(); } |
| 35 bool Release() { return RefObject::Release(); } | 34 void Release() { RefObject::Release(); } |
| 36 DISALLOW_COPY_AND_ASSIGN(KernelHandle); | 35 DISALLOW_COPY_AND_ASSIGN(KernelHandle); |
| 37 }; | 36 }; |
| 38 | 37 |
| 39 #endif // LIBRARIES_NACL_MOUNTS_KERNEL_HANDLE_H_ | 38 #endif // LIBRARIES_NACL_MOUNTS_KERNEL_HANDLE_H_ |
| OLD | NEW |