summaryrefslogtreecommitdiffstats
path: root/firmware/include/dir.h
blob: 4599877ede764e005d99d5cb862e7916924c2f41 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
/***************************************************************************
 *             __________               __   ___.
 *   Open      \______   \ ____   ____ |  | _\_ |__   _______  ___
 *   Source     |       _//  _ \_/ ___\|  |/ /| __ \ /  _ \  \/  /
 *   Jukebox    |    |   (  <_> )  \___|    < | \_\ (  <_> > <  <
 *   Firmware   |____|_  /\____/ \___  >__|_ \|___  /\____/__/\_ \
 *                     \/            \/     \/    \/            \/
 * $Id$
 *
 * Copyright (C) 2007 by Kévin Ferrare
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
 * KIND, either express or implied.
 *
 ****************************************************************************/
#ifndef _DIR_H_
#define _DIR_H_

#include <sys/types.h>
#include <fcntl.h>
#include <time.h>
#include "config.h"
#include "fs_attr.h"

#if defined (APPLICATION) || defined(CHECKWPS)
#include "filesystem-app.h"
#elif defined(SIMULATOR) || defined(DBTOOL)
#include "../../uisimulator/common/filesystem-sim.h"
#else
#include "filesystem-native.h"
#endif

#ifndef DIRFUNCTIONS_DEFINED
#ifndef opendir
#define opendir         FS_PREFIX(opendir)
#endif
#ifndef readdir
#define readdir         FS_PREFIX(readdir)
#endif
#ifndef readdir_r
#define readdir_r       FS_PREFIX(readdir_r)
#endif
#ifndef rewinddir
#define rewinddir       FS_PREFIX(rewinddir)
#endif
#ifndef closedir
#define closedir        FS_PREFIX(closedir)
#endif
#ifndef mkdir
#define mkdir           FS_PREFIX(mkdir)
#endif
#ifndef rmdir
#define rmdir           FS_PREFIX(rmdir)
#endif
#ifndef samedir
#define samedir         FS_PREFIX(samedir)
#endif
#ifndef dir_exists
#define dir_exists      FS_PREFIX(dir_exists)
#endif
#ifndef root_realpath
#define root_realpath      FS_PREFIX(root_realpath)
#endif
#endif /* !DIRFUNCTIONS_DEFINED */

#ifndef DIRENT_DEFINED
struct DIRENT
{
    struct dirinfo_native info; /* platform extra info */
    char d_name[MAX_PATH];      /* UTF-8 name of entry (last!) */
};
#endif /* DIRENT_DEFINED */

struct dirinfo
{
    unsigned int attribute; /* attribute bits of file */
    off_t        size;      /* binary size of file */
    time_t       mtime;     /* local file time */
};

#ifndef DIRFUNCTIONS_DECLARED
/* TIP: set errno to zero before calling to see if anything failed */
struct dirinfo dir_get_info(DIR *dirp, struct DIRENT *entry);
const char* root_realpath(void);
#endif /* !DIRFUNCTIONS_DECLARED */



#endif /* _DIR_H_ */