| 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_MOUNTS_KERNEL_PROXY_H_ | 5 #ifndef LIBRARIES_NACL_IO_KERNEL_PROXY_H_ |
| 6 #define LIBRARIES_NACL_MOUNTS_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_mounts/kernel_object.h" | 15 #include "nacl_io/kernel_object.h" |
| 16 #include "nacl_mounts/mount.h" | 16 #include "nacl_io/mount.h" |
| 17 #include "nacl_mounts/ostypes.h" | 17 #include "nacl_io/ostypes.h" |
| 18 #include "nacl_mounts/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: |
| (...skipping 10 matching lines...) Expand all Loading... |
| 39 // KernelHandle and FD allocation and manipulation functions. | 39 // KernelHandle and FD allocation and manipulation functions. |
| 40 virtual int open(const char *path, int oflag); | 40 virtual int open(const char *path, int oflag); |
| 41 virtual int close(int fd); | 41 virtual int close(int fd); |
| 42 virtual int dup(int fd); | 42 virtual int dup(int fd); |
| 43 virtual int dup2(int fd, int newfd); | 43 virtual int dup2(int fd, int newfd); |
| 44 | 44 |
| 45 // System calls handled by KernelProxy (not mount-specific) | 45 // System calls handled by KernelProxy (not mount-specific) |
| 46 virtual int chdir(const char* path); | 46 virtual int chdir(const char* path); |
| 47 virtual char* getcwd(char* buf, size_t size); | 47 virtual char* getcwd(char* buf, size_t size); |
| 48 virtual char* getwd(char* buf); | 48 virtual char* getwd(char* buf); |
| 49 virtual int mount(const char *source, const char *target, | 49 virtual int mount(const char *source, const char *target, |
| 50 const char *filesystemtype, unsigned long mountflags, const void *data); | 50 const char *filesystemtype, unsigned long mountflags, const void *data); |
| 51 virtual int umount(const char *path); | 51 virtual int umount(const char *path); |
| 52 | 52 |
| 53 // System calls that take a path as an argument: | 53 // System calls that take a path as an argument: |
| 54 // The kernel proxy will look for the Node associated to the path. To | 54 // The kernel proxy will look for the Node associated to the path. To |
| 55 // find the node, the kernel proxy calls the corresponding mount's GetNode() | 55 // find the node, the kernel proxy calls the corresponding mount's GetNode() |
| 56 // method. The corresponding method will be called. If the node | 56 // method. The corresponding method will be called. If the node |
| 57 // cannot be found, errno is set and -1 is returned. | 57 // cannot be found, errno is set and -1 is returned. |
| 58 virtual int chmod(const char *path, mode_t mode); | 58 virtual int chmod(const char *path, mode_t mode); |
| 59 virtual int mkdir(const char *path, mode_t mode); | 59 virtual int mkdir(const char *path, mode_t mode); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 protected: | 92 protected: |
| 93 MountFactoryMap_t factories_; | 93 MountFactoryMap_t factories_; |
| 94 int dev_; | 94 int dev_; |
| 95 PepperInterface* ppapi_; | 95 PepperInterface* ppapi_; |
| 96 | 96 |
| 97 static KernelProxy *s_instance_; | 97 static KernelProxy *s_instance_; |
| 98 | 98 |
| 99 DISALLOW_COPY_AND_ASSIGN(KernelProxy); | 99 DISALLOW_COPY_AND_ASSIGN(KernelProxy); |
| 100 }; | 100 }; |
| 101 | 101 |
| 102 #endif // LIBRARIES_NACL_MOUNTS_KERNEL_PROXY_H_ | 102 #endif // LIBRARIES_NACL_IO_KERNEL_PROXY_H_ |
| OLD | NEW |