Unify the way functions are called from menus.
[Rockbox.git] / firmware / include / dir.h
blobc354082becac4965ccccc26d71bce7739df37381
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 ****************************************************************************/
19 #ifndef _DIR_H_
20 #define _DIR_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 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
43 #ifndef DIRENT_DEFINED
45 struct 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 */
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 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;
74 #ifndef DIRFUNCTIONS_DEFINED
76 extern DIR* opendir(const char* name);
77 extern int closedir(DIR* dir);
78 extern int mkdir(const char* name);
79 extern int rmdir(const char* name);
81 extern struct dirent* readdir(DIR* dir);
83 extern int release_dirs(int volume);
85 #endif /* DIRFUNCTIONS_DEFINED */
87 #endif