revert r25271 which caused more problems than it tried to fix
[kugel-rb.git] / firmware / include / file.h
blob9a9548f8f6b4fe357240bee11dc377c1aff79511
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2002 by Björn Stenberg
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.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
22 #ifndef _FILE_H_
23 #define _FILE_H_
25 #include <sys/types.h>
27 #undef MAX_PATH /* this avoids problems when building simulator */
28 #define MAX_PATH 260
30 #define MAX_OPEN_FILES 11
32 #ifndef SEEK_SET
33 #define SEEK_SET 0
34 #endif
35 #ifndef SEEK_CUR
36 #define SEEK_CUR 1
37 #endif
38 #ifndef SEEK_END
39 #define SEEK_END 2
40 #endif
42 #ifndef O_RDONLY
43 #define O_RDONLY 0
44 #define O_WRONLY 1
45 #define O_RDWR 2
46 #define O_CREAT 4
47 #define O_APPEND 8
48 #define O_TRUNC 0x10
49 #endif
51 #if defined(SIMULATOR) && !defined(PLUGIN) && !defined(CODEC)
52 #define open(x,y) sim_open(x,y)
53 #define creat(x) sim_creat(x)
54 #define remove(x) sim_remove(x)
55 #define rename(x,y) sim_rename(x,y)
56 #define filesize(x) sim_filesize(x)
57 #define fsync(x) sim_fsync(x)
58 #define ftruncate(x,y) sim_ftruncate(x,y)
59 #define lseek(x,y,z) sim_lseek(x,y,z)
60 #define read(x,y,z) sim_read(x,y,z)
61 #define write(x,y,z) sim_write(x,y,z)
62 #define close(x) sim_close(x)
63 #endif
65 typedef int (*open_func)(const char* pathname, int flags);
66 typedef ssize_t (*read_func)(int fd, void *buf, size_t count);
67 typedef int (*creat_func)(const char *pathname);
68 typedef ssize_t (*write_func)(int fd, const void *buf, size_t count);
69 typedef void (*qsort_func)(void *base, size_t nmemb, size_t size,
70 int(*_compar)(const void *, const void *));
72 extern int open(const char* pathname, int flags);
73 extern int close(int fd);
74 extern int fsync(int fd);
75 extern ssize_t read(int fd, void *buf, size_t count);
76 extern off_t lseek(int fildes, off_t offset, int whence);
77 extern int creat(const char *pathname);
78 extern ssize_t write(int fd, const void *buf, size_t count);
79 extern int remove(const char* pathname);
80 extern int rename(const char* path, const char* newname);
81 extern int ftruncate(int fd, off_t length);
82 extern off_t filesize(int fd);
83 extern int release_files(int volume);
85 #endif