summaryrefslogtreecommitdiff
path: root/firmware/include/filesystem-native.h
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/include/filesystem-native.h')
-rw-r--r--firmware/include/filesystem-native.h107
1 files changed, 107 insertions, 0 deletions
diff --git a/firmware/include/filesystem-native.h b/firmware/include/filesystem-native.h
new file mode 100644
index 0000000000..640e179890
--- /dev/null
+++ b/firmware/include/filesystem-native.h
@@ -0,0 +1,107 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2002 by Björn Stenberg
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_NATIVE_H_
22#define _FILESYSTEM_NATIVE_H_
23
24#if defined(PLUGIN) || defined(CODEC)
25#define FILEFUNCTIONS_DECLARED
26#define FILEFUNCTIONS_DEFINED
27#define DIRFUNCTIONS_DECLARED
28#define DIRFUNCTIONS_DEFINED
29#endif /* PLUGIN || CODEC */
30
31#define FS_PREFIX(_x_) _x_
32#endif /* _FILESYSTEM_NATIVE_H_ */
33
34#ifdef _FILE_H_
35#ifndef _FILESYSTEM_NATIVE__FILE_H_
36#define _FILESYSTEM_NATIVE__FILE_H_
37
38#ifdef RB_FILESYSTEM_OS
39#define FILEFUNCTIONS_DEFINED
40#endif
41
42#ifndef FILEFUNCTIONS_DECLARED
43#define __OPEN_MODE_ARG
44#define __CREAT_MODE_ARG
45
46int open(const char *name, int oflag);
47int creat(const char *name);
48int close(int fildes);
49int ftruncate(int fildes, off_t length);
50int fsync(int fildes);
51off_t lseek(int fildes, off_t offset, int whence);
52ssize_t read(int fildes, void *buf, size_t nbyte);
53ssize_t write(int fildes, const void *buf, size_t nbyte);
54int remove(const char *path);
55int rename(const char *old, const char *new);
56off_t filesize(int fildes);
57int fsamefile(int fildes1, int fildes2);
58int relate(const char *path1, const char *path2);
59bool file_exists(const char *path);
60#endif /* !FILEFUNCTIONS_DECLARED */
61
62#if !defined(RB_FILESYSTEM_OS) && !defined (FILEFUNCTIONS_DEFINED)
63#define open(path, oflag, ...) open(path, oflag)
64#define creat(path, mode) creat(path)
65#endif /* FILEFUNCTIONS_DEFINED */
66
67#endif /* _FILESYSTEM_NATIVE__FILE_H_ */
68#endif /* _FILE_H_ */
69
70#ifdef _DIR_H_
71#ifndef _FILESYSTEM_NATIVE__DIR_H_
72#define _FILESYSTEM_NATIVE__DIR_H_
73
74#define DIRENT dirent
75struct dirent;
76
77struct dirinfo_native
78{
79 unsigned int attr;
80 off_t size;
81 uint16_t wrtdate;
82 uint16_t wrttime;
83};
84
85typedef struct {} DIR;
86
87#ifndef DIRFUNCTIONS_DECLARED
88#define __MKDIR_MODE_ARG
89
90#ifdef RB_FILESYSTEM_OS
91#define DIRFUNCTIONS_DEFINED
92#endif
93
94DIR * opendir(const char *dirname);
95struct dirent * readdir(DIR *dirp);
96int readdir_r(DIR *dirp, struct dirent *entry,
97 struct dirent **result);
98void rewinddir(DIR *dirp);
99int closedir(DIR *dirp);
100int mkdir(const char *path);
101int rmdir(const char *path);
102int samedir(DIR *dirp1, DIR *dirp2);
103bool dir_exists(const char *dirname);
104#endif /* !DIRFUNCTIONS_DECLARED */
105
106#endif /* _FILESYSTEM_NATIVE__DIR_H_ */
107#endif /* _DIR_H_ */