[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Lost] [Patch] Änderungen an den Headern und ihre Folgen
Am Samstag, 9. Februar 2008 14.58:56 schrieb Kevin Wolf:
> Antoine Kaufmann schrieb:
> > Index: src/include/string.h
> > ===================================================================
> > --- src/include/string.h (Revision 698)
> > +++ src/include/string.h (Arbeitskopie)
> > @@ -1,9 +1,7 @@
> > #ifndef _STRING_H_
> > #define _STRING_H_
> > +#include <stddef.h>
> >
> > -#include <types.h>
> > -#include "bsdtypes.h"
> > -
> > void* memcpy(void* dest, const void* src, size_t num);
> > void* memmove(void* dest, const void* src, size_t num);
> > void* memset(void* addr, int value, size_t len);
> > @@ -43,5 +41,8 @@
> >
> > char* strerror(int error_code);
> >
> > +int strcasecmp(const char* s1, const char* s2);
> > +int strncasecmp(const char* s1, const char* s2, size_t n);
> > +
>
> Die gehören hier eigentlich nicht rein. Wenn gcc das braucht, kannst du
> meinetwegen ein #include <strings.h> machen, aber bitte nicht die
> Deklarationen duplizieren.
Naja, ich habe gesehen, dass es hier auch notwendig ist, und dass sowohl glibc
als auch newlib sie in beiden Dateien haben.
> > Index: src/modules/lib/lost_link.c
> > ===================================================================
> > --- src/modules/lib/lost_link.c (Revision 698)
> > +++ src/modules/lib/lost_link.c (Arbeitskopie)
> > @@ -49,12 +49,12 @@
> > *
> > * @param target_path Pfad auf den der Link zeigen soll
> > * @param link_path Pfad an dem der Link erstellt werden soll
> > - * @param hardlink TRUE, falls ein Hardlink erstellt werden soll, FALSE
> > sonst + * @param hardlink 1, falls ein Hardlink erstellt werden soll, 0
> > sonst *
> > * @return 0 bei Erfolg, im Fehlerfall -1 und errno wird entsprechend
> > gesetzt */
> > int io_create_link(const char* target_path, const char* link_path,
> > - bool hardlink)
> > + int hardlink)
> > {
> > int result;
> > FILE* target_file;
>
> Welchen Sinn hat das und warum muß das in einem Patch, der Headerdateien
> wegen gcc betrifft, enthalten sein?
Weil io.h in stdio.h inkludiert wird, und dort kein bool verfügbar ist. Aber
dann nehme ich das vielleicht besser in einen eigenen Header.
> > Index: src/modules/lib/gui/gui.c
> > ===================================================================
> > --- src/modules/lib/gui/gui.c (Revision 698)
> > +++ src/modules/lib/gui/gui.c (Arbeitskopie)
> > @@ -44,6 +44,7 @@
> > #include "rpc.h"
> > #include "init.h"
> > #include "stdlib.h"
> > +#include "syscall.h"
>
> #include <syscall.h> (mehrfach)
Diese Sonderwünsche immer. ;-)
Sollte man eh mal allgemein einheitlich machen.
> > Index: src/modules/c/shell/cmds/ln.c
> > ===================================================================
> > --- src/modules/c/shell/cmds/ln.c (Revision 698)
> > +++ src/modules/c/shell/cmds/ln.c (Arbeitskopie)
> > @@ -55,7 +55,7 @@
> > return -1;
> > }
> >
> > - int result = io_create_link(argv[1], argv[2], TRUE);
> > + int result = io_create_link(argv[1], argv[2], 1);
>
> Siehe oben.
Siehe oben. ;-)
> > +#ifndef _STDDEF_H_
> > +#define _STDDEF_H_
> > +#include <cdefs.h>
> > +
> > +#define NULL (void*) 0
> > +
> > +typedef __SIZE_TYPE__ size_t;
> > +typedef int ptrdiff_t;
> > +typedef short wchar_t;
>
> Ich möchte mein offsetof zurück. ;-)
Irgendjemand hat das in cdefs.h schon implementiert, das reicht dir doch,
oder? ;-)
> Ansonsten sind es relativ offensichtliche Fixes.
Hier die korrigierte Version
Index: src/include/strings.h
===================================================================
--- src/include/strings.h (Revision 702)
+++ src/include/strings.h (Arbeitskopie)
@@ -35,9 +35,8 @@
#ifndef _STRINGS_H_
#define _STRINGS_H_
+#include <stddef.h>
-#include <types.h>
-
int strcasecmp(const char* s1, const char* s2);
int strncasecmp(const char* s1, const char* s2, size_t n);
Index: src/include/bsdtypes.h
===================================================================
--- src/include/bsdtypes.h (Revision 702)
+++ src/include/bsdtypes.h (Arbeitskopie)
@@ -36,7 +36,7 @@
#ifndef _BSDTYPES_H_
#define _BSDTYPES_H_
-#include "types.h"
+#include <stddef.h>
typedef unsigned char u_char;
typedef unsigned int u_short;
@@ -48,7 +48,4 @@
#define LONG_BIT 64
#define NBBY 8
-#define offsetof(struct_type, member) \
- (size_t) &(((struct_type *)0)->member)
-
#endif
Index: src/include/string.h
===================================================================
--- src/include/string.h (Revision 702)
+++ src/include/string.h (Arbeitskopie)
@@ -1,9 +1,7 @@
#ifndef _STRING_H_
#define _STRING_H_
+#include <stddef.h>
-#include <types.h>
-#include "bsdtypes.h"
-
void* memcpy(void* dest, const void* src, size_t num);
void* memmove(void* dest, const void* src, size_t num);
void* memset(void* addr, int value, size_t len);
@@ -43,5 +41,8 @@
char* strerror(int error_code);
+int strcasecmp(const char* s1, const char* s2);
+int strncasecmp(const char* s1, const char* s2, size_t n);
+
#endif /* ndef _STRING_H */
Index: src/include/ports.h
===================================================================
--- src/include/ports.h (Revision 702)
+++ src/include/ports.h (Arbeitskopie)
@@ -1,5 +1,6 @@
#ifndef PORTS_H
#define PORTS_H
+#include <types.h>
extern inline word inw(word _port)
{
Index: src/include/stdlib.h
===================================================================
--- src/include/stdlib.h (Revision 702)
+++ src/include/stdlib.h (Arbeitskopie)
@@ -36,7 +36,6 @@
#ifndef _STDLIB_H_
#define _STDLIB_H_
-#include "types.h"
#include "string.h"
#include <config.h>
Index: src/include/arch/i386/stddef.h
===================================================================
--- src/include/arch/i386/stddef.h (Revision 0)
+++ src/include/arch/i386/stddef.h (Revision 0)
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2006-2007 LOST Project. All rights reserved.
+ *
+ * This code is derived from software contributed to the LOST Project
+ * by Kevin Wolf.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the LOST Project
+ * and its contributors.
+ * 4. Neither the name of the LOST Project nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _STDDEF_H_
+#define _STDDEF_H_
+#include <cdefs.h>
+
+#define NULL (void*) 0
+
+typedef __SIZE_TYPE__ size_t;
+typedef int ptrdiff_t;
+typedef short wchar_t;
+
+#endif
Index: src/include/arch/i386/types.h
===================================================================
--- src/include/arch/i386/types.h (Revision 702)
+++ src/include/arch/i386/types.h (Arbeitskopie)
@@ -1,10 +1,26 @@
#ifndef _TYPES_H_
#define _TYPES_H_
+#include <stddef.h>
-#define NULL (void*) 0
+typedef signed int ssize_t;
+typedef void * paddr_t;
+typedef void * vaddr_t;
+
+typedef unsigned int pid_t;
+typedef unsigned int uid_t;
+typedef unsigned int gid_t;
+
+#endif
+
+// FIXME Um pid_t aus sys/types holen zu koennen
+#ifndef _NO_LOST_TYPES
+
+// Schutz vor mehrfachen Deklarationen
+#ifndef _LOST_TYPES_
+#define _LOST_TYPES_
+
#ifndef __cplusplus
-
// FIXME: HACK
#ifdef TRUE
#undef TRUE
@@ -16,6 +32,7 @@
typedef enum { FALSE = 0, TRUE } bool;
#endif
+
typedef unsigned char byte;
typedef unsigned short word;
typedef unsigned int dword;
@@ -26,18 +43,9 @@
typedef signed int sdword;
typedef signed long long sqword;
-typedef __SIZE_TYPE__ size_t;
-typedef signed int ssize_t;
-
-typedef void * paddr_t;
-typedef void * vaddr_t;
-
-typedef dword pid_t;
-typedef dword uid_t;
-typedef dword gid_t;
-
typedef qword timestamp_t;
typedef dword syscall_id_t;
+#endif // ndef _LOST_TYPES_
+#endif // ndef _NO_LOST_TYPES
-#endif
Index: src/include/arch/i386/stdint.h
===================================================================
--- src/include/arch/i386/stdint.h (Revision 702)
+++ src/include/arch/i386/stdint.h (Arbeitskopie)
@@ -36,21 +36,19 @@
#ifndef _STDINT_H_
#define _STDINT_H_
-#include "types.h"
+typedef signed char int8_t;
+typedef signed short int16_t;
+typedef signed int int32_t;
+typedef signed long long int64_t;
-typedef sbyte int8_t;
-typedef sword int16_t;
-typedef sdword int32_t;
-typedef sqword int64_t;
+typedef unsigned char uint8_t;
+typedef unsigned short uint16_t;
+typedef unsigned int uint32_t;
+typedef unsigned long long uint64_t;
-typedef byte uint8_t;
-typedef word uint16_t;
-typedef dword uint32_t;
-typedef qword uint64_t;
-
-typedef dword uint_fast32_t;
-typedef dword uintptr_t;
+typedef unsigned int uint_fast32_t;
+typedef unsigned int uintptr_t;
typedef long int intptr_t;
#endif
Index: src/lib/string/bcopy.c
===================================================================
--- src/lib/string/bcopy.c (Revision 702)
+++ src/lib/string/bcopy.c (Arbeitskopie)
@@ -36,7 +36,7 @@
* sizeof(word) MUST BE A POWER OF TWO
* SO THAT wmask BELOW IS ALL ONES
*/
-//typedef int word; /* "word" used for optimal copy speed */
+typedef int word; /* "word" used for optimal copy speed */
#define wsize sizeof(word)
#define wmask (wsize - 1)
Index: src/lib/string/strspn.c
===================================================================
--- src/lib/string/strspn.c (Revision 702)
+++ src/lib/string/strspn.c (Arbeitskopie)
@@ -26,7 +26,8 @@
#include <limits.h>
-#include "string.h"
+#include <string.h>
+#include <bsdtypes.h>
#define IDX(c) ((u_char)(c) / LONG_BIT)
#define BIT(c) ((u_long)1 << ((u_char)(c) % LONG_BIT))
Index: src/lib/string/memset.c
===================================================================
--- src/lib/string/memset.c (Revision 702)
+++ src/lib/string/memset.c (Arbeitskopie)
@@ -33,6 +33,7 @@
#include <limits.h>
+#include <bsdtypes.h>
#define wsize sizeof(u_int)
#define wmask (wsize - 1)
Index: src/lib/string/strcspn.c
===================================================================
--- src/lib/string/strcspn.c (Revision 702)
+++ src/lib/string/strcspn.c (Arbeitskopie)
@@ -26,7 +26,8 @@
#include <limits.h>
-#include "string.h"
+#include <string.h>
+#include <bsdtypes.h>
#define IDX(c) ((u_char)(c) / LONG_BIT)
#define BIT(c) ((u_long)1 << ((u_char)(c) % LONG_BIT))
Index: src/modules/file/client.c
===================================================================
--- src/modules/file/client.c (Revision 702)
+++ src/modules/file/client.c (Arbeitskopie)
@@ -35,6 +35,7 @@
#include <stdio.h>
#include <stdlib.h>
+#include <syscall.h>
#include <rpc.h>
#include "file.h"
Index: src/modules/file/server.c
===================================================================
--- src/modules/file/server.c (Revision 702)
+++ src/modules/file/server.c (Arbeitskopie)
@@ -35,6 +35,7 @@
#include <stdio.h>
#include <stdlib.h>
+#include <syscall.h>
#include <rpc.h>
#include <init.h>
#include <collections.h>
Index: src/modules/tcpip/dns.c
===================================================================
--- src/modules/tcpip/dns.c (Revision 702)
+++ src/modules/tcpip/dns.c (Arbeitskopie)
@@ -38,6 +38,7 @@
#include <network.h>
#include <stdio.h>
#include <stdlib.h>
+#include <syscall.h>
#include "dns.h"
#include "tcp.h"
Index: src/modules/ext2/lostio_if.c
===================================================================
--- src/modules/ext2/lostio_if.c (Revision 702)
+++ src/modules/ext2/lostio_if.c (Arbeitskopie)
@@ -35,6 +35,7 @@
#include <lostio.h>
#include <stdio.h>
#include <stdlib.h>
+#include <syscall.h>
#include "lostio_if.h"
#include "libext2/ext2.h"
Index: src/modules/ext2/libext2/cache.h
===================================================================
--- src/modules/ext2/libext2/cache.h (Revision 702)
+++ src/modules/ext2/libext2/cache.h (Arbeitskopie)
@@ -34,6 +34,7 @@
*/
#ifndef _CACHE_H_
#define _CACHE_H_
+#include <types.h>
// Cache
typedef unsigned int cache_index_t;
Index: src/modules/c/shell/commmands.c
===================================================================
--- src/modules/c/shell/commmands.c (Revision 702)
+++ src/modules/c/shell/commmands.c (Arbeitskopie)
@@ -33,17 +33,18 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "types.h"
-#include "syscall.h"
-#include "stdlib.h"
-#include "stdio.h"
-#include "unistd.h"
-#include "string.h"
-#include "rpc.h"
+#include <types.h>
+#include <syscall.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <string.h>
+#include <rpc.h>
#include "shell.h"
-#include "dirent.h"
+#include <dirent.h>
#include <sys/wait.h>
-#include "init.h"
+#include <init.h>
+#include <io.h>
//Hier koennen die Debug-Nachrichten aktiviert werden
Index: src/modules/c/shell/cmds/dbg_st.c
===================================================================
--- src/modules/c/shell/cmds/dbg_st.c (Revision 702)
+++ src/modules/c/shell/cmds/dbg_st.c (Arbeitskopie)
@@ -33,12 +33,13 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "types.h"
-#include "stdlib.h"
-#include "stdio.h"
-#include "unistd.h"
-#include "io.h"
-#include "config.h"
+#include <types.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <io.h>
+#include <config.h>
+#include <syscall.h>
void dbg_st_display_usage();
Index: src/modules/include/fcntl.h
===================================================================
--- src/modules/include/fcntl.h (Revision 702)
+++ src/modules/include/fcntl.h (Arbeitskopie)
@@ -35,7 +35,6 @@
#ifndef _FCNTL_H_
#define _FCNTL_H_
#include <sys/types.h>
-#include "io.h"
#define O_RDONLY 1
#define O_WRONLY 2
Index: src/modules/include/unistd.h
===================================================================
--- src/modules/include/unistd.h (Revision 702)
+++ src/modules/include/unistd.h (Arbeitskopie)
@@ -35,7 +35,6 @@
#ifndef _UNISTD_H_
#define _UNISTD_H_
-#include <types.h>
#include <sys/types.h>
#include <config.h>
Index: src/modules/include/io.h
===================================================================
--- src/modules/include/io.h (Revision 702)
+++ src/modules/include/io.h (Arbeitskopie)
@@ -34,50 +34,19 @@
*/
#ifndef _IO_H_
#define _IO_H_
-#include "types.h"
+#include <stdint.h>
+#include <sys/types.h>
+#include <io_struct.h>
+#include <types.h>
-
-//#define DIRENTRY_NAME_LEN 32 //FIXME: Nur eine uebergangsloesung
-#define MAX_FILENAME_LEN 255
-#define IO_DIRENTRY_FILE 1
-#define IO_DIRENTRY_DIR 2
-
-#define IO_OPEN_MODE_READ 1
-#define IO_OPEN_MODE_WRITE 2
-#define IO_OPEN_MODE_APPEND 4
-#define IO_OPEN_MODE_TRUNC 8
-#define IO_OPEN_MODE_DIRECTORY 16
-#define IO_OPEN_MODE_CREATE 32
-#define IO_OPEN_MODE_LINK 64
-#define IO_OPEN_MODE_SYNC 128
-
-typedef dword io_resource_id_t;
-typedef byte io_direntry_type_t;
typedef struct
{
- io_resource_id_t id;
- char* path;
- pid_t pid;
- qword resid;
-
- void* buffer_ptr;
- size_t buffer_size;
- size_t buffer_pos;
- byte buffer_mode;
-
- size_t ungetc_count;
- byte* ungetc_buffer;
-} __attribute__ ((packed)) io_resource_t;
-
-
-typedef struct
-{
char name[MAX_FILENAME_LEN];
io_direntry_type_t type;
- qword size;
- timestamp_t ctime;
- timestamp_t mtime;
- timestamp_t atime;
+ uint64_t size;
+ time_t ctime;
+ time_t mtime;
+ time_t atime;
} __attribute__ ((packed)) io_direntry_t;
@@ -93,7 +62,7 @@
io_resource_id_t id;
size_t blocksize;
size_t blockcount;
- dword shared_mem_id;
+ uint32_t shared_mem_id;
} __attribute__ ((packed)) io_read_request_t;
typedef struct
@@ -101,8 +70,8 @@
io_resource_id_t id;
size_t blocksize;
size_t blockcount;
- dword shared_mem_id;
- byte data[];
+ uint32_t shared_mem_id;
+ uint8_t data[];
} __attribute__ ((packed)) io_write_request_t;
typedef struct
Index: src/modules/include/stddef.h
===================================================================
--- src/modules/include/stddef.h (Revision 702)
+++ src/modules/include/stddef.h (Arbeitskopie)
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2006-2007 LOST Project. All rights reserved.
- *
- * This code is derived from software contributed to the LOST Project
- * by Kevin Wolf.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the LOST Project
- * and its contributors.
- * 4. Neither the name of the LOST Project nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _STDDEF_H_
-#define _STDDEF_H_
-
-#include "types.h"
-
-typedef int ptrdiff_t;
-typedef short wchar_t;
-
-#endif
Index: src/modules/include/io_struct.h
===================================================================
--- src/modules/include/io_struct.h (Revision 0)
+++ src/modules/include/io_struct.h (Revision 0)
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2006 The LOST Project. All rights reserved.
+ *
+ * This code is derived from software contributed to the LOST Project
+ * by Antoine Kaufmann.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the LOST Project
+ * and its contributors.
+ * 4. Neither the name of the LOST Project nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef _IO_STRUCT_H_
+#define _IO_STRUCT_H_
+#include <stdint.h>
+#include <sys/types.h>
+
+#define MAX_FILENAME_LEN 255
+#define IO_DIRENTRY_FILE 1
+#define IO_DIRENTRY_DIR 2
+
+#define IO_OPEN_MODE_READ 1
+#define IO_OPEN_MODE_WRITE 2
+#define IO_OPEN_MODE_APPEND 4
+#define IO_OPEN_MODE_TRUNC 8
+#define IO_OPEN_MODE_DIRECTORY 16
+#define IO_OPEN_MODE_CREATE 32
+#define IO_OPEN_MODE_LINK 64
+#define IO_OPEN_MODE_SYNC 128
+
+typedef uint32_t io_resource_id_t;
+typedef uint8_t io_direntry_type_t;
+typedef struct
+{
+ io_resource_id_t id;
+ char* path;
+ pid_t pid;
+ io_resource_id_t resid;
+
+ void* buffer_ptr;
+ size_t buffer_size;
+ size_t buffer_pos;
+ uint8_t buffer_mode;
+
+ size_t ungetc_count;
+ uint8_t* ungetc_buffer;
+} __attribute__ ((packed)) io_resource_t;
+#endif //ifndef _IO_STRUCT_H_
+
Index: src/modules/include/signal.h
===================================================================
--- src/modules/include/signal.h (Revision 702)
+++ src/modules/include/signal.h (Arbeitskopie)
@@ -36,6 +36,7 @@
#ifndef _SIGNAL_H_
#define _SIGNAL_H_
#include <sys/types.h>
+#include <stdint.h>
// Signale
@@ -134,7 +135,7 @@
/// Typ fuer eine Sammlung von Signalen
typedef struct {
- byte bitmask[_SIGNO_MAX/8];
+ uint8_t bitmask[_SIGNO_MAX/8];
} sigset_t;
/// Sigset leeren
Index: src/modules/include/stdio.h
===================================================================
--- src/modules/include/stdio.h (Revision 702)
+++ src/modules/include/stdio.h (Arbeitskopie)
@@ -36,12 +36,10 @@
#ifndef _STDIO_H_
#define _STDIO_H_
-#include <types.h>
#include <string.h>
#include <stdarg.h>
#include <config.h>
-#include "syscall.h"
-#include "io.h"
+#include <io_struct.h>
#define SEEK_SET 0
Index: src/modules/include/dirent.h
===================================================================
--- src/modules/include/dirent.h (Revision 702)
+++ src/modules/include/dirent.h (Arbeitskopie)
@@ -34,14 +34,12 @@
*/
#ifndef _DIRENT_H_
#define _DIRENT_H_
-#include "types.h"
-#include "stdio.h"
-#include "io.h"
-#include "limits.h"
+#include <io_struct.h>
+#include <limits.h>
struct dirent {
unsigned short d_reclen;
- char d_name[NAME_MAX + 1];
+ char d_name[MAX_FILENAME_LEN + 1];
};
typedef io_resource_t DIR;
Index: src/modules/include/sys/stat.h
===================================================================
--- src/modules/include/sys/stat.h (Revision 702)
+++ src/modules/include/sys/stat.h (Arbeitskopie)
@@ -34,7 +34,6 @@
*/
#ifndef _SYS_STAT_H_
#define _SYS_STAT_H_
-#include <types.h>
#include <sys/types.h>
#include <time.h>
Index: src/modules/include/sys/types.h
===================================================================
--- src/modules/include/sys/types.h (Revision 702)
+++ src/modules/include/sys/types.h (Arbeitskopie)
@@ -34,7 +34,11 @@
*/
#ifndef _SYS_TYPES_H_
#define _SYS_TYPES_H_
+
+// FIXME
+#define _NO_LOST_TYPES
#include <types.h>
+#undef _NO_LOST_TYPES
// FIXME: Diese Deklarationen sind nur da, damit das Fake-stat() benutzt werden
// kann.
Index: src/modules/vterm/lostio.c
===================================================================
--- src/modules/vterm/lostio.c (Revision 702)
+++ src/modules/vterm/lostio.c (Arbeitskopie)
@@ -33,7 +33,7 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <stdlib.h>
-
+#include <syscall.h>
#include "vterm.h"
#include "lostio.h"
/// Handler fuer Lesen aus in
Index: src/modules/kbc/mouse.c
===================================================================
--- src/modules/kbc/mouse.c (Revision 702)
+++ src/modules/kbc/mouse.c (Arbeitskopie)
@@ -6,6 +6,7 @@
#include "lostio.h"
#include "ports.h"
#include "string.h"
+#include <syscall.h>
#include "mouse.h"
Index: src/modules/cdi/include/cdi/lists.h
===================================================================
--- src/modules/cdi/include/cdi/lists.h (Revision 702)
+++ src/modules/cdi/include/cdi/lists.h (Arbeitskopie)
@@ -10,7 +10,7 @@
#ifndef _CDI_LISTS_
#define _CDI_LISTS_
-
+#include <stddef.h>
#include <stdint.h>
/**
Index: src/modules/cdi/ata/device.c
===================================================================
--- src/modules/cdi/ata/device.c (Revision 702)
+++ src/modules/cdi/ata/device.c (Arbeitskopie)
@@ -79,7 +79,7 @@
*
* @return 1 wenn ein Geraet vorhanden ist, 0 sonst
*/
-static bool ata_bus_responsive_drv(struct ata_controller* controller)
+static int ata_bus_responsive_drv(struct ata_controller* controller)
{
// Slave auswaehlen, da so sicher jemand reagiert, da der Master antworten
// muss, wenn kein Slave existiert. So sieht es zumindest in der Theorie
Index: src/modules/cdi/sis900/device.c
===================================================================
--- src/modules/cdi/sis900/device.c (Revision 702)
+++ src/modules/cdi/sis900/device.c (Arbeitskopie)
@@ -36,6 +36,7 @@
#include <stdint.h>
#include <stdio.h>
#include <stddef.h>
+#include <syscall.h>
#include "cdi.h"
#include "cdi/misc.h"
@@ -234,6 +235,7 @@
reg_outl(netcard, REG_COMMAND, CR_ENABLE_TX);
// Warten, bis das Paket gesendet ist
+ // FIXME: Nicht portabel
qword timeout = get_tick_count() + 500000;
while ((netcard->tx_desc.status & DESC_STATUS_OWN)
&& (get_tick_count() < timeout));
Index: src/modules/lib/stdlibc/file.c
===================================================================
--- src/modules/lib/stdlibc/file.c (Revision 702)
+++ src/modules/lib/stdlibc/file.c (Arbeitskopie)
@@ -34,12 +34,13 @@
*/
#include <types.h>
#include <stdio.h>
-#include "rpc.h"
+#include <rpc.h>
#include <stdlib.h>
-#include "lostio.h"
+#include <lostio.h>
#include <string.h>
#include <unistd.h>
#include <stdint.h>
+#include <syscall.h>
#define IO_BUFFER_MODE_NONE 0
#define IO_BUFFER_MODE_FULL 1
Index: src/modules/lib/stdlibc/stdio.c
===================================================================
--- src/modules/lib/stdlibc/stdio.c (Revision 702)
+++ src/modules/lib/stdlibc/stdio.c (Arbeitskopie)
@@ -33,7 +33,9 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "syscall.h"
+#include <types.h>
+#include <io.h>
+#include <syscall.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
Index: src/modules/lib/gui/gui.c
===================================================================
--- src/modules/lib/gui/gui.c (Revision 702)
+++ src/modules/lib/gui/gui.c (Arbeitskopie)
@@ -44,6 +44,7 @@
#include "rpc.h"
#include "init.h"
#include "stdlib.h"
+#include <syscall.h>
FILE *gui_control = 0;
int gui_command_data[10];
Index: src/modules/lib/video/video.c
===================================================================
--- src/modules/lib/video/video.c (Revision 702)
+++ src/modules/lib/video/video.c (Arbeitskopie)
@@ -40,6 +40,7 @@
#include "stdio.h"
#include "stdlib.h"
#include "rpc.h"
+#include <syscall.h>
#include "init.h"
FILE *video_driver_control = 0;
Index: src/modules/lib/lostio/vfstree.c
===================================================================
--- src/modules/lib/lostio/vfstree.c (Revision 702)
+++ src/modules/lib/lostio/vfstree.c (Arbeitskopie)
@@ -43,6 +43,7 @@
#include "stdlib.h"
#include "string.h"
#include "stdio.h"
+#include <syscall.h>
///Der Root-Knoten
vfstree_node_t vfstree_root;
Index: src/modules/lib/lostio/lostio.c
===================================================================
--- src/modules/lib/lostio/lostio.c (Revision 702)
+++ src/modules/lib/lostio/lostio.c (Arbeitskopie)
@@ -37,6 +37,7 @@
*/
#include "types.h"
+#include <syscall.h>
#include "rpc.h"
#include "collections.h"
#include "lostio_internal.h"
Index: src/modules/lib/network.c
===================================================================
--- src/modules/lib/network.c (Revision 702)
+++ src/modules/lib/network.c (Arbeitskopie)
@@ -34,7 +34,7 @@
*/
#include <network.h>
-
+#include <syscall.h>
#include <stdlib.h>
#include <init.h>
#include <rpc.h>