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 | 5 |
6 #ifndef LIBRARIES_NACL_MOUNTS_MOUNT_NODE_H_ | 6 #ifndef LIBRARIES_NACL_MOUNTS_MOUNT_NODE_H_ |
7 #define LIBRARIES_NACL_MOUNTS_MOUNT_NODE_H_ | 7 #define LIBRARIES_NACL_MOUNTS_MOUNT_NODE_H_ |
8 | 8 |
9 #include <sys/stat.h> | 9 #include <sys/stat.h> |
10 | 10 |
11 #include <string> | 11 #include <string> |
12 #include "ref_object.h" | 12 #include "ref_object.h" |
13 | 13 |
14 struct dirent; | 14 struct dirent; |
15 struct stat; | 15 struct stat; |
16 class Mount; | 16 class Mount; |
17 class MountNode; | 17 class MountNode; |
18 | 18 |
19 class MountNode : public RefObject { | 19 class MountNode : public RefObject { |
20 protected: | 20 protected: |
21 virtual ~MountNode(); | 21 virtual ~MountNode(); |
22 | 22 |
23 protected: | 23 protected: |
24 MountNode(Mount* mount, int ino, int dev); | 24 MountNode(Mount* mount, int ino, int dev); |
25 virtual bool Init(int mode, short uid, short gid); | 25 virtual bool Init(int mode, short uid, short gid); |
26 virtual void Destroy(); | 26 virtual int Close(); |
27 | 27 |
28 public: | 28 public: |
29 // Normal OS operations on a node (file), can be called by the kernel | 29 // Normal OS operations on a node (file), can be called by the kernel |
30 // directly so it must lock and unlock appropriately. These functions | 30 // directly so it must lock and unlock appropriately. These functions |
31 // must not be called by the mount. | 31 // must not be called by the mount. |
32 virtual int FSync(); | 32 virtual int FSync(); |
33 virtual int GetDents(size_t offs, struct dirent* pdir, size_t count); | 33 virtual int GetDents(size_t offs, struct dirent* pdir, size_t count); |
34 virtual int GetStat(struct stat* stat); | 34 virtual int GetStat(struct stat* stat); |
35 virtual int Ioctl(int request, char* arg); | 35 virtual int Ioctl(int request, char* arg); |
36 virtual int Read(size_t offs, void* buf, size_t count); | 36 virtual int Read(size_t offs, void* buf, size_t count); |
(...skipping 11 matching lines...) Expand all Loading... |
48 protected: | 48 protected: |
49 // Directory operations on the node are done by the Mount. The mount's lock | 49 // Directory operations on the node are done by the Mount. The mount's lock |
50 // must be held while these calls are made. | 50 // must be held while these calls are made. |
51 | 51 |
52 // Adds or removes a directory entry updating the link numbers and refcount | 52 // Adds or removes a directory entry updating the link numbers and refcount |
53 virtual int AddChild(const std::string& name, MountNode *node); | 53 virtual int AddChild(const std::string& name, MountNode *node); |
54 virtual int RemoveChild(const std::string& name); | 54 virtual int RemoveChild(const std::string& name); |
55 | 55 |
56 // Find a child and return it without updating the refcount | 56 // Find a child and return it without updating the refcount |
57 virtual MountNode* FindChild(const std::string& name); | 57 virtual MountNode* FindChild(const std::string& name); |
| 58 virtual int ChildCount(); |
58 | 59 |
59 // Update the link count | 60 // Update the link count |
60 virtual void Link(); | 61 virtual void Link(); |
61 virtual void Unlink(); | 62 virtual void Unlink(); |
62 | 63 |
63 protected: | 64 protected: |
64 struct stat stat_; | 65 struct stat stat_; |
65 Mount* mount_; | 66 Mount* mount_; |
66 | 67 |
67 friend class Mount; | 68 friend class MountHFS; |
| 69 friend class MountMem; |
68 friend class MountNodeDir; | 70 friend class MountNodeDir; |
69 }; | 71 }; |
70 | 72 |
71 #endif // LIBRARIES_NACL_MOUNTS_MOUNT_NODE_H_ | 73 #endif // LIBRARIES_NACL_MOUNTS_MOUNT_NODE_H_ |
OLD | NEW |