Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / native_client_sdk / src / libraries / nacl_io / html5fs / html5_fs_node.h
blob1d8ea61e407e5ef141330f9bbb3065f7113bfa4f
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef LIBRARIES_NACL_IO_HTML5FS_HTML5_FS_NODE_H_
6 #define LIBRARIES_NACL_IO_HTML5FS_HTML5_FS_NODE_H_
8 #include <ppapi/c/pp_instance.h>
9 #include <ppapi/c/pp_resource.h>
10 #include "nacl_io/node.h"
12 namespace nacl_io {
14 class Html5Fs;
15 class FileIoInterface;
16 class FileRefInterface;
17 class VarInterface;
19 class Html5FsNode : public Node {
20 public:
21 // Normal OS operations on a node (file), can be called by the kernel
22 // directly so it must lock and unlock appropriately. These functions
23 // must not be called by the filesystem.
24 virtual Error FSync();
25 virtual Error GetDents(size_t offs,
26 struct dirent* pdir,
27 size_t count,
28 int* out_bytes);
29 virtual Error GetStat(struct stat* stat);
30 virtual Error Read(const HandleAttr& attr,
31 void* buf,
32 size_t count,
33 int* out_bytes);
34 virtual Error FTruncate(off_t size);
35 virtual Error Write(const HandleAttr& attr,
36 const void* buf,
37 size_t count,
38 int* out_bytes);
40 virtual int GetType();
41 virtual Error GetSize(off_t* out_size);
42 virtual Error Fchmod(mode_t mode);
44 protected:
45 Html5FsNode(Filesystem* filesystem, PP_Resource fileref);
47 // Init with standard open flags
48 virtual Error Init(int open_flags);
49 virtual void Destroy();
51 private:
52 FileIoInterface* file_io_iface_;
53 FileRefInterface* file_ref_iface_;
54 VarInterface* var_iface_;
55 PP_Resource fileref_resource_;
56 PP_Resource fileio_resource_; // 0 if the file is a directory.
58 friend class Html5Fs;
61 } // namespace nacl_io
63 #endif // LIBRARIES_NACL_IO_HTML5FS_HTML5_FS_NODE_H_