| 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 #ifndef LIBRARIES_NACL_IO_MOUNT_NODE_H_ | 5 #ifndef LIBRARIES_NACL_IO_MOUNT_NODE_H_ |
| 6 #define LIBRARIES_NACL_IO_MOUNT_NODE_H_ | 6 #define LIBRARIES_NACL_IO_MOUNT_NODE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "nacl_io/error.h" | 10 #include "nacl_io/error.h" |
| 11 #include "nacl_io/event_listener.h" | 11 #include "nacl_io/event_listener.h" |
| 12 #include "nacl_io/osdirent.h" | 12 #include "nacl_io/osdirent.h" |
| 13 #include "nacl_io/osstat.h" | 13 #include "nacl_io/osstat.h" |
| 14 #include "nacl_io/ostermios.h" | 14 #include "nacl_io/ostermios.h" |
| 15 | 15 |
| 16 #include "sdk_util/ref_object.h" | 16 #include "sdk_util/ref_object.h" |
| 17 #include "sdk_util/scoped_ref.h" | 17 #include "sdk_util/scoped_ref.h" |
| 18 #include "sdk_util/simple_lock.h" | 18 #include "sdk_util/simple_lock.h" |
| 19 | 19 |
| 20 namespace nacl_io { | 20 namespace nacl_io { |
| 21 | 21 |
| 22 class Mount; | 22 class Mount; |
| 23 class MountNode; | 23 class MountNode; |
| 24 | 24 |
| 25 typedef sdk_util::ScopedRef<MountNode> ScopedMountNode; | 25 typedef sdk_util::ScopedRef<MountNode> ScopedMountNode; |
| 26 | 26 |
| 27 // NOTE: The KernelProxy is the only class that should be setting errno. All | 27 // NOTE: The KernelProxy is the only class that should be setting errno. All |
| 28 // other classes should return Error (as defined by nacl_io/error.h). | 28 // other classes should return Error (as defined by nacl_io/error.h). |
| 29 class MountNode : public EventListener { | 29 class MountNode : public sdk_util::RefObject { |
| 30 protected: | 30 protected: |
| 31 explicit MountNode(Mount* mount); | 31 explicit MountNode(Mount* mount); |
| 32 virtual ~MountNode(); | 32 virtual ~MountNode(); |
| 33 | 33 |
| 34 protected: | 34 protected: |
| 35 // Initialize with node specific flags, in this case stat permissions. | 35 // Initialize with node specific flags, in this case stat permissions. |
| 36 virtual Error Init(int flags); | 36 virtual Error Init(int flags); |
| 37 virtual void Destroy(); | 37 virtual void Destroy(); |
| 38 | 38 |
| 39 public: | 39 public: |
| 40 // Declared in EventEmitter. defaults to signalled. | 40 // Returns the emitter for this Node if it has one, if not, assume this |
| 41 // object can not block. |
| 42 virtual EventEmitter* GetEventEmitter(); |
| 41 virtual uint32_t GetEventStatus(); | 43 virtual uint32_t GetEventStatus(); |
| 42 | 44 |
| 43 // Normal OS operations on a node (file), can be called by the kernel | 45 // Normal OS operations on a node (file), can be called by the kernel |
| 44 // directly so it must lock and unlock appropriately. These functions | 46 // directly so it must lock and unlock appropriately. These functions |
| 45 // must not be called by the mount. | 47 // must not be called by the mount. |
| 46 virtual Error FSync(); | 48 virtual Error FSync(); |
| 47 // It is expected that the derived MountNode will fill with 0 when growing | 49 // It is expected that the derived MountNode will fill with 0 when growing |
| 48 // the file. | 50 // the file. |
| 49 virtual Error FTruncate(off_t length); | 51 virtual Error FTruncate(off_t length); |
| 50 // Assume that |out_bytes| is non-NULL. | 52 // Assume that |out_bytes| is non-NULL. |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 friend class MountDev; | 122 friend class MountDev; |
| 121 friend class MountHtml5Fs; | 123 friend class MountHtml5Fs; |
| 122 friend class MountHttp; | 124 friend class MountHttp; |
| 123 friend class MountMem; | 125 friend class MountMem; |
| 124 friend class MountNodeDir; | 126 friend class MountNodeDir; |
| 125 }; | 127 }; |
| 126 | 128 |
| 127 } // namespace nacl_io | 129 } // namespace nacl_io |
| 128 | 130 |
| 129 #endif // LIBRARIES_NACL_IO_MOUNT_NODE_H_ | 131 #endif // LIBRARIES_NACL_IO_MOUNT_NODE_H_ |
| OLD | NEW |