diff options
Diffstat (limited to 'firmware/target/hosted/filesystem-unix.h')
-rw-r--r-- | firmware/target/hosted/filesystem-unix.h | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/firmware/target/hosted/filesystem-unix.h b/firmware/target/hosted/filesystem-unix.h new file mode 100644 index 0000000000..a09712d8b0 --- /dev/null +++ b/firmware/target/hosted/filesystem-unix.h | |||
@@ -0,0 +1,82 @@ | |||
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_UNIX_H_ | ||
22 | #define _FILESYSTEM_UNIX_H_ | ||
23 | |||
24 | /* Include for file.h and dir.h because mkdir and friends may be here */ | ||
25 | #include <sys/stat.h> | ||
26 | |||
27 | #define strlcpy_from_os strlcpy | ||
28 | #endif | ||
29 | |||
30 | #ifdef _FILE_H_ | ||
31 | #ifndef _FILESYSTEM_UNIX__FILE_H_ | ||
32 | #define _FILESYSTEM_UNIX__FILE_H_ | ||
33 | |||
34 | #include <unistd.h> | ||
35 | |||
36 | #define OS_STAT_T struct stat | ||
37 | |||
38 | #ifndef OSFUNCTIONS_DECLARED | ||
39 | #define os_open open | ||
40 | #define os_creat creat | ||
41 | #define os_close close | ||
42 | #define os_lseek lseek | ||
43 | #define os_stat stat | ||
44 | #define os_fstat fstat | ||
45 | #define os_fstatat fstatat | ||
46 | #define os_lstat lstat | ||
47 | #define os_fsync fsync | ||
48 | #define os_ftruncate ftruncate | ||
49 | #define os_remove remove | ||
50 | #define os_rename rename | ||
51 | #define os_readlink readlink | ||
52 | #ifndef os_read | ||
53 | #define os_read read | ||
54 | #endif | ||
55 | #ifndef os_write | ||
56 | #define os_write write | ||
57 | #endif | ||
58 | #endif /* !OSFUNCTIONS_DECLARED */ | ||
59 | |||
60 | #endif /* _FILESYSTEM_UNIX__FILE_H_ */ | ||
61 | #endif /* _FILE_H_ */ | ||
62 | |||
63 | #ifdef _DIR_H_ | ||
64 | #ifndef _FILESYSTEM_UNIX__DIR_H_ | ||
65 | #define _FILESYSTEM_UNIX__DIR_H_ | ||
66 | |||
67 | #include <dirent.h> | ||
68 | |||
69 | #define OS_DIR_T DIR | ||
70 | #define OS_DIRENT_T struct dirent | ||
71 | |||
72 | #ifndef OSFUNCTIONS_DECLARED | ||
73 | #define os_opendir opendir | ||
74 | #define os_readdir readdir | ||
75 | #define os_closedir closedir | ||
76 | #define os_mkdir mkdir | ||
77 | #define os_rmdir rmdir | ||
78 | #define os_dirfd dirfd /* NOTE: might have to wrap on some platforms */ | ||
79 | #endif /* !OSFUNCTIONS_DECLARED */ | ||
80 | |||
81 | #endif /* _FILESYSTEM_UNIX__DIR_H_ */ | ||
82 | #endif /* _DIR_H_ */ | ||