| 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_KERNEL_PROXY_H_ | 5 #ifndef LIBRARIES_NACL_IO_KERNEL_PROXY_H_ |
| 6 #define LIBRARIES_NACL_IO_KERNEL_PROXY_H_ | 6 #define LIBRARIES_NACL_IO_KERNEL_PROXY_H_ |
| 7 | 7 |
| 8 #include <ppapi/c/pp_instance.h> | 8 #include <ppapi/c/pp_instance.h> |
| 9 #include <ppapi/c/ppb.h> | 9 #include <ppapi/c/ppb.h> |
| 10 #include <pthread.h> | 10 #include <pthread.h> |
| 11 #include <map> | 11 #include <map> |
| 12 #include <string> | 12 #include <string> |
| 13 #include <vector> | 13 #include <vector> |
| 14 | 14 |
| 15 #include "nacl_io/kernel_object.h" | 15 #include "nacl_io/kernel_object.h" |
| 16 #include "nacl_io/mount.h" | 16 #include "nacl_io/mount.h" |
| 17 #include "nacl_io/ostypes.h" | 17 #include "nacl_io/ostypes.h" |
| 18 #include "nacl_io/path.h" | 18 #include "nacl_io/path.h" |
| 19 | 19 |
| 20 class KernelHandle; | 20 class KernelHandle; |
| 21 class Mount; | 21 class Mount; |
| 22 class MountNode; | 22 class MountNode; |
| 23 class PepperInterface; | 23 class PepperInterface; |
| 24 | 24 |
| 25 // KernelProxy provide one-to-one mapping for libc kernel calls. Calls to the | 25 // KernelProxy provide one-to-one mapping for libc kernel calls. Calls to the |
| 26 // proxy will result in IO access to the provided Mount and MountNode objects. | 26 // proxy will result in IO access to the provided Mount and MountNode objects. |
| 27 class KernelProxy : protected KernelObject { | 27 class KernelProxy : protected KernelObject { |
| 28 public: | 28 public: |
| 29 typedef Mount* (*MountFactory_t)(int, StringMap_t&, PepperInterface*); | 29 typedef Error (*MountFactory_t)(int, StringMap_t&, PepperInterface*, Mount**); |
| 30 typedef std::map<std::string, std::string> StringMap_t; | 30 typedef std::map<std::string, std::string> StringMap_t; |
| 31 typedef std::map<std::string, MountFactory_t> MountFactoryMap_t; | 31 typedef std::map<std::string, MountFactory_t> MountFactoryMap_t; |
| 32 | 32 |
| 33 KernelProxy(); | 33 KernelProxy(); |
| 34 virtual ~KernelProxy(); | 34 virtual ~KernelProxy(); |
| 35 // Takes ownership of |ppapi|. | 35 // Takes ownership of |ppapi|. |
| 36 // |ppapi| may be NULL. If so, no mount that uses pepper calls can be mounted. | 36 // |ppapi| may be NULL. If so, no mount that uses pepper calls can be mounted. |
| 37 virtual void Init(PepperInterface* ppapi); | 37 virtual void Init(PepperInterface* ppapi); |
| 38 | 38 |
| 39 // KernelHandle and FD allocation and manipulation functions. | 39 // KernelHandle and FD allocation and manipulation functions. |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 MountFactoryMap_t factories_; | 101 MountFactoryMap_t factories_; |
| 102 int dev_; | 102 int dev_; |
| 103 PepperInterface* ppapi_; | 103 PepperInterface* ppapi_; |
| 104 | 104 |
| 105 static KernelProxy *s_instance_; | 105 static KernelProxy *s_instance_; |
| 106 | 106 |
| 107 DISALLOW_COPY_AND_ASSIGN(KernelProxy); | 107 DISALLOW_COPY_AND_ASSIGN(KernelProxy); |
| 108 }; | 108 }; |
| 109 | 109 |
| 110 #endif // LIBRARIES_NACL_IO_KERNEL_PROXY_H_ | 110 #endif // LIBRARIES_NACL_IO_KERNEL_PROXY_H_ |
| OLD | NEW |