freemyipod r53 - Code Review

Jump to: navigation, search
Repository:freemyipod
Revision:r52‎ | r53 | r54 >
Date:17:16, 7 August 2010
Author:theseven
Status:new
Tags:
Comment:
Make the FAT driver compile. I doubt it will work yet.
Modified paths:
  • /embios/trunk/dir.c (modified) (history)
  • /embios/trunk/dir.h (modified) (history)
  • /embios/trunk/file.c (modified) (history)
  • /embios/trunk/file.h (modified) (history)

Diff [purge]

Index: embios/trunk/dir.c
@@ -18,15 +18,14 @@
1919 * KIND, either express or implied.
2020 *
2121 ****************************************************************************/
 22+#include "global.h"
2223 #include <stdio.h>
2324 #include <errno.h>
2425 #include <string.h>
25 -#include <stdbool.h>
2626 #include <stdlib.h>
2727 #include "fat.h"
2828 #include "dir.h"
2929 #include "debug.h"
30 -#include "filefuncs.h"
3130
3231 #if ((defined(MEMORYSIZE) && (MEMORYSIZE > 8)) || MEM > 8)
3332 #define MAX_OPEN_DIRS 12
Index: embios/trunk/file.c
@@ -25,8 +25,6 @@
2626 #include "fat.h"
2727 #include "dir.h"
2828 #include "debug.h"
29 -#include "filefuncs.h"
30 -#include "gcc_extensions.h"
3129
3230 /*
3331 These functions provide a roughly POSIX-compatible file IO API.
Index: embios/trunk/dir.h
@@ -40,7 +40,6 @@
4141 unsigned short wrtdate; /* Last write date */
4242 unsigned short wrttime; /* Last write time */
4343 };
44 -#endif
4544
4645 #include "fat.h"
4746
@@ -48,7 +47,7 @@
4948 bool busy;
5049 long startcluster;
5150 struct fat_dir fatdir;
52 - struct dirent_uncached theent;
 51+ struct dirent theent;
5352 #ifdef HAVE_MULTIVOLUME
5453 int volumecounter; /* running counter for faked volume entries */
5554 #endif
@@ -71,6 +70,4 @@
7271
7372 extern int release_dirs(int volume);
7473
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