Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(76)

Side by Side Diff: native_client_sdk/src/libraries/nacl_io/mount_mem.h

Issue 16232016: [NaCl SDK] nacl_io: big refactor to return error value (errno). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: feedback Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_MEM_H_ 5 #ifndef LIBRARIES_NACL_IO_MOUNT_MEM_H_
6 #define LIBRARIES_NACL_IO_MOUNT_MEM_H_ 6 #define LIBRARIES_NACL_IO_MOUNT_MEM_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 10
11 #include "nacl_io/mount.h" 11 #include "nacl_io/mount.h"
12 12
13 class MountMem : public Mount { 13 class MountMem : public Mount {
14 protected: 14 protected:
15 MountMem(); 15 MountMem();
16 16
17 virtual bool Init(int dev, StringMap_t& args, PepperInterface* ppapi); 17 virtual Error Init(int dev, StringMap_t& args, PepperInterface* ppapi);
18 virtual void Destroy(); 18 virtual void Destroy();
19 19
20 // The protected functions are only used internally and will not 20 // The protected functions are only used internally and will not
21 // acquire or release the mount's lock themselves. The caller is 21 // acquire or release the mount's lock themselves. The caller is
22 // required to use correct locking as needed. 22 // required to use correct locking as needed.
23 MountNode *AllocateData(int mode);
24 MountNode *AllocatePath(int mode);
25 23
26 // Allocate or free an INODE number. 24 // Allocate or free an INODE number.
27 int AllocateINO(); 25 int AllocateINO();
28 void FreeINO(int ino); 26 void FreeINO(int ino);
29 27
30 // Find a Node specified node optionally failing if type does not match. 28 // Find a Node specified node optionally failing if type does not match.
31 virtual MountNode* FindNode(const Path& path, int type = 0); 29 virtual Error FindNode(const Path& path, int type, MountNode** out_node);
32 30
33 public: 31 public:
34 virtual MountNode *Open(const Path& path, int mode); 32 virtual Error Open(const Path& path, int mode, MountNode** out_node);
35 virtual int Unlink(const Path& path); 33 virtual Error Unlink(const Path& path);
36 virtual int Mkdir(const Path& path, int perm); 34 virtual Error Mkdir(const Path& path, int perm);
37 virtual int Rmdir(const Path& path); 35 virtual Error Rmdir(const Path& path);
38 virtual int Remove(const Path& path); 36 virtual Error Remove(const Path& path);
39 37
40 private: 38 private:
41 static const int REMOVE_DIR = 1; 39 static const int REMOVE_DIR = 1;
42 static const int REMOVE_FILE = 2; 40 static const int REMOVE_FILE = 2;
43 static const int REMOVE_ALL = REMOVE_DIR | REMOVE_FILE; 41 static const int REMOVE_ALL = REMOVE_DIR | REMOVE_FILE;
44 42
45 int RemoveInternal(const Path& path, int remove_type); 43 Error RemoveInternal(const Path& path, int remove_type);
46 44
47 MountNode* root_; 45 MountNode* root_;
48 size_t max_ino_; 46 size_t max_ino_;
49 47
50 friend class Mount; 48 friend class Mount;
51 DISALLOW_COPY_AND_ASSIGN(MountMem); 49 DISALLOW_COPY_AND_ASSIGN(MountMem);
52 }; 50 };
53 51
54 #endif // LIBRARIES_NACL_IO_MOUNT_MEM_H_ 52 #endif // LIBRARIES_NACL_IO_MOUNT_MEM_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698