summaryrefslogtreecommitdiff
path: root/firmware/include/dir.h
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/include/dir.h')
-rw-r--r--firmware/include/dir.h88
1 files changed, 21 insertions, 67 deletions
diff --git a/firmware/include/dir.h b/firmware/include/dir.h
index 020b24a502..8778d0be02 100644
--- a/firmware/include/dir.h
+++ b/firmware/include/dir.h
@@ -7,7 +7,7 @@
7 * \/ \/ \/ \/ \/ 7 * \/ \/ \/ \/ \/
8 * $Id$ 8 * $Id$
9 * 9 *
10 * Copyright (C) 2002 by Björn Stenberg 10 * Copyright (C) 2007 by Kévin Ferrare
11 * 11 *
12 * All files in this archive are subject to the GNU General Public License. 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. 13 * See the file COPYING in the source tree root for full license agreement.
@@ -16,76 +16,30 @@
16 * KIND, either express or implied. 16 * KIND, either express or implied.
17 * 17 *
18 ****************************************************************************/ 18 ****************************************************************************/
19
19#ifndef _DIR_H_ 20#ifndef _DIR_H_
20#define _DIR_H_ 21#define _DIR_H_
21 22
22#include <stdbool.h> 23#ifdef HAVE_DIRCACHE
23#include "file.h" 24# include "dircache.h"
24 25# define DIR DIR_CACHED
25#define ATTR_READ_ONLY 0x01 26# define dirent dircache_entry
26#define ATTR_HIDDEN 0x02 27# define opendir opendir_cached
27#define ATTR_SYSTEM 0x04 28# define closedir closedir_cached
28#define ATTR_VOLUME_ID 0x08 29# define readdir readdir_cached
29#define ATTR_DIRECTORY 0x10 30# define closedir closedir_cached
30#define ATTR_ARCHIVE 0x20 31# define mkdir mkdir_cached
31#define ATTR_VOLUME 0x40 /* this is a volume, not a real directory */ 32# define rmdir rmdir_cached
32
33#ifdef SIMULATOR
34#define dirent sim_dirent
35#define DIR SIM_DIR
36#define opendir(x) sim_opendir(x)
37#define readdir(x) sim_readdir(x)
38#define closedir(x) sim_closedir(x)
39#define mkdir(x) sim_mkdir(x)
40#define rmdir(x) sim_rmdir(x)
41#endif
42
43#ifndef DIRENT_DEFINED
44
45struct dirent {
46 unsigned char d_name[MAX_PATH];
47 int attribute;
48 long size;
49 long startcluster;
50 unsigned short wrtdate; /* Last write date */
51 unsigned short wrttime; /* Last write time */
52};
53#endif
54
55#include "fat.h"
56
57typedef struct {
58#ifndef SIMULATOR
59 bool busy;
60 long startcluster;
61 struct fat_dir fatdir;
62 struct fat_dir parent_dir;
63 struct dirent theent;
64#ifdef HAVE_MULTIVOLUME
65 int volumecounter; /* running counter for faked volume entries */
66#endif
67#else 33#else
68 /* simulator: */ 34#include "dir_uncached.h"
69 void *dir; /* actually a DIR* dir */ 35# define DIR DIR_UNCACHED
70 char *name; 36# define dirent dirent_uncached
71#endif 37# define opendir opendir_uncached
72} DIR; 38# define closedir closedir_uncached
73 39# define readdir readdir_uncached
74#ifdef HAVE_HOTSWAP 40# define closedir closedir_uncached
75char *get_volume_name(int volume); 41# define mkdir mkdir_uncached
42# define rmdir rmdir_uncached
76#endif 43#endif
77 44
78#ifndef DIRFUNCTIONS_DEFINED
79
80extern DIR* opendir(const char* name);
81extern int closedir(DIR* dir);
82extern int mkdir(const char* name);
83extern int rmdir(const char* name);
84
85extern struct dirent* readdir(DIR* dir);
86
87extern int release_dirs(int volume);
88
89#endif /* DIRFUNCTIONS_DEFINED */
90
91#endif 45#endif