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_MEMFS_MEM_FS_H_
6 #define LIBRARIES_NACL_IO_MEMFS_MEM_FS_H_
8 #include "nacl_io/filesystem.h"
9 #include "nacl_io/typed_fs_factory.h"
13 class MemFs
: public Filesystem
{
17 using Filesystem::Init
;
18 virtual Error
Init(const FsInitArgs
& args
);
20 // The protected functions are only used internally and will not
21 // acquire or release the filesystem's lock themselves. The caller is
22 // required to use correct locking as needed.
24 // Allocate or free an INODE number.
26 void FreeINO(int ino
);
28 // Find a Node specified node optionally failing if type does not match.
29 virtual Error
FindNode(const Path
& path
, int type
, ScopedNode
* out_node
);
32 virtual Error
OpenWithMode(const Path
& path
, int open_flags
, mode_t mode
,
33 ScopedNode
* out_node
);
34 virtual Error
Unlink(const Path
& path
);
35 virtual Error
Mkdir(const Path
& path
, int perm
);
36 virtual Error
Rmdir(const Path
& path
);
37 virtual Error
Remove(const Path
& path
);
38 virtual Error
Rename(const Path
& path
, const Path
& newpath
);
41 static const int REMOVE_DIR
= 1;
42 static const int REMOVE_FILE
= 2;
43 static const int REMOVE_ALL
= REMOVE_DIR
| REMOVE_FILE
;
45 Error
RemoveInternal(const Path
& path
, int remove_type
);
49 friend class TypedFsFactory
<MemFs
>;
50 DISALLOW_COPY_AND_ASSIGN(MemFs
);
53 } // namespace nacl_io
55 #endif // LIBRARIES_NACL_IO_MEMFS_MEM_FS_H_