Auto-detect binary in TTS / encoder setting dialog by searching $PATH. Only linux...
[Rockbox.git] / firmware / include / file.h
blob989f50a283fb70a9b1f960065d06fa3e0e4567f5
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2002 by Björn Stenberg
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
18 ****************************************************************************/
20 #ifndef _FILE_H_
21 #define _FILE_H_
23 #include <sys/types.h>
25 #undef MAX_PATH /* this avoids problems when building simulator */
26 #define MAX_PATH 260
28 #define MAX_OPEN_FILES 11
30 #ifndef SEEK_SET
31 #define SEEK_SET 0
32 #endif
33 #ifndef SEEK_CUR
34 #define SEEK_CUR 1
35 #endif
36 #ifndef SEEK_END
37 #define SEEK_END 2
38 #endif
40 #ifndef O_RDONLY
41 #define O_RDONLY 0
42 #define O_WRONLY 1
43 #define O_RDWR 2
44 #define O_CREAT 4
45 #define O_APPEND 8
46 #define O_TRUNC 0x10
47 #endif
49 #ifdef SIMULATOR
50 #define open(x,y) sim_open(x,y)
51 #define creat(x) sim_creat(x)
52 #define remove(x) sim_remove(x)
53 #define rename(x,y) sim_rename(x,y)
54 #define filesize(x) sim_filesize(x)
55 #define fsync(x) sim_fsync(x)
56 #define ftruncate(x,y) sim_ftruncate(x,y)
57 #define lseek(x,y,z) sim_lseek(x,y,z)
58 #endif
60 typedef int (*open_func)(const char* pathname, int flags);
61 typedef ssize_t (*read_func)(int fd, void *buf, size_t count);
62 typedef int (*creat_func)(const char *pathname);
63 typedef ssize_t (*write_func)(int fd, const void *buf, size_t count);
64 typedef void (*qsort_func)(void *base, size_t nmemb, size_t size,
65 int(*_compar)(const void *, const void *));
67 extern int open(const char* pathname, int flags);
68 extern int close(int fd);
69 extern int fsync(int fd);
70 extern ssize_t read(int fd, void *buf, size_t count);
71 extern off_t lseek(int fildes, off_t offset, int whence);
72 extern int creat(const char *pathname);
73 extern ssize_t write(int fd, const void *buf, size_t count);
74 extern int remove(const char* pathname);
75 extern int rename(const char* path, const char* newname);
76 extern int ftruncate(int fd, off_t length);
77 extern off_t filesize(int fd);
78 extern int release_files(int volume);
80 #endif