rk27generic: Disable plugins.
[maemo-rb.git] / firmware / include / file.h
blob198fccbc7b427a61cd046070e1d713889f8ac0cb
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>
26 #include "config.h"
27 #include "gcc_extensions.h"
28 #include <fcntl.h>
29 #ifdef WIN32
30 /* this has SEEK_SET et al */
31 #include <stdio.h>
32 #endif
35 #undef MAX_PATH /* this avoids problems when building simulator */
36 #define MAX_PATH 260
37 #define MAX_OPEN_FILES 11
39 #if !defined(PLUGIN) && !defined(CODEC)
40 #if defined(APPLICATION) && !defined(__PCTOOL__)
41 # define open(x, ...) app_open(x, __VA_ARGS__)
42 # define creat(x,m) app_creat(x, m)
43 # define remove(x) app_remove(x)
44 # define rename(x,y) app_rename(x,y)
45 extern int app_open(const char *name, int o, ...);
46 extern int app_creat(const char *name, mode_t mode);
47 extern int app_remove(const char* pathname);
48 extern int app_rename(const char* path, const char* newname);
49 # if (CONFIG_PLATFORM & (PLATFORM_SDL|PLATFORM_MAEMO|PLATFORM_PANDORA))
50 # define fsync(x) sim_fsync(x)
51 # define ftruncate(x,y) sim_ftruncate(x,y)
52 # define lseek(x,y,z) sim_lseek(x,y,z)
53 # define read(x,y,z) sim_read(x,y,z)
54 # define write(x,y,z) sim_write(x,y,z)
55 # define close(x) sim_close(x)
56 # endif
57 #elif defined(SIMULATOR)
58 # define open(x, ...) sim_open(x, __VA_ARGS__)
59 # define creat(x,m) sim_creat(x,m)
60 # define remove(x) sim_remove(x)
61 # define rename(x,y) sim_rename(x,y)
62 # define fsync(x) sim_fsync(x)
63 # define ftruncate(x,y) sim_ftruncate(x,y)
64 # define lseek(x,y,z) sim_lseek(x,y,z)
65 # define read(x,y,z) sim_read(x,y,z)
66 # define write(x,y,z) sim_write(x,y,z)
67 # define close(x) sim_close(x)
68 extern int sim_open(const char *name, int o, ...);
69 extern int sim_creat(const char *name, mode_t mode);
70 #endif
72 typedef int (*open_func)(const char* pathname, int flags, ...);
73 typedef ssize_t (*read_func)(int fd, void *buf, size_t count);
74 typedef int (*creat_func)(const char *pathname, mode_t mode);
75 typedef ssize_t (*write_func)(int fd, const void *buf, size_t count);
76 typedef void (*qsort_func)(void *base, size_t nmemb, size_t size,
77 int(*_compar)(const void *, const void *));
79 extern int file_open(const char* pathname, int flags);
80 extern int close(int fd);
81 extern int fsync(int fd);
82 extern ssize_t read(int fd, void *buf, size_t count);
83 extern off_t lseek(int fildes, off_t offset, int whence);
84 extern int file_creat(const char *pathname);
85 #if (CONFIG_PLATFORM & PLATFORM_NATIVE) && !defined(__PCTOOL__)
86 /* posix compatibility function */
87 static inline int creat(const char *pathname, mode_t mode)
89 (void)mode;
90 return file_creat(pathname);
92 #if !defined(CODEC) && !defined(PLUGIN)
93 #define open(x, y, ...) file_open(x,y)
94 #endif
95 #endif
96 extern ssize_t write(int fd, const void *buf, size_t count);
97 extern int remove(const char* pathname);
98 extern int rename(const char* path, const char* newname);
99 extern int ftruncate(int fd, off_t length);
100 extern off_t filesize(int fd);
101 extern int release_files(int volume);
102 int fdprintf (int fd, const char *fmt, ...) ATTRIBUTE_PRINTF(2, 3);
103 #endif /* !CODEC && !PLUGIN */
104 #endif