When setting a cache path also enable the cache implicitly.
[Rockbox.git] / firmware / include / dir_uncached.h
blob30ead756a3fd4e15eb26f75852dd0e7274673881
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id: dir.h 13741 2007-06-30 02:08:27Z jethead71 $
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 ****************************************************************************/
19 #ifndef _DIR_UNCACHED_H_
20 #define _DIR_UNCACHED_H_
22 #include <stdbool.h>
23 #include "file.h"
25 #define ATTR_READ_ONLY 0x01
26 #define ATTR_HIDDEN 0x02
27 #define ATTR_SYSTEM 0x04
28 #define ATTR_VOLUME_ID 0x08
29 #define ATTR_DIRECTORY 0x10
30 #define ATTR_ARCHIVE 0x20
31 #define ATTR_VOLUME 0x40 /* this is a volume, not a real directory */
33 #ifdef SIMULATOR
34 #define dirent_uncached sim_dirent
35 #define DIR_UNCACHED SIM_DIR
36 #define opendir_uncached sim_opendir
37 #define readdir_uncached sim_readdir
38 #define closedir_uncached sim_closedir
39 #define mkdir_uncached sim_mkdir
40 #define rmdir_uncached sim_rmdir
41 #endif
43 #ifndef DIRENT_DEFINED
45 struct dirent_uncached {
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 */
53 #endif
55 #include "fat.h"
57 typedef struct {
58 #ifndef SIMULATOR
59 bool busy;
60 long startcluster;
61 struct fat_dir fatdir;
62 struct fat_dir parent_dir;
63 struct dirent_uncached theent;
64 #ifdef HAVE_MULTIVOLUME
65 int volumecounter; /* running counter for faked volume entries */
66 #endif
67 #else
68 /* simulator: */
69 void *dir; /* actually a DIR* dir */
70 char *name;
71 #endif
72 } DIR_UNCACHED;
74 #ifdef HAVE_HOTSWAP
75 char *get_volume_name(int volume);
76 #endif
78 #ifdef HAVE_MULTIVOLUME
79 int strip_volume(const char*, char*);
80 #endif
82 #ifndef DIRFUNCTIONS_DEFINED
84 extern DIR_UNCACHED* opendir_uncached(const char* name);
85 extern int closedir_uncached(DIR_UNCACHED* dir);
86 extern int mkdir_uncached(const char* name);
87 extern int rmdir_uncached(const char* name);
89 extern struct dirent_uncached* readdir_uncached(DIR_UNCACHED* dir);
91 extern int release_dirs(int volume);
93 #endif /* DIRFUNCTIONS_DEFINED */
95 #endif