Index: native_client_sdk/src/libraries/nacl_io/mount_node.h |
diff --git a/native_client_sdk/src/libraries/nacl_io/mount_node.h b/native_client_sdk/src/libraries/nacl_io/mount_node.h |
index 36a937e5fbbb23fea914676a1b3f00d02a9926f7..c3e8bb5965c12d31c0ccb6a0c0ecc2e74be828fc 100644 |
--- a/native_client_sdk/src/libraries/nacl_io/mount_node.h |
+++ b/native_client_sdk/src/libraries/nacl_io/mount_node.h |
@@ -7,6 +7,7 @@ |
#include <string> |
+#include "nacl_io/error.h" |
#include "nacl_io/osstat.h" |
#include "utils/ref_object.h" |
@@ -21,27 +22,37 @@ class MountNode : public RefObject { |
protected: |
// Initialize with node specific flags, in this case stat permissions. |
- virtual bool Init(int flags); |
+ virtual Error Init(int flags); |
virtual void Destroy(); |
public: |
// Normal OS operations on a node (file), can be called by the kernel |
// directly so it must lock and unlock appropriately. These functions |
// must not be called by the mount. |
- virtual int FSync(); |
- virtual int FTruncate(off_t length); |
- virtual int GetDents(size_t offs, struct dirent* pdir, size_t count); |
- virtual int GetStat(struct stat* stat); |
- virtual int Ioctl(int request, char* arg); |
- virtual int Read(size_t offs, void* buf, size_t count); |
- virtual int Write(size_t offs, const void* buf, size_t count); |
- virtual void* MMap(void* addr, size_t length, int prot, int flags, |
- size_t offset); |
+ virtual Error FSync(); |
+ virtual Error FTruncate(off_t length); |
+ virtual Error GetDents(size_t offs, |
+ struct dirent* pdir, |
+ size_t count, |
+ int* out_bytes); |
+ virtual Error GetStat(struct stat* stat); |
+ virtual Error Ioctl(int request, char* arg); |
+ virtual Error Read(size_t offs, void* buf, size_t count, int* out_bytes); |
+ virtual Error Write(size_t offs, |
+ const void* buf, |
+ size_t count, |
+ int* out_bytes); |
+ virtual Error MMap(void* addr, |
+ size_t length, |
+ int prot, |
+ int flags, |
+ size_t offset, |
+ void** out_addr); |
virtual int GetLinks(); |
virtual int GetMode(); |
virtual int GetType(); |
- virtual size_t GetSize(); |
+ virtual Error GetSize(size_t *out_size); |
virtual bool IsaDir(); |
virtual bool IsaFile(); |
virtual bool IsaTTY(); |
@@ -51,18 +62,18 @@ class MountNode : public RefObject { |
// must be held while these calls are made. |
// Adds or removes a directory entry updating the link numbers and refcount |
- virtual int AddChild(const std::string& name, MountNode *node); |
- virtual int RemoveChild(const std::string& name); |
+ virtual Error AddChild(const std::string& name, MountNode* node); |
+ virtual Error RemoveChild(const std::string& name); |
// Find a child and return it without updating the refcount |
- virtual MountNode* FindChild(const std::string& name); |
+ virtual Error FindChild(const std::string& name, MountNode** out_node); |
virtual int ChildCount(); |
// Update the link count |
virtual void Link(); |
virtual void Unlink(); |
-protected: |
+ protected: |
struct stat stat_; |
Mount* mount_; |