Index: embios/trunk/dir.c |
— | — | @@ -18,15 +18,14 @@ |
19 | 19 | * KIND, either express or implied. |
20 | 20 | * |
21 | 21 | ****************************************************************************/ |
| 22 | +#include "global.h" |
22 | 23 | #include <stdio.h> |
23 | 24 | #include <errno.h> |
24 | 25 | #include <string.h> |
25 | | -#include <stdbool.h> |
26 | 26 | #include <stdlib.h> |
27 | 27 | #include "fat.h" |
28 | 28 | #include "dir.h" |
29 | 29 | #include "debug.h" |
30 | | -#include "filefuncs.h" |
31 | 30 | |
32 | 31 | #if ((defined(MEMORYSIZE) && (MEMORYSIZE > 8)) || MEM > 8) |
33 | 32 | #define MAX_OPEN_DIRS 12 |
Index: embios/trunk/file.c |
— | — | @@ -25,8 +25,6 @@ |
26 | 26 | #include "fat.h" |
27 | 27 | #include "dir.h" |
28 | 28 | #include "debug.h" |
29 | | -#include "filefuncs.h" |
30 | | -#include "gcc_extensions.h"
|
31 | 29 | |
32 | 30 | /* |
33 | 31 | These functions provide a roughly POSIX-compatible file IO API. |
Index: embios/trunk/dir.h |
— | — | @@ -40,7 +40,6 @@ |
41 | 41 | unsigned short wrtdate; /* Last write date */ |
42 | 42 | unsigned short wrttime; /* Last write time */ |
43 | 43 | }; |
44 | | -#endif |
45 | 44 | |
46 | 45 | #include "fat.h" |
47 | 46 | |
— | — | @@ -48,7 +47,7 @@ |
49 | 48 | bool busy; |
50 | 49 | long startcluster; |
51 | 50 | struct fat_dir fatdir; |
52 | | - struct dirent_uncached theent; |
| 51 | + struct dirent theent; |
53 | 52 | #ifdef HAVE_MULTIVOLUME |
54 | 53 | int volumecounter; /* running counter for faked volume entries */ |
55 | 54 | #endif |
— | — | @@ -71,6 +70,4 @@ |
72 | 71 | |
73 | 72 | extern int release_dirs(int volume); |
74 | 73 | |
75 | | -#endif /* DIRFUNCTIONS_DEFINED */ |
76 | | - |
77 | | -#endif |
| 74 | +#endif |
\ No newline at end of file |
Index: embios/trunk/file.h |
— | — | @@ -1,81 +1,81 @@ |
2 | | -/*************************************************************************** |
3 | | - * __________ __ ___. |
4 | | - * Open \______ \ ____ ____ | | _\_ |__ _______ ___ |
5 | | - * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / |
6 | | - * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < |
7 | | - * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ |
8 | | - * \/ \/ \/ \/ \/ |
9 | | - * $Id: file.h 25856 2010-05-06 22:17:34Z kugel $ |
10 | | - * |
11 | | - * Copyright (C) 2002 by Björn Stenberg |
12 | | - * |
13 | | - * This program is free software; you can redistribute it and/or |
14 | | - * modify it under the terms of the GNU General Public License |
15 | | - * as published by the Free Software Foundation; either version 2 |
16 | | - * of the License, or (at your option) any later version. |
17 | | - * |
18 | | - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY |
19 | | - * KIND, either express or implied. |
20 | | - * |
21 | | - ****************************************************************************/ |
22 | | - |
23 | | -#ifndef _FILE_H_ |
24 | | -#define _FILE_H_ |
25 | | - |
26 | | -#define MAX_PATH 260 |
27 | | - |
28 | | -#include <sys/types.h> |
29 | | -#include "_ansi.h" |
30 | | - |
31 | | -#define MAX_OPEN_FILES 11 |
32 | | - |
33 | | -#ifndef SEEK_SET |
34 | | -#define SEEK_SET 0 |
35 | | -#endif |
36 | | -#ifndef SEEK_CUR |
37 | | -#define SEEK_CUR 1 |
38 | | -#endif |
39 | | -#ifndef SEEK_END |
40 | | -#define SEEK_END 2 |
41 | | -#endif |
42 | | - |
43 | | -#ifndef O_RDONLY |
44 | | -#define O_RDONLY 0 |
45 | | -#define O_WRONLY 1 |
46 | | -#define O_RDWR 2 |
47 | | -#define O_CREAT 4 |
48 | | -#define O_APPEND 8 |
49 | | -#define O_TRUNC 0x10 |
50 | | -#endif |
51 | | - |
52 | | -typedef int (*open_func)(const char* pathname, int flags, ...); |
53 | | -typedef ssize_t (*read_func)(int fd, void *buf, size_t count); |
54 | | -typedef int (*creat_func)(const char *pathname, mode_t mode); |
55 | | -typedef ssize_t (*write_func)(int fd, const void *buf, size_t count); |
56 | | -typedef void (*qsort_func)(void *base, size_t nmemb, size_t size, |
57 | | - int(*_compar)(const void *, const void *)); |
58 | | - |
59 | | -extern int file_open(const char* pathname, int flags); |
60 | | -extern int close(int fd); |
61 | | -extern int fsync(int fd); |
62 | | -extern ssize_t read(int fd, void *buf, size_t count); |
63 | | -extern off_t lseek(int fildes, off_t offset, int whence); |
64 | | -extern int file_creat(const char *pathname); |
65 | | - |
66 | | -/* posix compatibility function */ |
67 | | -static inline int creat(const char *pathname, mode_t mode) |
68 | | -{ |
69 | | - (void)mode; |
70 | | - return file_creat(pathname); |
71 | | -} |
72 | | - |
73 | | -#define open(x, y, ...) file_open(x,y) |
74 | | - |
75 | | -extern ssize_t write(int fd, const void *buf, size_t count); |
76 | | -extern int remove(const char* pathname); |
77 | | -extern int rename(const char* path, const char* newname); |
78 | | -extern int ftruncate(int fd, off_t length); |
79 | | -extern off_t filesize(int fd); |
80 | | -extern int release_files(int volume); |
81 | | -int fdprintf (int fd, const char *fmt, ...) ATTRIBUTE_PRINTF(2, 3); |
82 | | -#endif |
| 2 | +/***************************************************************************
|
| 3 | + * __________ __ ___.
|
| 4 | + * Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
| 5 | + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
| 6 | + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
| 7 | + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
| 8 | + * \/ \/ \/ \/ \/
|
| 9 | + * $Id: file.h 25856 2010-05-06 22:17:34Z kugel $
|
| 10 | + *
|
| 11 | + * Copyright (C) 2002 by Björn Stenberg
|
| 12 | + *
|
| 13 | + * This program is free software; you can redistribute it and/or
|
| 14 | + * modify it under the terms of the GNU General Public License
|
| 15 | + * as published by the Free Software Foundation; either version 2
|
| 16 | + * of the License, or (at your option) any later version.
|
| 17 | + *
|
| 18 | + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
| 19 | + * KIND, either express or implied.
|
| 20 | + *
|
| 21 | + ****************************************************************************/
|
| 22 | +
|
| 23 | +#ifndef _FILE_H_
|
| 24 | +#define _FILE_H_
|
| 25 | +
|
| 26 | +#define MAX_PATH 260
|
| 27 | +
|
| 28 | +#include <sys/types.h>
|
| 29 | +#include "gcc_extensions.h"
|
| 30 | +
|
| 31 | +#define MAX_OPEN_FILES 11
|
| 32 | +
|
| 33 | +#ifndef SEEK_SET
|
| 34 | +#define SEEK_SET 0
|
| 35 | +#endif
|
| 36 | +#ifndef SEEK_CUR
|
| 37 | +#define SEEK_CUR 1
|
| 38 | +#endif
|
| 39 | +#ifndef SEEK_END
|
| 40 | +#define SEEK_END 2
|
| 41 | +#endif
|
| 42 | +
|
| 43 | +#ifndef O_RDONLY
|
| 44 | +#define O_RDONLY 0
|
| 45 | +#define O_WRONLY 1
|
| 46 | +#define O_RDWR 2
|
| 47 | +#define O_CREAT 4
|
| 48 | +#define O_APPEND 8
|
| 49 | +#define O_TRUNC 0x10
|
| 50 | +#endif
|
| 51 | +
|
| 52 | +typedef int (*open_func)(const char* pathname, int flags, ...);
|
| 53 | +typedef ssize_t (*read_func)(int fd, void *buf, size_t count);
|
| 54 | +typedef int (*creat_func)(const char *pathname, mode_t mode);
|
| 55 | +typedef ssize_t (*write_func)(int fd, const void *buf, size_t count);
|
| 56 | +typedef void (*qsort_func)(void *base, size_t nmemb, size_t size,
|
| 57 | + int(*_compar)(const void *, const void *));
|
| 58 | +
|
| 59 | +extern int file_open(const char* pathname, int flags);
|
| 60 | +extern int close(int fd);
|
| 61 | +extern int fsync(int fd);
|
| 62 | +extern ssize_t read(int fd, void *buf, size_t count);
|
| 63 | +extern off_t lseek(int fildes, off_t offset, int whence);
|
| 64 | +extern int file_creat(const char *pathname);
|
| 65 | +
|
| 66 | +/* posix compatibility function */
|
| 67 | +static inline int creat(const char *pathname, mode_t mode)
|
| 68 | +{
|
| 69 | + (void)mode;
|
| 70 | + return file_creat(pathname);
|
| 71 | +}
|
| 72 | +
|
| 73 | +#define open(x, y, ...) file_open(x,y)
|
| 74 | +
|
| 75 | +extern ssize_t write(int fd, const void *buf, size_t count);
|
| 76 | +extern int remove(const char* pathname);
|
| 77 | +extern int rename(const char* path, const char* newname);
|
| 78 | +extern int ftruncate(int fd, off_t length);
|
| 79 | +extern off_t filesize(int fd);
|
| 80 | +extern int release_files(int volume);
|
| 81 | +int fdprintf (int fd, const char *fmt, ...) ATTRIBUTE_PRINTF(2, 3);
|
| 82 | +#endif
|