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_HTML5FS_NODE_H_ | 5 #ifndef LIBRARIES_NACL_IO_MOUNT_HTML5FS_NODE_H_ |
6 #define LIBRARIES_NACL_IO_MOUNT_HTML5FS_NODE_H_ | 6 #define LIBRARIES_NACL_IO_MOUNT_HTML5FS_NODE_H_ |
7 | 7 |
8 #include <ppapi/c/pp_resource.h> | 8 #include <ppapi/c/pp_resource.h> |
9 #include "nacl_io/mount_node.h" | 9 #include "nacl_io/mount_node.h" |
10 | 10 |
11 class MountHtml5Fs; | 11 class MountHtml5Fs; |
12 | 12 |
13 class MountNodeHtml5Fs : public MountNode { | 13 class MountNodeHtml5Fs : public MountNode { |
14 public: | 14 public: |
15 // Normal OS operations on a node (file), can be called by the kernel | 15 // Normal OS operations on a node (file), can be called by the kernel |
16 // directly so it must lock and unlock appropriately. These functions | 16 // directly so it must lock and unlock appropriately. These functions |
17 // must not be called by the mount. | 17 // must not be called by the mount. |
18 virtual int FSync(); | 18 virtual Error FSync(); |
19 virtual int GetDents(size_t offs, struct dirent* pdir, size_t count); | 19 virtual Error GetDents(size_t offs, |
20 virtual int GetStat(struct stat* stat); | 20 struct dirent* pdir, |
21 virtual int Read(size_t offs, void* buf, size_t count); | 21 size_t count, |
22 virtual int FTruncate(off_t size); | 22 int* out_bytes); |
23 virtual int Write(size_t offs, const void* buf, size_t count); | 23 virtual Error GetStat(struct stat* stat); |
| 24 virtual Error Read(size_t offs, void* buf, size_t count, int* out_bytes); |
| 25 virtual Error FTruncate(off_t size); |
| 26 virtual Error Write(size_t offs, |
| 27 const void* buf, |
| 28 size_t count, |
| 29 int* out_bytes); |
24 | 30 |
25 virtual size_t GetSize(); | 31 virtual Error GetSize(size_t *out_size); |
26 | 32 |
27 protected: | 33 protected: |
28 MountNodeHtml5Fs(Mount* mount, PP_Resource fileref); | 34 MountNodeHtml5Fs(Mount* mount, PP_Resource fileref); |
29 | 35 |
30 // Init with standard open flags | 36 // Init with standard open flags |
31 virtual bool Init(int o_mode); | 37 virtual Error Init(int o_mode); |
32 virtual void Destroy(); | 38 virtual void Destroy(); |
33 | 39 |
34 private: | 40 private: |
35 PP_Resource fileref_resource_; | 41 PP_Resource fileref_resource_; |
36 PP_Resource fileio_resource_; | 42 PP_Resource fileio_resource_; |
37 | 43 |
38 friend class MountHtml5Fs; | 44 friend class MountHtml5Fs; |
39 }; | 45 }; |
40 | 46 |
41 #endif // LIBRARIES_NACL_IO_MOUNT_HTML5FS_NODE_H_ | 47 #endif // LIBRARIES_NACL_IO_MOUNT_HTML5FS_NODE_H_ |
OLD | NEW |