summaryrefslogtreecommitdiff
path: root/uisimulator/common/filesystem-sim.h
diff options
context:
space:
mode:
Diffstat (limited to 'uisimulator/common/filesystem-sim.h')
-rw-r--r--uisimulator/common/filesystem-sim.h108
1 files changed, 108 insertions, 0 deletions
diff --git a/uisimulator/common/filesystem-sim.h b/uisimulator/common/filesystem-sim.h
new file mode 100644
index 0000000000..7c46c449d8
--- /dev/null
+++ b/uisimulator/common/filesystem-sim.h
@@ -0,0 +1,108 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2014 by Michael Sevakis
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21#ifndef _FILESYSTEM_SIM_H_
22#define _FILESYSTEM_SIM_H_
23
24#if defined(PLUGIN) || defined(CODEC)
25/* Prevent often-problematic plugin namespace pollution */
26#define FILEFUNCTIONS_DECLARED
27#define FILEFUNCTIONS_DEFINED
28#define DIRFUNCTIONS_DECLARED
29#define DIRFUNCTIONS_DEFINED
30#define OSFUNCTIONS_DECLARED
31#endif /* PLUGIN || CODEC */
32
33#ifndef OSFUNCTIONS_DECLARED
34#define FS_PREFIX(_x_) sim_ ## _x_
35
36/* path sandboxing and volume redirector */
37int sim_get_os_path(char *buffer, const char *path, size_t bufsize);
38#define SIM_TMPBUF_MAX_PATH (MAX_PATH+1)
39
40#endif /* !OSFUNCTIONS_DECLARED */
41
42#endif /* _FILESYSTEM_SIM_H_ */
43
44#include "filesystem-sdl.h"
45#ifdef WIN32
46#include "filesystem-win32.h"
47#else /* !WIN32 */
48#include "filesystem-unix.h"
49#endif /* WIN32 */
50#include "filesystem-hosted.h"
51
52#ifdef _FILE_H_
53#ifndef _FILESYSTEM_SIM_H__FILE_H_
54#define _FILESYSTEM_SIM_H__FILE_H_
55
56#ifdef RB_FILESYSTEM_OS
57#define FILEFUNCTIONS_DEFINED
58#endif
59
60#ifndef FILEFUNCTIONS_DECLARED
61int sim_open(const char *name, int oflag, ...);
62int sim_creat(const char *name, mode_t mode);
63int sim_close(int fildes);
64int sim_ftruncate(int fildes, off_t length);
65int sim_fsync(int fildes);
66off_t sim_lseek(int fildes, off_t offset, int whence);
67ssize_t sim_read(int fildes, void *buf, size_t nbyte);
68ssize_t sim_write(int fildes, const void *buf, size_t nbyte);
69int sim_remove(const char *path);
70int sim_rename(const char *old, const char *new);
71off_t sim_filesize(int fildes);
72int sim_fsamefile(int fildes1, int fildes2);
73int sim_relate(const char *path1, const char *path2);
74bool sim_file_exists(const char *path);
75#endif /* !FILEFUNCTIONS_DECLARED */
76
77#endif /* _FILESYSTEM_SIM_H__FILE_H_ */
78#endif /* _FILE_H_ */
79
80#ifdef _DIR_H_
81#ifndef _FILESYSTEM_SIM_H__DIR_H_
82#define _FILESYSTEM_SIM_H__DIR_H_
83
84#ifdef RB_FILESYSTEM_OS
85#define DIRFUNCTIONS_DEFINED
86#else
87#define dirent DIRENT
88#endif
89
90#define DIRENT sim_dirent
91
92struct dirinfo_native
93{
94 void *osdirent;
95};
96
97#ifndef DIRFUNCTIONS_DECLARED
98DIR * sim_opendir(const char *dirname);
99struct sim_dirent * sim_readdir(DIR *dirp);
100int sim_closedir(DIR *dirp);
101int sim_mkdir(const char *path);
102int sim_rmdir(const char *path);
103int sim_samedir(DIR *dirp1, DIR *dirp2);
104bool sim_dir_exists(const char *dirname);
105#endif /* !DIRFUNCTIONS_DECLARED */
106
107#endif /* _FILESYSTEM_SIM_H__DIR_H_ */
108#endif /* _DIR_H_ */