summaryrefslogtreecommitdiff
path: root/src/fs/virtfs
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-03-28 18:16:57 +0300
committerAndrei Karas <akaras@inbox.ru>2017-03-28 18:16:57 +0300
commit85f9c6a022a5a8c5b868fed9bd804811360d2e07 (patch)
tree6bc81873c809a2e580b33610f5d0cb07ac916a34 /src/fs/virtfs
parentdd941148547c6813f8df17f452f32feee7e09f81 (diff)
downloadmv-85f9c6a022a5a8c5b868fed9bd804811360d2e07.tar.gz
mv-85f9c6a022a5a8c5b868fed9bd804811360d2e07.tar.bz2
mv-85f9c6a022a5a8c5b868fed9bd804811360d2e07.tar.xz
mv-85f9c6a022a5a8c5b868fed9bd804811360d2e07.zip
Join fs/virfs.h and fs/virtfs/virtfs.h
Diffstat (limited to 'src/fs/virtfs')
-rw-r--r--src/fs/virtfs/virtfs.cpp3
-rw-r--r--src/fs/virtfs/virtfs.h53
-rw-r--r--src/fs/virtfs/virtfs_unittest.cc5
3 files changed, 53 insertions, 8 deletions
diff --git a/src/fs/virtfs/virtfs.cpp b/src/fs/virtfs/virtfs.cpp
index 36aab8eab..8718a9738 100644
--- a/src/fs/virtfs/virtfs.cpp
+++ b/src/fs/virtfs/virtfs.cpp
@@ -18,7 +18,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "fs/virtfs.h"
+#include "fs/virtfs/virtfs.h"
#include "fs/files.h"
#include "fs/paths.h"
@@ -27,7 +27,6 @@
#include "fs/virtlist.h"
#include "fs/virtfs/virtdirentry.h"
-#include "fs/virtfs/virtfs.h"
#include "fs/virtfs/virtfsdir.h"
#include "fs/virtfs/virtfszip.h"
#include "fs/virtfs/virtzipentry.h"
diff --git a/src/fs/virtfs/virtfs.h b/src/fs/virtfs/virtfs.h
index 408a54832..ed6b27a3d 100644
--- a/src/fs/virtfs/virtfs.h
+++ b/src/fs/virtfs/virtfs.h
@@ -18,8 +18,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef UTILS_FS_VIRTFS_VIRTFS_H
-#define UTILS_FS_VIRTFS_VIRTFS_H
+#ifndef FS_VIRTFS_H
+#define FS_VIRTFS_H
#include "enums/fs/fsentrytype.h"
@@ -30,10 +30,55 @@
#include <string>
#include <vector>
+struct VirtFile;
struct VirtFsEntry;
+struct VirtList;
namespace VirtFs
{
+ void init(const std::string &restrict name);
+ void updateDirSeparator();
+ const char *getDirSeparator();
+ const char *getBaseDir();
+ const char *getUserDir();
+ bool exists(std::string name);
+ VirtList *enumerateFiles(std::string dir) RETURNS_NONNULL;
+ bool isDirectory(std::string name);
+ bool isSymbolicLink(const std::string &restrict name);
+ void freeList(VirtList *restrict const handle);
+ VirtFile *openRead(std::string filename);
+ VirtFile *openWrite(std::string filename);
+ VirtFile *openAppend(std::string filename);
+ bool setWriteDir(const std::string &restrict newDir);
+ bool mountDir(std::string newDir,
+ const Append append);
+ bool mountDirSilent(std::string newDir,
+ const Append append);
+ bool unmountDir(std::string oldDir);
+ bool unmountDirSilent(std::string oldDir);
+ bool mountZip(std::string newDir,
+ const Append append);
+ bool unmountZip(std::string oldDir);
+ std::string getRealDir(std::string filename);
+ bool mkdir(const std::string &restrict dirName);
+ bool remove(const std::string &restrict filename);
+ bool deinit();
+ void permitLinks(const bool val);
+ int64_t read(VirtFile *restrict const handle,
+ void *restrict const buffer,
+ const uint32_t objSize,
+ const uint32_t objCount);
+ int64_t write(VirtFile *restrict const file,
+ const void *restrict const buffer,
+ const uint32_t objSize,
+ const uint32_t objCount);
+ int close(VirtFile *restrict const file);
+ int64_t fileLength(VirtFile *restrict const file);
+ int64_t tell(VirtFile *restrict const file);
+ int seek(VirtFile *restrict const file,
+ const uint64_t pos);
+ int eof(VirtFile *restrict const file);
+
bool mountDirInternal(const std::string &restrict newDir,
const Append append);
bool unmountDirInternal(std::string oldDir);
@@ -50,4 +95,6 @@ namespace VirtFs
#endif // UNITTESTS
} // namespace VirtFs
-#endif // UTILS_FS_VIRTFS_VIRTFS_H
+extern const char *dirSeparator;
+
+#endif // FS_VIRTFS_H
diff --git a/src/fs/virtfs/virtfs_unittest.cc b/src/fs/virtfs/virtfs_unittest.cc
index 1d5087e05..57031bd54 100644
--- a/src/fs/virtfs/virtfs_unittest.cc
+++ b/src/fs/virtfs/virtfs_unittest.cc
@@ -21,12 +21,11 @@
#include "catch.hpp"
#include "fs/files.h"
-#include "fs/virtfs.h"
-#include "fs/virtfstools.h"
-#include "fs/virtlist.h"
#include "fs/virtfs/virtdirentry.h"
#include "fs/virtfs/virtfs.h"
+#include "fs/virtfstools.h"
+#include "fs/virtlist.h"
#include "utils/checkutils.h"
#include "utils/delete2.h"