When setting a cache path also enable the cache implicitly.
[Rockbox.git] / firmware / include / file.h
blob0cc272044e3ca99510c2c5f22cfe25fed5af4cbb
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 #define read(x,y,z) sim_read(x,y,z)
59 #define write(x,y,z) sim_write(x,y,z)
60 #define close(x) sim_close(x)
61 #endif
63 typedef int (*open_func)(const char* pathname, int flags);
64 typedef ssize_t (*read_func)(int fd, void *buf, size_t count);
65 typedef int (*creat_func)(const char *pathname);
66 typedef ssize_t (*write_func)(int fd, const void *buf, size_t count);
67 typedef void (*qsort_func)(void *base, size_t nmemb, size_t size,
68 int(*_compar)(const void *, const void *));
70 extern int open(const char* pathname, int flags);
71 extern int close(int fd);
72 extern int fsync(int fd);
73 extern ssize_t read(int fd, void *buf, size_t count);
74 extern off_t lseek(int fildes, off_t offset, int whence);
75 extern int creat(const char *pathname);
76 extern ssize_t write(int fd, const void *buf, size_t count);
77 extern int remove(const char* pathname);
78 extern int rename(const char* path, const char* newname);
79 extern int ftruncate(int fd, off_t length);
80 extern off_t filesize(int fd);
81 extern int release_files(int volume);
83 #endif