From janosch.graef at gmx.net Mon Sep 1 17:47:06 2008 From: janosch.graef at gmx.net (=?ISO-8859-15?Q?Janosch_Gr=E4f?=) Date: Mon, 01 Sep 2008 17:47:06 +0200 Subject: [Lost] Ramdisk: Potentieller Pagefault Message-ID: <48BC0E7A.1050502@gmx.net> ramdisk/file.c Zeile 66. Man sollte das memset auf den neuen Buffer anwenden, da sonst ein Pagefault enstehen kann, wenn realloc() den Buffer verschoben hat. -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : ramdisk.patch Dateityp : text/x-patch Dateigröße : 445 bytes Beschreibung: nicht verfügbar URL : From janosch.graef at gmx.net Mon Sep 1 20:12:20 2008 From: janosch.graef at gmx.net (=?ISO-8859-15?Q?Janosch_Gr=E4f?=) Date: Mon, 01 Sep 2008 20:12:20 +0200 Subject: [Lost] Ramdisk - Richtiger Patch ;) Message-ID: <48BC3084.3070907@gmx.net> So dieser Patch dürfte jetzt auch funktionieren. Er patcht: * Children-Liste für root_res anlegen. * Children-Liste für root_res beim Destroy mitzerstören * Falsches memset beim Verändern der Größe einer Datei -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : ramdisk.patch Dateityp : text/x-patch Dateigröße : 1202 bytes Beschreibung: nicht verfügbar URL : From mail at kevin-wolf.de Sat Sep 6 21:37:56 2008 From: mail at kevin-wolf.de (Kevin Wolf) Date: Sat, 6 Sep 2008 21:37:56 +0200 Subject: [Lost] [Patch] kernel2: im_handle erlaubt Taskwechsel Message-ID: <200809062137.56659@kevin-wolf.de> ! kernel2: im_handle geht fest davon aus, dass Syscalls den aktuellen Task nicht aendern koennen. Leider liegt es damit bei PM_SLEEP falsch und aktiviert dann unter anderem das falsche Page Directory... ! kernel2: cr3 nur neu laden, wenn auch wirklich ein anderer Prozess dran ist -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : kernel2-fix-yield.patch Dateityp : text/x-diff Dateigröße : 1534 bytes Beschreibung: nicht verfügbar URL : From toni at famkaufmann.info Sat Sep 6 21:45:05 2008 From: toni at famkaufmann.info (Antoine Kaufmann) Date: Sat, 6 Sep 2008 21:45:05 +0200 Subject: [Lost] [Patch] kernel2: im_handle erlaubt Taskwechsel In-Reply-To: <200809062137.56659@kevin-wolf.de> References: <200809062137.56659@kevin-wolf.de> Message-ID: <20080906194505.GB14196@thales.produktiv.lan> On Sat, Sep 06 21:37, Kevin Wolf wrote: > ! kernel2: im_handle geht fest davon aus, dass Syscalls den aktuellen Task > nicht aendern koennen. Leider liegt es damit bei PM_SLEEP falsch und > aktiviert dann unter anderem das falsche Page Directory... > ! kernel2: cr3 nur neu laden, wenn auch wirklich ein anderer Prozess dran ist Ack. -- Antoine Kaufmann -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : nicht verfügbar Dateityp : application/pgp-signature Dateigröße : 197 bytes Beschreibung: nicht verfügbar URL : From mail at kevin-wolf.de Sun Sep 7 14:32:48 2008 From: mail at kevin-wolf.de (Kevin Wolf) Date: Sun, 7 Sep 2008 14:32:48 +0200 Subject: [Lost] [Patch] kernel2: Userspace-IRQ-Handler Message-ID: <200809071432.49116@kevin-wolf.de> + kernel2: Syscall add_interrupt_handler + kernel2: Userspace-Interrupthandling + kernel2: on_destroy-Eventhandler fuer Prozesse ! kernel2: Funktionsnamen in pic.h korrigiert -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : kernel2-interrupt-handler.patch Dateityp : text/x-diff Dateigröße : 10236 bytes Beschreibung: nicht verfügbar URL : From toni at famkaufmann.info Sun Sep 7 14:41:49 2008 From: toni at famkaufmann.info (Antoine Kaufmann) Date: Sun, 7 Sep 2008 14:41:49 +0200 Subject: [Lost] [Patch] kernel2: Userspace-IRQ-Handler In-Reply-To: <200809071432.49116@kevin-wolf.de> References: <200809071432.49116@kevin-wolf.de> Message-ID: <20080907124149.GA8453@thales.produktiv.lan> On Sun, Sep 07 14:32, Kevin Wolf wrote: > + kernel2: Syscall add_interrupt_handler > + kernel2: Userspace-Interrupthandling > + kernel2: on_destroy-Eventhandler fuer Prozesse > ! kernel2: Funktionsnamen in pic.h korrigiert > Index: trunk/src/kernel2/src/interrupts/im.c > =================================================================== > --- trunk.orig/src/kernel2/src/interrupts/im.c > +++ trunk/src/kernel2/src/interrupts/im.c > ... > @@ -131,3 +141,70 @@ interrupt_stack_frame_t* im_handler(inte > return (interrupt_stack_frame_t*) thread->kernel_stack; > } > > +/** > + * Wird beim Loeschen einen Prozesses aufgerufen. Entfernt den Prozess aus der s/einen/eines/ wenns dir nichts ausmacht. ;-) Ich glaube das könnte funktionieren... -- Antoine Kaufmann -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : nicht verfügbar Dateityp : application/pgp-signature Dateigröße : 197 bytes Beschreibung: nicht verfügbar URL : From mail at kevin-wolf.de Sat Sep 13 15:42:37 2008 From: mail at kevin-wolf.de (Kevin Wolf) Date: Sat, 13 Sep 2008 15:42:37 +0200 Subject: [Lost] [Patch] kernel2: get_tick_count Message-ID: <200809131542.38593@kevin-wolf.de> + kernel2: Syscall get_tick_count -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : kernel2-get-tick-count.patch Dateityp : text/x-diff Dateigröße : 3884 bytes Beschreibung: nicht verfügbar URL : From mail at kevin-wolf.de Sat Sep 13 15:44:28 2008 From: mail at kevin-wolf.de (Kevin Wolf) Date: Sat, 13 Sep 2008 15:44:28 +0200 Subject: [Lost] [Patch] kernel2: Speicherkorruption beim Initialisieren Message-ID: <200809131544.28597@kevin-wolf.de> ! kernel2: Während der frühen Initialisierung ist cpu_get_current() noch NULL, weil die CPUs noch nicht gezählt sind. cpu_get(0) ist der passende Ersatz. -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : kernel2-fix-init.patch Dateityp : text/x-diff Dateigröße : 584 bytes Beschreibung: nicht verfügbar URL : From janosch.graef at gmx.net Mon Sep 15 20:50:03 2008 From: janosch.graef at gmx.net (=?ISO-8859-15?Q?Janosch_Gr=E4f?=) Date: Mon, 15 Sep 2008 20:50:03 +0200 Subject: [Lost] [LOST] [Patch] Ramdisk In-Reply-To: <23571930809011047y6bffc2dcg71369a5231214bdf@mail.gmail.com> References: <23571930809011047y6bffc2dcg71369a5231214bdf@mail.gmail.com> Message-ID: <48CEAE5B.6010603@gmx.net> Hi, So Ramdisk baut jetzt richtig ab und kann auch symbolische Links. stultus / dunklermeuchler schrieb: > so, das ist der neueste code den ich hier auf der platte hab. > > > ------------------------------------------------------------------------ > > Index: src/modules/cdi/ramdisk/dir.c > =================================================================== > --- src/modules/cdi/ramdisk/dir.c (revision 0) > +++ src/modules/cdi/ramdisk/dir.c (revision 0) > @@ -0,0 +1,63 @@ > +/* > + * Copyright (c) 2008 The LOST Project. All rights reserved. > + * > + * This code is derived from software contributed to the LOST Project > + * by Alexander Siol. > + * > + * 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. > + */ > +#include > + > +#include "ramdisk_cdi.h" > + > + > +cdi_list_t ramdisk_fs_dir_list(struct cdi_fs_stream* stream) > +{ > + return stream->res->children; > +} > + > +int ramdisk_fs_dir_create_child(struct cdi_fs_stream* stream, const char* name, > + struct cdi_fs_res* parent) > +{ > + struct ramdisk_fs_res* res = malloc(sizeof(*res)); > + struct ramdisk_fs_res* parent_res = (struct ramdisk_fs_res*) parent; > + > + memset(res, 0, sizeof(*res)); > + > + res->res.loaded = 1; > + > + res->res.name = strdup(name); > + res->res.res = &ramdisk_fs_res; > + > + cdi_list_push(parent_res->res.children, res); > + res->res.parent = parent; > + > + stream->res = (struct cdi_fs_res*) res; > + return 1; > +} > Index: src/modules/cdi/ramdisk/ramdisk_cdi.h > =================================================================== > --- src/modules/cdi/ramdisk/ramdisk_cdi.h (revision 0) > +++ src/modules/cdi/ramdisk/ramdisk_cdi.h (revision 0) > @@ -0,0 +1,103 @@ > +/* > + * Copyright (c) 2008 The LOST Project. All rights reserved. > + * > + * This code is derived from software contributed to the LOST Project > + * by Alexander Siol. > + * > + * 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 _RAMDISK_CDI_H_ > +#define _RAMDISK_CDI_H_ > + > +#include > +#include > + > +#include "cdi/fs.h" > + > + > +/** > + * Dateisystemressource fuer ramdisk > + */ > +struct ramdisk_fs_res { > + struct cdi_fs_res res; > + > + // Buffer fuer die Daten, und dessen Groesse > + void* buffer; > + size_t size; > + > + // Zugriffszeiten (Meta-Informationen) > + int64_t access_time; > + int64_t modification_time; > +}; > + > + > +// CDI-IF > +int ramdisk_fs_init(struct cdi_fs_filesystem* fs); > +int ramdisk_fs_destroy(struct cdi_fs_filesystem* fs); > + > +// CDI Res > +int ramdisk_fs_res_load(struct cdi_fs_stream* stream); > +int ramdisk_fs_res_unload(struct cdi_fs_stream* stream); > +//int ramdisk_fs_res_remove(struct cdi_fs_stream* stream); > +//int ramdisk_fs_res_rename(struct cdi_fs_stream* stream, const char* name); > +//int ramdisk_fs_res_move(struct cdi_fs_stream* stream, struct cdi_fs_res* dest); > +int ramdisk_fs_res_assign_class(struct cdi_fs_stream* stream, > + cdi_fs_res_class_t class); > +//int ramdisk_fs_res_remove_class(struct cdi_fs_stream* stream, > +// cdi_fs_res_class_t class); > +int64_t ramdisk_fs_res_meta_read(struct cdi_fs_stream* stream, cdi_fs_meta_t meta); > +int ramdisk_fs_res_meta_write(struct cdi_fs_stream* stream, cdi_fs_meta_t meta, > + int64_t value); > + > +// CDI File > +size_t ramdisk_fs_file_read(struct cdi_fs_stream* stream, uint64_t start, > + size_t size, void* data); > +size_t ramdisk_fs_file_write(struct cdi_fs_stream* stream, uint64_t start, > + size_t size, const void* data); > +int ramdisk_fs_file_truncate(struct cdi_fs_stream* stream, uint64_t size); > + > +// CDI Dir > +cdi_list_t ramdisk_fs_dir_list(struct cdi_fs_stream* stream); > +int ramdisk_fs_dir_create_child(struct cdi_fs_stream* stream, > + const char* name, struct cdi_fs_res* parent); > + > +// CDI Link > +//const char* ramdisk_fs_link_read(struct cdi_fs_stream* stream); > +//int ramdisk_fs_link_write(struct cdi_fs_stream* stream, const char* path); > + > + > +// ramdisk-Ressourcen(-Typen) > +extern struct cdi_fs_res_res ramdisk_fs_res; > +extern struct cdi_fs_res_file ramdisk_fs_file; > +extern struct cdi_fs_res_dir ramdisk_fs_dir; > +extern struct cdi_fs_res_link ramdisk_fs_link; > + > +#endif > + > Index: src/modules/cdi/ramdisk/file.c > =================================================================== > --- src/modules/cdi/ramdisk/file.c (revision 0) > +++ src/modules/cdi/ramdisk/file.c (revision 0) > @@ -0,0 +1,95 @@ > +/* > + * Copyright (c) 2008 The LOST Project. All rights reserved. > + * > + * This code is derived from software contributed to the LOST Project > + * by Alexander Siol. > + * > + * 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. > + */ > + > +#include "ramdisk_cdi.h" > + > +size_t ramdisk_fs_file_read(struct cdi_fs_stream* stream, uint64_t start, > + size_t size, void* data) > +{ > + struct ramdisk_fs_res* res = (struct ramdisk_fs_res*) stream->res; > + > + // maximal bis Ende lesen. > + if ((res->size - start) < size) { > + size = res->size - start; > + } > + > + memcpy(data, res->buffer + start, size); > + return size; > +} > + > +size_t ramdisk_fs_file_write(struct cdi_fs_stream* stream, uint64_t start, > + size_t size, const void* data) > +{ > + struct ramdisk_fs_res* res = (struct ramdisk_fs_res*) stream->res; > + > + // Es soll mehr geschrieben werden als Platz ist. Buffer vergroessern!. > + if ((res->size - start) < size) { > + void* new_buffer; > + size_t new_size; > + new_size = start + size; > + if (!(new_buffer = realloc(res->buffer,new_size))) { > + stream->error = CDI_FS_ERROR_INTERNAL; > + return 0; > + } > + memset(res->buffer + res->size, 0, new_size - res->size); > + res->buffer = new_buffer; > + res->size = new_size; > + } > + > + memcpy(res->buffer + start, data, size); > + return size; > +} > + > +int ramdisk_fs_file_truncate(struct cdi_fs_stream* stream, uint64_t size) > +{ > + struct ramdisk_fs_res* res = (struct ramdisk_fs_res*) stream->res; > + > + // Nichts zu tun > + if (size == res->size) { > + return 1; > + } > + > + void* new_buffer; > + if (!(new_buffer = realloc(res->buffer,size))) { > + stream->error = CDI_FS_ERROR_INTERNAL; > + } > + if (res->size < size) { > + memset(new_buffer + res->size,0,size - res->size); > + } > + > + res->buffer = new_buffer; > + res->size = size; > + return 1; > +} > Index: src/modules/cdi/ramdisk/init.c > =================================================================== > --- src/modules/cdi/ramdisk/init.c (revision 0) > +++ src/modules/cdi/ramdisk/init.c (revision 0) > @@ -0,0 +1,77 @@ > +/* > + * Copyright (c) 2008 The LOST Project. All rights reserved. > + * > + * This code is derived from software contributed to the LOST Project > + * by Alexander Siol. > + * > + * 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. > + */ > + > +#include "ramdisk_cdi.h" > +#include > + > +static int dir_clear(struct cdi_fs_res* real_res) > +{ > + struct ramdisk_fs_res* res = (struct ramdisk_fs_res*) real_res; > + struct ramdisk_fs_res* child; > + > + while ((child = cdi_list_pop(res->res.children))) { > + if (child->res.dir) { > + dir_clear((struct cdi_fs_res*)child); > + } > + free(child->res.name); > + free(child->buffer); > + free(child); > + } > + > + cdi_list_destroy(res->res.children); > + res->res.children = NULL; > + return 1; > +} > + > +int ramdisk_fs_init(struct cdi_fs_filesystem* cdi_fs) > +{ > + struct ramdisk_fs_res* root_res; > + > + root_res = malloc(sizeof(*root_res)); > + memset(root_res, 0, sizeof(*root_res)); > + root_res->res.name = strdup("/"); > + root_res->res.res = &ramdisk_fs_res; > + root_res->res.dir = &ramdisk_fs_dir; > + root_res->res.loaded = 1; > + > + cdi_fs->root_res = (struct cdi_fs_res*) root_res; > + return 1; > +} > + > +int ramdisk_fs_destroy(struct cdi_fs_filesystem* fs) > +{ > + dir_clear(fs->root_res); > + return 0; > +} > Index: src/modules/cdi/ramdisk/Makefile.all > =================================================================== > --- src/modules/cdi/ramdisk/Makefile.all (revision 0) > +++ src/modules/cdi/ramdisk/Makefile.all (revision 0) > @@ -0,0 +1,6 @@ > +shopt -s extglob > +source $LOST_BUILDMK_ROOT/config.sh > + > +echo "LD $1/modules/ramdisk" > +$LOST_TOOLS_LD -oramdisk.mod -Ttext=0x40000000 *.o --start-group $2 --end-group > +$LOST_TOOLS_STRIP -s ramdisk.mod -o $1/modules/ramdisk > Index: src/modules/cdi/ramdisk/main.c > =================================================================== > --- src/modules/cdi/ramdisk/main.c (revision 0) > +++ src/modules/cdi/ramdisk/main.c (revision 0) > @@ -0,0 +1,98 @@ > +/* > + * Copyright (c) 2008 The LOST Project. All rights reserved. > + * > + * This code is derived from software contributed to the LOST Project > + * by Alexander Siol. > + * > + * 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. > + */ > + > +#include > +#include > +#include > + > +#include "cdi/fs.h" > +#include "cdi/misc.h" > + > +#include "ramdisk_cdi.h" > + > +struct ramdisk_driver { > + struct cdi_fs_driver fs; > +}; > + > +static struct ramdisk_driver ramdisk_driver; > +static const char* driver_name = "ramdisk"; > + > +static int ramdisk_driver_init(struct ramdisk_driver* driver); > +static void ramdisk_driver_destroy(struct cdi_driver* driver); > + > +#ifdef CDI_STANDALONE > +int main() > +#else > +int init_ramdisk() > +#endif > +{ > + cdi_init(); > + > + if (ramdisk_driver_init(&ramdisk_driver) != 0) { > + return -1; > + } > + cdi_fs_driver_register((struct cdi_fs_driver*) &ramdisk_driver); > + > +#ifdef CDI_STANDALONE > + cdi_run_drivers(); > +#endif > + > + return 0; > +} > + > +/** > + * Initialisiert die Datenstrukturen fuer den ramdisk-Treiber > + */ > +static int ramdisk_driver_init(struct ramdisk_driver* driver) > +{ > + // Konstruktor der Vaterklasse > + cdi_fs_driver_init((struct cdi_fs_driver*) driver); > + > + // Namen setzen > + driver->fs.drv.name = driver_name; > + driver->fs.fs_init = ramdisk_fs_init; > + driver->fs.fs_destroy = ramdisk_fs_destroy; > + > + driver->fs.drv.destroy = ramdisk_driver_destroy; > + return 0; > +} > + > +/** > + * Deinitialisiert die Datenstrukturen fuer den ramdisk-Treiber > + */ > +static void ramdisk_driver_destroy(struct cdi_driver* driver) > +{ > + cdi_fs_driver_destroy((struct cdi_fs_driver*) driver); > +} > Index: src/modules/cdi/ramdisk/res.c > =================================================================== > --- src/modules/cdi/ramdisk/res.c (revision 0) > +++ src/modules/cdi/ramdisk/res.c (revision 0) > @@ -0,0 +1,156 @@ > +/* > + * Copyright (c) 2008 The LOST Project. All rights reserved. > + * > + * This code is derived from software contributed to the LOST Project > + * by Alexander Siol. > + * > + * 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. > + */ > + > +#include "ramdisk_cdi.h" > + > +int ramdisk_fs_res_load(struct cdi_fs_stream* stream) > +{ > + struct ramdisk_fs_res* res = (struct ramdisk_fs_res*) stream->res; > + > + if (res->res.loaded) { > + return 0; > + } > + > + res->res.loaded = 1; > + return 1; > +} > + > +int ramdisk_fs_res_unload(struct cdi_fs_stream* stream) > +{ > + struct ramdisk_fs_res* res = (struct ramdisk_fs_res*) stream->res; > + > + if (!res->res.loaded) { > + return 0; > + } > + > + res->res.loaded = 0; > + return 1; > +} > + > +int64_t ramdisk_fs_res_meta_read(struct cdi_fs_stream* stream, cdi_fs_meta_t meta) > +{ > + struct ramdisk_fs_res* res = (struct ramdisk_fs_res*) stream->res; > + > + switch (meta) { > + case CDI_FS_META_SIZE: > + return res->size; > + > + case CDI_FS_META_USEDBLOCKS: > + return 1; > + > + case CDI_FS_META_BLOCKSZ: > + return res->size; > + > + case CDI_FS_META_BESTBLOCKSZ: > + return res->size; > + > + case CDI_FS_META_CREATETIME: > + return res->modification_time; > + > + case CDI_FS_META_ACCESSTIME: > + return res->access_time; > + > + case CDI_FS_META_CHANGETIME: > + return res->modification_time; > + } > + > + return 0; > +} > + > +int ramdisk_fs_res_meta_write(struct cdi_fs_stream* stream, cdi_fs_meta_t meta, > + int64_t value) > +{ > + struct ramdisk_fs_res* res = (struct ramdisk_fs_res*) stream->res; > + > + switch (meta) { > + case CDI_FS_META_ACCESSTIME: > + res->access_time = value; > + return 1; > + > + case CDI_FS_META_CHANGETIME: > + res->modification_time = value; > + return 1; > + > + // RO: > + case CDI_FS_META_SIZE: > + case CDI_FS_META_USEDBLOCKS: > + case CDI_FS_META_BESTBLOCKSZ: > + case CDI_FS_META_BLOCKSZ: > + case CDI_FS_META_CREATETIME: > + return 0; > + } > + > + return 0; > +} > + > +int ramdisk_fs_res_assign_class(struct cdi_fs_stream* stream, > + cdi_fs_res_class_t class) > +{ > + struct ramdisk_fs_res* res = (struct ramdisk_fs_res*) stream->res; > + > + // In ramdisk koennen die Ressource nur zu maximal einer Klasse gleichzeitig > + // gehoeren > + if (res->res.file || res->res.dir || res->res.link || res->res.special) > + { > + stream->error = CDI_FS_ERROR_ONS; > + return 0; > + } > + > + switch (class) { > + case CDI_FS_CLASS_FILE: > + res->res.file = &ramdisk_fs_file; > + break; > + > + case CDI_FS_CLASS_DIR: > + res->res.dir = &ramdisk_fs_dir; > + break; > + > + case CDI_FS_CLASS_LINK: > + stream->error = CDI_FS_ERROR_NOT_IMPLEMENTED; > + goto error_out; > + break; > + > + case CDI_FS_CLASS_SPECIAL: > + stream->error = CDI_FS_ERROR_NOT_IMPLEMENTED; > + goto error_out; > + break; > + > + }; > + > + return 1; > + > +error_out: > + return 0; > +} > Index: src/modules/cdi/ramdisk/resources.c > =================================================================== > --- src/modules/cdi/ramdisk/resources.c (revision 0) > +++ src/modules/cdi/ramdisk/resources.c (revision 0) > @@ -0,0 +1,67 @@ > +/* > + * Copyright (c) 2008 The LOST Project. All rights reserved. > + * > + * This code is derived from software contributed to the LOST Project > + * by Alexander Siol. > + * > + * 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. > + */ > + > +#include "ramdisk_cdi.h" > + > +struct cdi_fs_res_res ramdisk_fs_res = { > + .load = ramdisk_fs_res_load, > + .unload = ramdisk_fs_res_unload, > + > + .meta_read = ramdisk_fs_res_meta_read, > + .meta_write = ramdisk_fs_res_meta_write, > + > + .assign_class = ramdisk_fs_res_assign_class > +}; > + > +struct cdi_fs_res_file ramdisk_fs_file = { > + // Prinzipiell haben wir nur ausfuehrbare Dateien, der Rest wird mit den > + // Berechtigungen geregelt > + .executable = 1, > + > + .read = ramdisk_fs_file_read, > + .write = ramdisk_fs_file_write, > + .truncate = ramdisk_fs_file_truncate > +}; > + > +struct cdi_fs_res_dir ramdisk_fs_dir = { > + .list = ramdisk_fs_dir_list, > + .create_child = ramdisk_fs_dir_create_child > +}; > + > +struct cdi_fs_res_link ramdisk_fs_link = { > + .read_link = NULL,//ramdisk_fs_link_read, > + .write_link = NULL,//ramdisk_fs_link_write > +}; > + -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : ramdisk.patch Dateityp : text/x-patch Dateigröße : 29896 bytes Beschreibung: nicht verfügbar URL : From mail at kevin-wolf.de Mon Sep 15 21:38:12 2008 From: mail at kevin-wolf.de (Kevin Wolf) Date: Mon, 15 Sep 2008 21:38:12 +0200 Subject: [Lost] [LOST] [Patch] Ramdisk In-Reply-To: <48CEAE5B.6010603@gmx.net> References: <23571930809011047y6bffc2dcg71369a5231214bdf@mail.gmail.com> <48CEAE5B.6010603@gmx.net> Message-ID: <200809152138.12752@kevin-wolf.de> Am Montag, 15. September 2008 20:50:03 schrieb Janosch Gräf: > So Ramdisk baut jetzt richtig ab und kann auch symbolische Links. Und hier nochmal so, daß es auch mit LOST kompiliert. -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : ramdisk.patch Dateityp : text/x-diff Dateigröße : 30169 bytes Beschreibung: nicht verfügbar URL : From mail at kevin-wolf.de Sat Sep 20 16:57:24 2008 From: mail at kevin-wolf.de (Kevin Wolf) Date: Sat, 20 Sep 2008 16:57:24 +0200 Subject: [Lost] =?iso-8859-1?q?=5BPatch=5D_kernel2=3A_Fix_f=FCr_IRQ-Verarb?= =?iso-8859-1?q?eitung?= Message-ID: <200809201657.24334@kevin-wolf.de> ! kernel2: IRQs nicht nur zaehlen, sondern auch wirklich an den zustaendigen Prozess schicken ! kernel2: fastrpc_irq hat den Rueckgabewert von syscall_fastrpc genau falschrum interpretiert -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : kernel2-fix-irq.patch Dateityp : text/x-diff Dateigröße : 1831 bytes Beschreibung: nicht verfügbar URL : From mail at kevin-wolf.de Sat Sep 20 17:24:39 2008 From: mail at kevin-wolf.de (Kevin Wolf) Date: Sat, 20 Sep 2008 17:24:39 +0200 Subject: [Lost] [Patch] kernel2: Userspace-Stackoverflows abfangen Message-ID: <200809201724.39859@kevin-wolf.de> + kernel2: Userspace-Stackoverflows abfangen und Stack vergroessern ! kernel2: increase_user_stack_size sollte auch mit dem Userstack und nicht mit dem Kernelstack arbeiten -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : kernel2-increase-stack.patch Dateityp : text/x-diff Dateigröße : 5628 bytes Beschreibung: nicht verfügbar URL : From mail at kevin-wolf.de Sat Sep 20 17:29:17 2008 From: mail at kevin-wolf.de (Kevin Wolf) Date: Sat, 20 Sep 2008 17:29:17 +0200 Subject: [Lost] [Patch] kernel2: RPC: Genug Stack mappen Message-ID: <200809201729.18058@kevin-wolf.de> ! kernel2: Beim Mappen des Stacks einberechnen, dass der aktuelle Stackpointer nicht unbedingt auf einer Pagegrenze liegt und man deswegen manchmal eine Page mehr braucht -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : kernel2-fix-rpc.patch Dateityp : text/x-diff Dateigröße : 1914 bytes Beschreibung: nicht verfügbar URL : From mail at kevin-wolf.de Sat Sep 20 17:33:05 2008 From: mail at kevin-wolf.de (Kevin Wolf) Date: Sat, 20 Sep 2008 17:33:05 +0200 Subject: [Lost] =?iso-8859-1?q?=5BPatch=5D_kernel2=3A_Platz_auf_dem_Stack_?= =?iso-8859-1?q?schaffen_f=FCr_Syscalls?= Message-ID: <200809201733.05488@kevin-wolf.de> ! kernel2: Wenn der Userspace in einen Stackoverflow rennt, können wir das mittlerweile abfangen und den Stack einfach vergroessern. Wenn es beim Kernel passiert, rennen wir in einen Triple Fault. Dadurch, dass bei Syscalls der Userspace-Stack benutzt wird, kann aber genau letzteres passieren, wenn der Userspace-Thread gerade seinen Stack fast voll hatte. Um das zu vermeiden, werden mit diesen Patch 512 Bytes Luft geschaffen für den Syscall. -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : kernel2-fix-stack-overflow.patch Dateityp : text/x-diff Dateigröße : 1062 bytes Beschreibung: nicht verfügbar URL : From mail at kevin-wolf.de Sat Sep 20 17:35:11 2008 From: mail at kevin-wolf.de (Kevin Wolf) Date: Sat, 20 Sep 2008 17:35:11 +0200 Subject: [Lost] =?iso-8859-1?q?=5BPatch=5D_kernel2=3A_Fix_f=FCr_mmc=5Fcurr?= =?iso-8859-1?q?ent=5Fcontext=28=29?= Message-ID: <200809201735.11550@kevin-wolf.de> ! kernel2: Der aktuelle Kontext ist nicht zwingend der Kontext der aktiven Threads (z.B. Thread wurde bereits im Scheduler gewechselt, cr3 wird erst beim Verlassen des Interrupthandlers gewechselt). Den aktuellen Kontext in cpu_t speichern. -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : kernel2-fix-mmc_current.patch Dateityp : text/x-diff Dateigröße : 1822 bytes Beschreibung: nicht verfügbar URL : From toni at famkaufmann.info Sat Sep 20 17:46:51 2008 From: toni at famkaufmann.info (Antoine Kaufmann) Date: Sat, 20 Sep 2008 17:46:51 +0200 Subject: [Lost] [Patch] kernel2: get_tick_count In-Reply-To: <200809131542.38593@kevin-wolf.de> References: <200809131542.38593@kevin-wolf.de> Message-ID: <20080920154651.GB20462@thales.produktiv.lan> On Sat, Sep 13 15:42, Kevin Wolf wrote: > + kernel2: Syscall get_tick_count > Index: trunk/src/kernel2/src/syscall.c > =================================================================== > --- trunk.orig/src/kernel2/src/syscall.c > +++ trunk/src/kernel2/src/syscall.c > @@ -79,6 +79,7 @@ void syscall_init() > syscall_add_interrupt_handler, 1); > > syscall_register(SYSCALL_PUTSN, (void*) &syscall_putsn, 2); > + syscall_register(SYSCALL_GET_TICK_COUNT, syscall_get_tick_count, 0); Hier sollten wir uns vielleicht mal einigen ob wir nun ein & hinschreiben wollen oder nicht. ;-) > } > > /** > Index: trunk/src/kernel2/src/arch/i386/syscall.c > =================================================================== > --- trunk.orig/src/kernel2/src/arch/i386/syscall.c > +++ trunk/src/kernel2/src/arch/i386/syscall.c > @@ -88,23 +88,27 @@ void syscall_arch(machine_state_t* isf) > syscall_fastrpc_ret(); > > } else { > - dword result; > + uint32_t eax, edx; > dword stack_backup; > > // Die Syscallhandler werden mit dem Userspace-Stack aufgerufen, damit > // keine Parameter kopiert werden muessen. > asm("pusha;" > // Den original-Stackpointer retten > - "movl %%esp, %2;" > + "movl %%esp, %3;" > // Stack wechseln > - "movl %1, %%esp;" > - "call *%3;" > - "movl %%eax, %0;" > "movl %2, %%esp;" > + "call *%4;" > + "movl %%eax, %0;" > + "movl %%edx, %1;" > + "movl %3, %%esp;" > "popa;" > - : "=m" (result) : "r" (stack), "m" (stack_backup), "r" (handler)); > + : "=m" (eax), "=m" (edx) : "r" (stack), "m" (stack_backup), "r" (handler)); > > - isf->eax = result; > + isf->eax = eax; > + if (handler == syscall_get_tick_count) { > + isf->edx = edx; > + } > } > } Das ist ja mal nicht wirklich schön, aber daran bin ich wohl selbst schuld... Immer schön rein damit. ;-) -- Antoine Kaufmann -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : nicht verfügbar Dateityp : application/pgp-signature Dateigröße : 197 bytes Beschreibung: nicht verfügbar URL : From toni at famkaufmann.info Sat Sep 20 17:54:11 2008 From: toni at famkaufmann.info (Antoine Kaufmann) Date: Sat, 20 Sep 2008 17:54:11 +0200 Subject: [Lost] [Patch] kernel2: Speicherkorruption beim Initialisieren In-Reply-To: <200809131544.28597@kevin-wolf.de> References: <200809131544.28597@kevin-wolf.de> Message-ID: <20080920155411.GA13249@thales.produktiv.lan> On Sat, Sep 13 15:44, Kevin Wolf wrote: > ! kernel2: Während der frühen Initialisierung ist cpu_get_current() noch NULL, > weil die CPUs noch nicht gezählt sind. cpu_get(0) ist der passende Ersatz. > Index: trunk/src/kernel2/src/init.c > =================================================================== > --- trunk.orig/src/kernel2/src/init.c > +++ trunk/src/kernel2/src/init.c > @@ -85,7 +85,7 @@ void init(int multiboot_magic, struct mu > // notwendig, damit im restlichen Code keine Aenderungen notwendig sind > // fuer die Initialisierung. > init_thread.process = &init_process; > - cpu_get_current()->thread = &init_thread; > + cpu_get(0)->thread = &init_thread; > > #if 0 > // Debugparameter verarbeiten, das ist aber nur moeglich, wenn eine Das ist böse... Ack. -- Antoine Kaufmann -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : nicht verfügbar Dateityp : application/pgp-signature Dateigröße : 197 bytes Beschreibung: nicht verfügbar URL : From toni at famkaufmann.info Sat Sep 20 17:57:06 2008 From: toni at famkaufmann.info (Antoine Kaufmann) Date: Sat, 20 Sep 2008 17:57:06 +0200 Subject: [Lost] =?iso-8859-1?q?=5BPatch=5D_kernel2=3A_Fix_f=FCr_IRQ-Verarb?= =?iso-8859-1?q?eitung?= In-Reply-To: <200809201657.24334@kevin-wolf.de> References: <200809201657.24334@kevin-wolf.de> Message-ID: <20080920155706.GB13249@thales.produktiv.lan> On Sat, Sep 20 16:57, Kevin Wolf wrote: > ! kernel2: IRQs nicht nur zaehlen, sondern auch wirklich an den zustaendigen > Prozess schicken > ! kernel2: fastrpc_irq hat den Rueckgabewert von syscall_fastrpc genau > falschrum interpretiert Ack. -- Antoine Kaufmann -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : nicht verfügbar Dateityp : application/pgp-signature Dateigröße : 197 bytes Beschreibung: nicht verfügbar URL : From toni at famkaufmann.info Sat Sep 20 18:04:11 2008 From: toni at famkaufmann.info (Antoine Kaufmann) Date: Sat, 20 Sep 2008 18:04:11 +0200 Subject: [Lost] =?iso-8859-1?q?=5BPatch=5D_kernel2=3A_Platz_auf_dem_Stack_?= =?iso-8859-1?q?schaffen_f=FCr_Syscalls?= In-Reply-To: <200809201733.05488@kevin-wolf.de> References: <200809201733.05488@kevin-wolf.de> Message-ID: <20080920160411.GC13249@thales.produktiv.lan> On Sat, Sep 20 17:33, Kevin Wolf wrote: > ! kernel2: Wenn der Userspace in einen Stackoverflow rennt, können wir das > mittlerweile abfangen und den Stack einfach vergroessern. Wenn es beim Kernel > passiert, rennen wir in einen Triple Fault. Dadurch, dass bei Syscalls der > Userspace-Stack benutzt wird, kann aber genau letzteres passieren, wenn der > Userspace-Thread gerade seinen Stack fast voll hatte. Um das zu vermeiden, > werden mit diesen Patch 512 Bytes Luft geschaffen für den Syscall. Wer kommt schon auf die Idee im Kernel den Userspacestack zu benutzen... Das ist so richtig schön kaputt. ;-) Die Rumwürgerei muss wohl damit auch rein, bis wir das mal sauber machen. -- Antoine Kaufmann -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : nicht verfügbar Dateityp : application/pgp-signature Dateigröße : 197 bytes Beschreibung: nicht verfügbar URL : From mail at kevin-wolf.de Sat Sep 20 18:08:05 2008 From: mail at kevin-wolf.de (Kevin Wolf) Date: Sat, 20 Sep 2008 18:08:05 +0200 Subject: [Lost] =?utf-8?q?=5BPatch=5D_kernel2=3A_Platz_auf_dem_Stack_schaf?= =?utf-8?q?fen_f=C3=BCr_Syscalls?= In-Reply-To: <20080920160411.GC13249@thales.produktiv.lan> References: <200809201733.05488@kevin-wolf.de> <20080920160411.GC13249@thales.produktiv.lan> Message-ID: <200809201808.05277@kevin-wolf.de> Am Samstag, 20. September 2008 18:04:11 schrieb Antoine Kaufmann: > On Sat, Sep 20 17:33, Kevin Wolf wrote: > > ! kernel2: Wenn der Userspace in einen Stackoverflow rennt, können wir > > das mittlerweile abfangen und den Stack einfach vergroessern. Wenn es > > beim Kernel passiert, rennen wir in einen Triple Fault. Dadurch, dass bei > > Syscalls der Userspace-Stack benutzt wird, kann aber genau letzteres > > passieren, wenn der Userspace-Thread gerade seinen Stack fast voll hatte. > > Um das zu vermeiden, werden mit diesen Patch 512 Bytes Luft geschaffen > > für den Syscall. > > Wer kommt schon auf die Idee im Kernel den Userspacestack zu benutzen... > Das ist so richtig schön kaputt. ;-) Ack. Allein auf die Idee zu kommen, sowas zu basteln, ist schon bemerkenswert. ;-) From toni at famkaufmann.info Sat Sep 20 18:33:48 2008 From: toni at famkaufmann.info (Antoine Kaufmann) Date: Sat, 20 Sep 2008 18:33:48 +0200 Subject: [Lost] [Patch] kernel2: Userspace-Stackoverflows abfangen In-Reply-To: <200809201724.39859@kevin-wolf.de> References: <200809201724.39859@kevin-wolf.de> Message-ID: <20080920163348.GA13438@thales.produktiv.lan> On Sat, Sep 20 17:24, Kevin Wolf wrote: > + kernel2: Userspace-Stackoverflows abfangen und Stack vergroessern > ! kernel2: increase_user_stack_size sollte auch mit dem Userstack und nicht > mit dem Kernelstack arbeiten Ack. -- Antoine Kaufmann -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : nicht verfügbar Dateityp : application/pgp-signature Dateigröße : 197 bytes Beschreibung: nicht verfügbar URL : From toni at famkaufmann.info Sat Sep 20 18:34:58 2008 From: toni at famkaufmann.info (Antoine Kaufmann) Date: Sat, 20 Sep 2008 18:34:58 +0200 Subject: [Lost] [Patch] kernel2: RPC: Genug Stack mappen In-Reply-To: <200809201729.18058@kevin-wolf.de> References: <200809201729.18058@kevin-wolf.de> Message-ID: <20080920163458.GB13438@thales.produktiv.lan> On Sat, Sep 20 17:29, Kevin Wolf wrote: > ! kernel2: Beim Mappen des Stacks einberechnen, dass der aktuelle Stackpointer > nicht unbedingt auf einer Pagegrenze liegt und man deswegen manchmal eine > Page mehr braucht Rein damit. -- Antoine Kaufmann -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : nicht verfügbar Dateityp : application/pgp-signature Dateigröße : 197 bytes Beschreibung: nicht verfügbar URL : From toni at famkaufmann.info Sat Sep 20 18:37:27 2008 From: toni at famkaufmann.info (Antoine Kaufmann) Date: Sat, 20 Sep 2008 18:37:27 +0200 Subject: [Lost] =?iso-8859-1?q?=5BPatch=5D_kernel2=3A_Fix_f=FCr_mmc=5Fcurr?= =?iso-8859-1?q?ent=5Fcontext=28=29?= In-Reply-To: <200809201735.11550@kevin-wolf.de> References: <200809201735.11550@kevin-wolf.de> Message-ID: <20080920163727.GC13438@thales.produktiv.lan> On Sat, Sep 20 17:35, Kevin Wolf wrote: > ! kernel2: Der aktuelle Kontext ist nicht zwingend der Kontext der aktiven > Threads (z.B. Thread wurde bereits im Scheduler gewechselt, cr3 wird erst > beim Verlassen des Interrupthandlers gewechselt). Den aktuellen Kontext in > cpu_t speichern. Ack. -- Antoine Kaufmann -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : nicht verfügbar Dateityp : application/pgp-signature Dateigröße : 197 bytes Beschreibung: nicht verfügbar URL : From toni at famkaufmann.info Sat Sep 20 19:25:28 2008 From: toni at famkaufmann.info (Antoine Kaufmann) Date: Sat, 20 Sep 2008 19:25:28 +0200 Subject: [Lost] [Patch] Caching in Listen aktivieren und LostIO-Fixes Message-ID: <20080920172526.GA16585@thales.produktiv.lan> * libc: Caching in den Listen wieder aktivieren ! libc: LostIO Fix für Race-Condition beim Suchen von Filehandles die Probleme mit dem Listencaching verursacht. -- Antoine Kaufmann -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : list_caching.patch Dateityp : text/x-diff Dateigröße : 1330 bytes Beschreibung: nicht verfügbar URL : -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : nicht verfügbar Dateityp : application/pgp-signature Dateigröße : 197 bytes Beschreibung: nicht verfügbar URL : From janosch.graef at gmx.net Sat Sep 20 20:41:27 2008 From: janosch.graef at gmx.net (=?ISO-8859-15?Q?Janosch_Gr=E4f?=) Date: Sat, 20 Sep 2008 20:41:27 +0200 Subject: [Lost] iso9660 Message-ID: <48D543D7.2020805@gmx.net> Hi, Eigentlich läuft iso9660 soweit. Bei Rockridge fehlt noch ein bisschen, aber immerhin gehen schon lange Dateinamen. -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : iso9660.patch Dateityp : text/x-patch Dateigröße : 42013 bytes Beschreibung: nicht verfügbar URL : From toni at famkaufmann.info Sat Sep 20 20:53:15 2008 From: toni at famkaufmann.info (Antoine Kaufmann) Date: Sat, 20 Sep 2008 20:53:15 +0200 Subject: [Lost] [Patch] lpt cfg-addlib und cfg-addinc Message-ID: <20080920185314.GA17940@thales.produktiv.lan> + lpt: cfg-addinc und cfg-addlib Befehle -- Antoine Kaufmann -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : lpt-addlibinc.patch Dateityp : text/x-diff Dateigröße : 1601 bytes Beschreibung: nicht verfügbar URL : -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : nicht verfügbar Dateityp : application/pgp-signature Dateigröße : 197 bytes Beschreibung: nicht verfügbar URL : From mail at kevin-wolf.de Sat Sep 20 20:54:17 2008 From: mail at kevin-wolf.de (Kevin Wolf) Date: Sat, 20 Sep 2008 20:54:17 +0200 Subject: [Lost] [Patch] Caching in Listen aktivieren und LostIO-Fixes In-Reply-To: <20080920172526.GA16585@thales.produktiv.lan> References: <20080920172526.GA16585@thales.produktiv.lan> Message-ID: <200809202054.17078@kevin-wolf.de> Am Samstag, 20. September 2008 19:25:28 schrieb Antoine Kaufmann: > * libc: Caching in den Listen wieder aktivieren > ! libc: LostIO Fix für Race-Condition beim Suchen von Filehandles die > Probleme mit dem Listencaching verursacht. Also qemu ist mir bei meinem Test nicht explodiert, insofern habe ich Hoffnung, daß das so hinhaut. Mach einfach mal. From mail at kevin-wolf.de Sat Sep 20 20:56:35 2008 From: mail at kevin-wolf.de (Kevin Wolf) Date: Sat, 20 Sep 2008 20:56:35 +0200 Subject: [Lost] [Patch] lpt cfg-addlib und cfg-addinc In-Reply-To: <20080920185314.GA17940@thales.produktiv.lan> References: <20080920185314.GA17940@thales.produktiv.lan> Message-ID: <200809202056.35684@kevin-wolf.de> Am Samstag, 20. September 2008 20:53:15 schrieb Antoine Kaufmann: > + lpt: cfg-addinc und cfg-addlib Befehle Macht den Code nicht gerade schöner, aber lpt ist sowieso nicht besonders schön... Rein damit. From mail at kevin-wolf.de Sat Sep 20 21:30:23 2008 From: mail at kevin-wolf.de (Kevin Wolf) Date: Sat, 20 Sep 2008 21:30:23 +0200 Subject: [Lost] iso9660 In-Reply-To: <48D543D7.2020805@gmx.net> References: <48D543D7.2020805@gmx.net> Message-ID: <200809202130.23860@kevin-wolf.de> Im zitieren Code die Änderungen, die es braucht, um auf LOST überhaupt mal kompiliert zu werden. Außerdem sind in LOST noch kleinere POSIX-Ergänzungen nötig, damit ich einen Lauftest machen kann. Das ist natürlich generell kein gutes Zeichen, CDI-Treiber sollten möglichst kein POSIX voraussetzen. An den entsprechenden Stellen würde ich daher zumindest mal ein FIXME hinschreiben. Am Samstag, 20. September 2008 20:41:27 schrieb Janosch Gräf: > Eigentlich läuft iso9660 soweit. Bei Rockridge fehlt noch ein bisschen, > aber immerhin gehen schon lange Dateinamen. > iso9660.patch > diff -urNp tmp/dir.c iso9660/dir.c > --- tmp/dir.c   1970-01-01 01:00:00.000000000 +0100 > +++ iso9660/dir.c       2008-09-20 20:39:36.000000000 +0200 > @@ -0,0 +1,165 @@ > +/* > + * iso9660 - An iso9660 CDI driver with Rockridge support > + * > + * Copyright (C) 2008 Janosch Gräf > + * > + * 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 3 of the License, or (at your > option) + * any later version. > + * > + * This program is distributed in the hope that it will be useful, but > WITHOUT + * ANY WARRANTY; without even the implied warranty of > MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU > General Public License for + * more details. > + * > + * You should have received a copy of the GNU General Public License along > with + * this program; if not, see . > + */ > + > +#include > +#include > +#include Das sind allesamt POSIX-Header. > + > +#include "cdi/fs.h" > +#include "cdi/lists.h" > +#include "cdi/cache.h" > + > +#include "directory_record.h" > +#include "volume_descriptor.h" > +#include "iso9660def.h" > + > +#ifdef ISO9660_USE_ROCKRIDGE > +  #include "rockridge.h" > +#endif > + > +#include "iso9660_cdi.h" > + > +#ifdef ISO9660_LOWER_FILENAMES > +  #include > +#endif > + > +/** > + * Parse ISO9660 name > + *  @param ident Identifier > + *  @param len Length of Identifier > + *  @return Name (should be passed to free()) > + */ > +static char *parse_name(char *ident,size_t len) { > +  if (ident[len-2]==';') len -= 2; > +  if (ident[len-1]=='.') len--; > +  char *name = memcpy(malloc(len+1),ident,len); stdlib.h ist nicht eingebunden, wird für malloc aber benötigt. > +#ifdef ISO9660_LOWER_FILENAMES > +  size_t i; > +  for (i=0;i +#endif > +  name[len] = 0; > +  return name; > +} > + > +static cdi_fs_res_class_t parse_class(mode_t mode,cdi_fs_res_type_t > *special) { +  cdi_fs_res_class_t class = CDI_FS_CLASS_FILE; > +  if (S_ISBLK(mode)) { > +    class = CDI_FS_CLASS_SPECIAL; > +    if (special!=NULL) *special = CDI_FS_BLOCK; > +  } > +  else if (S_ISCHR(mode)) { > +    class = CDI_FS_CLASS_SPECIAL; > +    if (special!=NULL) *special = CDI_FS_BLOCK; > +  } > +  else if (S_ISFIFO(mode)) { > +    class = CDI_FS_CLASS_SPECIAL; > +    if (special!=NULL) *special = CDI_FS_FIFO; > +  } > +  else if (S_ISSOCK(mode)) { > +    class = CDI_FS_CLASS_SPECIAL; > +    if (special!=NULL) *special = CDI_FS_SOCKET; > +  } > +  else if (S_ISREG(mode)) class = CDI_FS_CLASS_FILE; > +  else if (S_ISDIR(mode)) class = CDI_FS_CLASS_DIR; > +  else if (S_ISLNK(mode)) class = CDI_FS_CLASS_LINK; > +  return class; > +} > + > +static time_t parse_date(struct iso9660_dirrec_date *date) { > +  struct tm tm = { > +    .tm_sec = date->second, > +    .tm_min = date->minute, > +    .tm_hour = date->hour, > +    .tm_mday = date->day, > +    .tm_mon = date->month-1, > +    .tm_year = date->second > +  }; > +  return mktime(&tm); > +} > + > +struct iso9660_fs_res *iso9660_dirrec_load(struct iso9660_dirrec > *dirrec,struct iso9660_fs_res *parent,struct iso9660_voldesc_prim *voldesc) > { +  char *name = NULL; > +  time_t ctime = 0; > +  time_t atime = 0; > +  time_t mtime = 0; > +  cdi_fs_res_class_t class = 0; > +  cdi_fs_res_type_t type = 0; > +  mode_t mode; > + > +#ifdef ISO9660_USE_ROCKRIDGE > +  if > (iso9660_rockridge_scan(dirrec,&name,&mode,NULL,NULL,NULL,&atime,&ctime,&mt >ime)==0) { +    class = parse_class(mode,&type); > +  } > +  else { > +    name = NULL; > +    class = 0; > +#endif > +    ctime = parse_date(&(dirrec->date_creation)); > +    atime = ctime; > +    mtime = ctime; > +#ifdef ISO9660_USE_ROCKRIDGE > +  } > +#endif > +  if (name==NULL) name = > parse_name(dirrec->identifier,dirrec->identifier_length); dir.c:120: error: pointer targets in passing argument 1 of ?parse_name? differ in signedness > +  if (class==0) > class = > (dirrec->flags&ISO9660_DIRREC_DIR)?CDI_FS_CLASS_DIR:CDI_FS_CLASS_FILE; + > +  struct iso9660_fs_res *new = > iso9660_fs_res_create(name,parent,class,type); +  if (voldesc!=NULL) > new->voldesc = voldesc; > +  new->ctime = ctime; > +  new->atime = atime; > +  new->mtime = mtime; > +  new->data_sector = dirrec->data_sector; > +  new->data_size = dirrec->data_size; > + > +  free(name); > +  return new; > +} > + > +cdi_list_t iso9660_dir_load(struct iso9660_fs_res *res) { > +  fprintf(stderr,"iso9660_dir_load(0x%x(%s))\n",res,res->res.name); > +  struct iso9660_dirrec *dirrec; > +  size_t i = 0; > +  cdi_list_t dirlist = cdi_list_create(); > +  size_t curpos = 0; > + > +  while (1) { > +    uint8_t size; > + > +    iso9660_read(res,curpos,1,&size); > +    //cdi_cache_entry_read(res->cache_entry,curpos,1,&size); > +    if (size==0) break; > + > +    dirrec = malloc(size); > +    iso9660_read(res,curpos,size,dirrec); > +    //cdi_cache_entry_read(res->cache_entry,curpos,size,dirrec); > + > +    if (i>1) cdi_list_push(dirlist,iso9660_dirrec_load(dirrec,res,NULL)); > + > +    curpos += size; > +    i++; > +  } > + > +  return dirlist; > +} > + > +cdi_list_t iso9660_fs_dir_list(struct cdi_fs_stream *stream) { > +  struct iso9660_fs_res *res = (struct iso9660_fs_res*)stream->res; > + > +  return res->res.children; > +} > diff -urNp tmp/directory_record.h iso9660/directory_record.h > --- tmp/directory_record.h      1970-01-01 01:00:00.000000000 +0100 > +++ iso9660/directory_record.h  2008-09-20 20:39:36.000000000 +0200 > @@ -0,0 +1,93 @@ > +/* > + * iso9660 - An iso9660 CDI driver with Rockridge support > + * > + * Copyright (C) 2008 Janosch Gräf > + * > + * 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 3 of the License, or (at your > option) + * any later version. > + * > + * This program is distributed in the hope that it will be useful, but > WITHOUT + * ANY WARRANTY; without even the implied warranty of > MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU > General Public License for + * more details. > + * > + * You should have received a copy of the GNU General Public License along > with + * this program; if not, see . > + */ > + > +#ifndef _DIRECTORY_RECORD_H_ > +#define _DIRECTORY_RECORD_H_ > + > +#include > + > +struct iso9660_dirrec_date { > +  // Number of years since 1900 > +  uint8_t year; > + > +  // Month (1=January, 2=February) > +  uint8_t month; > + > +  // Day of month > +  uint8_t day; > + > +  // Hour > +  uint8_t hour; > + > +  // Minute > +  uint8_t minute; > + > +  // Second > +  uint8_t second; > + > +  // GMT offset (in 15min intervals) > +  int8_t gmtoff; > +} __attribute__ ((packed)); > + > +#define ISO9660_DIRREC_HIDDEN   1 > +#define ISO9660_DIRREC_DIR      2 > +#define ISO9660_DIRREC_ASSOC    4 > +#define ISO9660_DIRREC_RECFMT   8 > +#define ISO9660_DIRREC_PERM     16 > +#define ISO9660_DIRREC_NOTFINAL 128 > + > +struct iso9660_dirrec { > +  // Size of this record (must be even) > +  uint8_t record_size; > + > +  // Number of sectors in extended attribute record > +  uint8_t num_sectors_extattrrec; > + > +  // First sector for file/directory data (0 if empty) > +  uint32_t data_sector; > +  uint32_t data_sector_be; > + > +  // File/directory data size > +  uint32_t data_size; > +  uint32_t data_size_be; > + > +  // Date of creation > +  struct iso9660_dirrec_date date_creation; > + > +  // File flags > +  uint8_t flags; > + > +  // Unit size for interleaved files (should be 0) > +  uint8_t interleaved_unit_size; > + > +  // Gap size for interleaved files (should be 0) > +  uint8_t interleaved_gap_size; > + > +  // Volume sequence number > +  uint16_t volume_seq; > +  uint16_t volume_seq_be; > + > +  // Identifier length > +  uint8_t identifier_length; > + > +  // Identifier > +  uint8_t identifier[1]; > +} __attribute__ ((packed)); > + > +#endif > diff -urNp tmp/file.c iso9660/file.c > --- tmp/file.c  1970-01-01 01:00:00.000000000 +0100 > +++ iso9660/file.c      2008-09-20 20:39:09.000000000 +0200 > @@ -0,0 +1,43 @@ > +/* > + * iso9660 - An iso9660 CDI driver with Rockridge support > + * > + * Copyright (C) 2008 Janosch Gräf > + * > + * 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 3 of the License, or (at your > option) + * any later version. > + * > + * This program is distributed in the hope that it will be useful, but > WITHOUT + * ANY WARRANTY; without even the implied warranty of > MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU > General Public License for + * more details. > + * > + * You should have received a copy of the GNU General Public License along > with + * this program; if not, see . > + */ > + > +#include "cdi/fs.h" > +#include "cdi/cache.h" > + > +#include "iso9660_cdi.h" > + > +/** > + * Reads from file > + *  @param stream CDI FS stream > + *  @param start Offset in flie > + *  @param size How many bytes to read > + *  @param buffer Buffer to store data in > + *  @return How many bytes read > + */ > +size_t iso9660_fs_file_read(struct cdi_fs_stream *stream,uint64_t > start,size_t size,void *buffer) { + >  fprintf(stderr,"iso9660_fs_file_read(0x%x,0x%x,0x%x,0x%x,0x%x)\n",stream,s >tart,size,buffer); +  struct iso9660_fs_res *res = (struct > iso9660_fs_res*)stream->res; + > +  if (start>res->data_size) return 0; > +  if (start+size>res->data_size) size = res->data_size-start; > + > +  iso9660_read(res,start,size,buffer); > +  //cdi_cache_entry_read(res->cache_entry,start,size,buffer); > +  return size; > +} > diff -urNp tmp/init.c iso9660/init.c > --- tmp/init.c  1970-01-01 01:00:00.000000000 +0100 > +++ iso9660/init.c      2008-09-20 20:39:11.000000000 +0200 > @@ -0,0 +1,58 @@ > +/* > + * iso9660 - An iso9660 CDI driver with Rockridge support > + * > + * Copyright (C) 2008 Janosch Gräf > + * > + * 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 3 of the License, or (at your > option) + * any later version. > + * > + * This program is distributed in the hope that it will be useful, but > WITHOUT + * ANY WARRANTY; without even the implied warranty of > MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU > General Public License for + * more details. > + * > + * You should have received a copy of the GNU General Public License along > with + * this program; if not, see . > + */ > + > +#include > +#include stdlib.h fehlt wieder > + > +#include "cdi/fs.h" > +#include "cdi/cache.h" > + > +#include "iso9660_cdi.h" > + > +#include "volume_descriptor.h" > + > +/** > + * Initializes a ISO9660 filesystem > + *  @param fs Filesystem to initialize > + *  @return If initialization was successful > + */ > +int iso9660_fs_init(struct cdi_fs_filesystem *fs) { > +  fprintf(stderr,"iso9660_fs_init(0x%x)\n",fs); > +  struct iso9660_voldesc_prim *voldesc = malloc(sizeof(struct > iso9660_voldesc_prim)); +  if > (iso9660_voldesc_load(fs,ISO9660_VOLDESC_PRIM,voldesc)!=-1) { +    struct > iso9660_fs_res *root_res = > iso9660_dirrec_load(&voldesc->root_dir,NULL,voldesc); +    root_res->cache > = > cdi_cache_create(voldesc->sector_size,0,iso9660_sector_read_cache,NULL,fs); init.c:41: error: passing argument 3 of ?cdi_cache_create? from incompatible pointer type Scheint der Rückgabewert zu sein, size_t statt int > +    fs->root_res = (struct cdi_fs_res*)root_res; > +    return 1; > +  } > +  else return 0; > +} > + > +/** > + * Destroys a FS > + *  @param fs Filesystem to destroy > + *  @return If destroy was successful > + */ > +int iso9660_fs_destroy(struct cdi_fs_filesystem *fs) { > +  fprintf(stderr,"iso9660_fs_destroy(0x%x)\n",fs); > +  struct iso9660_fs_res *root_res = (struct > iso9660_fs_res*)(fs->root_res); +  free(root_res->voldesc); > +  cdi_cache_destroy(root_res->cache); > +  return iso9660_fs_res_destroy(root_res); > +} > diff -urNp tmp/iso9660_cdi.h iso9660/iso9660_cdi.h > --- tmp/iso9660_cdi.h   1970-01-01 01:00:00.000000000 +0100 > +++ iso9660/iso9660_cdi.h       2008-09-20 20:39:13.000000000 +0200 > @@ -0,0 +1,94 @@ > +/* > + * iso9660 - An iso9660 CDI driver with Rockridge support > + * > + * Copyright (C) 2008 Janosch Gräf > + * > + * 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 3 of the License, or (at your > option) + * any later version. > + * > + * This program is distributed in the hope that it will be useful, but > WITHOUT + * ANY WARRANTY; without even the implied warranty of > MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU > General Public License for + * more details. > + * > + * You should have received a copy of the GNU General Public License along > with + * this program; if not, see . > + */ > + > +#ifndef _ISO9660_CDI_H_ > +#define _ISO9660_CDI_H_ > + > +#include > +#include > + > +#include "cdi/fs.h" > +#include "cdi/cache.h" > +#include "cdi/lists.h" > + > +#include "iso9660def.h" > +#include "volume_descriptor.h" > + > +#include > + > +// ISO9660 Resource > +struct iso9660_fs_res { > +  struct cdi_fs_res res; > + > +  // Creation time > +  time_t ctime; > + > +  // Access time > +  time_t atime; > + > +  // Modification time > +  time_t mtime; > + > +  // First sector with the resource data > +  uint64_t data_sector; > + > +  // Size of resource data > +  uint32_t data_size; > + > +  // File class > +  cdi_fs_res_class_t class; > + > +  // Primary volume descriptor > +  struct iso9660_voldesc_prim *voldesc; > + > +  // Cache > +  struct cdi_cache *cache; > +}; > + > +// init.c > +int iso9660_fs_init(struct cdi_fs_filesystem *fs); > +int iso9660_fs_destroy(struct cdi_fs_filesystem *fs); > + > +// res.c > +struct iso9660_fs_res *iso9660_fs_res_create(const char *name,struct > iso9660_fs_res *parent,cdi_fs_res_class_t class,cdi_fs_res_type_t type); > +int iso9660_fs_res_destroy(struct iso9660_fs_res *res); > +int iso9660_fs_res_load(struct cdi_fs_stream *stream); > +int iso9660_fs_res_unload(struct cdi_fs_stream *stream); > +int64_t iso9660_fs_res_meta_read(struct cdi_fs_stream > *stream,cdi_fs_meta_t meta); + > +// file.c > +size_t iso9660_fs_file_read(struct cdi_fs_stream *stream,uint64_t > start,size_t size,void *buffer); + > +// dir.c > +cdi_list_t iso9660_dir_load(struct iso9660_fs_res *res); > +struct iso9660_fs_res *iso9660_dirrec_load(struct iso9660_dirrec > *dirrec,struct iso9660_fs_res *parent,struct iso9660_voldesc_prim > *voldesc); +cdi_list_t iso9660_fs_dir_list(struct cdi_fs_stream *stream); > + > +// Sector > +#define iso9660_sector_read(fs,start,size,buffer) > cdi_fs_data_read(fs,start,size,buffer) +size_t iso9660_read(struct > iso9660_fs_res *res,size_t pos,size_t size,void *buffer); +size_t > iso9660_sector_read_cache(struct cdi_cache *cache,uint64_t block,size_t > count,void *dest,void *prv); + > +// Resources > +extern struct cdi_fs_res_res    iso9660_fs_res_res; > +extern struct cdi_fs_res_file   iso9660_fs_res_file; > +extern struct cdi_fs_res_dir    iso9660_fs_res_dir; > + > + > +#endif > diff -urNp tmp/iso9660def.h iso9660/iso9660def.h > --- tmp/iso9660def.h    1970-01-01 01:00:00.000000000 +0100 > +++ iso9660/iso9660def.h        2008-09-20 20:39:13.000000000 +0200 > @@ -0,0 +1,38 @@ > +/* > + * iso9660 - An iso9660 CDI driver with Rockridge support > + * > + * Copyright (C) 2008 Janosch Gräf > + * > + * 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 3 of the License, or (at your > option) + * any later version. > + * > + * This program is distributed in the hope that it will be useful, but > WITHOUT + * ANY WARRANTY; without even the implied warranty of > MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU > General Public License for + * more details. > + * > + * You should have received a copy of the GNU General Public License along > with + * this program; if not, see . > + */ > + > +#ifndef _ISO9660DEF_H_ > +#define _ISO9660DEF_H_ > + > +// Default sector size. Used to load volume descriptors > +#define ISO9660_DEFAULT_SECTOR_SIZE 2048 > + > +// Number of first used sector (first volume descriptor) > +#define ISO9660_FIRST_SECTOR        16 > + > +// Define if you want to use lower filenames > +// (if you don't use an extension that supports lower filenames) > +#define ISO9660_LOWER_FILENAMES > + > +#ifndef ISO9660_USE_ROCKRIDGE > +  // Define if you want to use Rockridge extension > +  #define ISO9660_USE_ROCKRIDGE > +#endif > + > +#endif > diff -urNp tmp/main.c iso9660/main.c > --- tmp/main.c  1970-01-01 01:00:00.000000000 +0100 > +++ iso9660/main.c      2008-09-20 20:39:16.000000000 +0200 > @@ -0,0 +1,73 @@ > +/* > + * iso9660 - An iso9660 CDI driver with Rockridge support > + * > + * Copyright (C) 2008 Janosch Gräf > + * > + * 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 3 of the License, or (at your > option) + * any later version. > + * > + * This program is distributed in the hope that it will be useful, but > WITHOUT + * ANY WARRANTY; without even the implied warranty of > MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU > General Public License for + * more details. > + * > + * You should have received a copy of the GNU General Public License along > with + * this program; if not, see . > + */ > + > +#include "cdi/fs.h" > + > +#include "iso9660_cdi.h" > + > +struct iso9660_driver { > +  struct cdi_fs_driver drv; > +}; > + > +static struct iso9660_driver iso9660_driver; > +static const char* driver_name = "iso9660"; > + > +static int iso9660_driver_init(struct iso9660_driver *driver); > +static void iso9660_driver_destroy(struct iso9660_driver *driver); > + > +#ifdef CDI_STANDALONE > +int main() > +#else > +int init_iso9660() > +#endif > +{ > +    cdi_init(); > + > +    if (iso9660_driver_init(&iso9660_driver)!=0) return -1; > +    cdi_fs_driver_register((struct cdi_fs_driver*)&iso9660_driver); > + > +#ifdef CDI_STANDALONE > +    cdi_run_drivers(); > +#endif > + > +    return 0; > +} > + > +/** > + * Initialisiert die Datenstrukturen fuer den iso9660-Treiber > + */ > +static int iso9660_driver_init(struct iso9660_driver *driver) { > +    // Konstruktor der Vaterklasse > +    cdi_fs_driver_init((struct cdi_fs_driver*)driver); > + > +    // Namen setzen > +    driver->drv.drv.name = driver_name; > +    driver->drv.fs_init = iso9660_fs_init; > +    driver->drv.fs_destroy = iso9660_fs_destroy; > +    driver->drv.drv.destroy = iso9660_driver_destroy; > +    return 0; > +} > + > +/** > + * Deinitialisiert die Datenstrukturen fuer den iso9660-Treiber > + */ > +static void iso9660_driver_destroy(struct iso9660_driver* driver) Das sollte einen struct cdi_driver* als Parameter bekommen. > +{ > +    cdi_fs_driver_destroy((struct cdi_fs_driver*)driver); > +} > diff -urNp tmp/Makefile iso9660/Makefile > --- tmp/Makefile        1970-01-01 01:00:00.000000000 +0100 > +++ iso9660/Makefile    2008-09-20 20:14:09.000000000 +0200 > @@ -0,0 +1,13 @@ > +-include ../../Makefile.config > + > +all: > +       $(CC) -o iso9660 *.c -lcdi > +       $(STRIP) iso9660 > +       cp iso9660 ../../files/bin > + > +debug: > +       $(CC) -o iso9660 *.c -lcdi > +       $(OBJDUMP) -d -S iso9660 > iso9660.objdump > + > +clean: > +       rm iso9660 > diff -urNp tmp/res.c iso9660/res.c > --- tmp/res.c   1970-01-01 01:00:00.000000000 +0100 > +++ iso9660/res.c       2008-09-20 20:39:26.000000000 +0200 > @@ -0,0 +1,150 @@ > +/* > + * iso9660 - An iso9660 CDI driver with Rockridge support > + * > + * Copyright (C) 2008 Janosch Gräf > + * > + * 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 3 of the License, or (at your > option) + * any later version. > + * > + * This program is distributed in the hope that it will be useful, but > WITHOUT + * ANY WARRANTY; without even the implied warranty of > MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU > General Public License for + * more details. > + * > + * You should have received a copy of the GNU General Public License along > with + * this program; if not, see . > + */ > + > +#include > +#include > +#include > +#include > + > +#include "cdi/lists.h" > +#include "cdi/fs.h" > +#include "cdi/cache.h" > + > +#include "volume_descriptor.h" > + > +#include "iso9660_cdi.h" > + > +/** > + * Creates a new resource > + *  @param name Name of resource > + *  @param parent Parent resource > + *  @param class File class > + *  @param type Special file type > + *  @return ISO9660 class > + */ > +struct iso9660_fs_res *iso9660_fs_res_create(const char *name,struct > iso9660_fs_res *parent,cdi_fs_res_class_t class,cdi_fs_res_type_t type) { + >  fprintf(stderr,"iso9660_fs_res_create(%s,0x%x,%d)\n",name,parent,class); + >  struct iso9660_fs_res *res = malloc(sizeof(struct iso9660_fs_res)); + > +  memset(res,0,sizeof(struct iso9660_fs_res)); > +  res->res.name = strdup(name); > +  res->res.res = &iso9660_fs_res_res; > +  res->res.parent = (struct cdi_fs_res*)parent; > +  res->class = class; > +  res->res.type = type; > +  if (class==CDI_FS_CLASS_DIR) res->res.dir = &iso9660_fs_res_dir; > +  else res->res.file = &iso9660_fs_res_file; > +  res->res.flags.read = 1; > +  res->res.flags.execute = 1; > +  res->res.flags.browse = 1; > +  res->res.flags.read_link = 1; > + > +  if (parent!=NULL) { > +    res->voldesc = parent->voldesc; > +    res->cache = parent->cache; > +  } > +  return res; > +} > + > +/** > + * Destroys a resource > + *  @param res ISO9660 resource > + *  @return 0=success; -1=failure > + */ > +int iso9660_fs_res_destroy(struct iso9660_fs_res *res) { > +  fprintf(stderr,"iso9660_fs_res_destroy(0x%x)\n",res); > +  free(res->res.name); > +  if (res->res.children!=NULL) { > +    size_t i; > +    struct iso9660_fs_res *child; > +    for (i=0;(child = cdi_list_get(res->res.children,i));i++) > iso9660_fs_res_destroy(child); +    cdi_list_destroy(res->res.children); > +  } > +  return 0; > +} > + > +/** > + * Loads a resource > + *  @param stream CDI FS stream > + *  @return 0=success; -1=failure > + */ > +int iso9660_fs_res_load(struct cdi_fs_stream *stream) { > +  struct iso9660_fs_res *res = (struct iso9660_fs_res*)stream->res; > + > +  if (!res->res.loaded) { > +    // Create cache > +    //size_t i; > +    //for (i=0;idata_size;i+=res->voldesc->sector_size) > cdi_cache_entry_new(res->cache,res->data_offset+i,res->voldesc->sector_size >); + > +    if (res->class==CDI_FS_CLASS_DIR) res->res.children = > iso9660_dir_load(res); +    else res->res.children = cdi_list_create(); > +    res->res.loaded = 1; > +  } > +  return 1; > +} > + > +/** > + * Unloads a resource > + *  @param stream CDI FS stream > + *  @return 0=success; -1=failure > + */ > +int iso9660_fs_res_unload(struct cdi_fs_stream *stream) { > +  struct iso9660_fs_res *res = (struct iso9660_fs_res*)stream->res; > + > +  if (res->res.loaded) { > +    // Destroy children > +    struct iso9660_fs_res *child; > +    while (child = cdi_list_pop(res->res.children)) Ein zusätzliches Klammerpaar gegen Compilerwarnungen. > iso9660_fs_res_destroy(child); +    cdi_list_destroy(res->res.children); > + > +    res->res.loaded = 0; > +  } > +  return 1; > +} > + > +/** > + * Reads meta data from resource > + *  @param stream CDI FS stream > + *  @param meta Type of meta data > + *  @return Meta data > + */ > +int64_t iso9660_fs_res_meta_read(struct cdi_fs_stream > *stream,cdi_fs_meta_t meta) { +  struct iso9660_fs_res *res = (struct > iso9660_fs_res*)stream->res; +  switch (meta) { > +    case CDI_FS_META_SIZE: > +      return res->data_size; > + > +    case CDI_FS_META_USEDBLOCKS: > +      return (res->data_size-1)/res->voldesc->sector_size+1; > + > +    case CDI_FS_META_BESTBLOCKSZ: > +    case CDI_FS_META_BLOCKSZ: > +      return res->voldesc->sector_size; > + > +    case CDI_FS_META_CREATETIME: > +      return res->ctime; > + > +    case CDI_FS_META_ACCESSTIME: > +      return res->atime; > + > +    case CDI_FS_META_CHANGETIME: > +      return res->mtime; > +  } > +  return 0; > +} > diff -urNp tmp/resources.c iso9660/resources.c > --- tmp/resources.c     1970-01-01 01:00:00.000000000 +0100 > +++ iso9660/resources.c 2008-09-20 20:39:27.000000000 +0200 > @@ -0,0 +1,38 @@ > +/* > + * iso9660 - An iso9660 CDI driver with Rockridge support > + * > + * Copyright (C) 2008 Janosch Gräf > + * > + * 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 3 of the License, or (at your > option) + * any later version. > + * > + * This program is distributed in the hope that it will be useful, but > WITHOUT + * ANY WARRANTY; without even the implied warranty of > MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU > General Public License for + * more details. > + * > + * You should have received a copy of the GNU General Public License along > with + * this program; if not, see . > + */ > + > +#include "iso9660_cdi.h" > + > +struct cdi_fs_res_res iso9660_fs_res_res = { > +    .load = iso9660_fs_res_load, > +    .unload = iso9660_fs_res_unload, > +    .meta_read = iso9660_fs_res_meta_read, > +}; > + > +struct cdi_fs_res_file iso9660_fs_res_file = { > +    // Prinzipiell haben wir nur ausfuehrbare Dateien, der Rest wird mit > den +    // Berechtigungen geregelt > +    .executable = 1, > + > +    .read = iso9660_fs_file_read, > +}; > + > +struct cdi_fs_res_dir iso9660_fs_res_dir = { > +    .list = iso9660_fs_dir_list, > +}; > diff -urNp tmp/rockridge.c iso9660/rockridge.c > --- tmp/rockridge.c     1970-01-01 01:00:00.000000000 +0100 > +++ iso9660/rockridge.c 2008-09-20 20:40:59.000000000 +0200 > @@ -0,0 +1,89 @@ > +/* > + * iso9660 - An iso9660 CDI driver with Rockridge support > + * > + * Copyright (C) 2008 Janosch Gräf > + * > + * 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 3 of the License, or (at your > option) + * any later version. > + * > + * This program is distributed in the hope that it will be useful, but > WITHOUT + * ANY WARRANTY; without even the implied warranty of > MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU > General Public License for + * more details. > + * > + * You should have received a copy of the GNU General Public License along > with + * this program; if not, see . > + */ > + > +#include "iso9660def.h" > +#ifdef ISO9660_USE_ROCKRIDGE > + > +#include > +#include > +#include > +#include > +#include > + > +#include "cdi/lists.h" > + > +#include "rockridge.h" > +#include "directory_record.h" > + > +/** > + * Scans system use area in directory record for rockridge entries > + *  @param dirrec Directory record > + *  @param _name Reference for POSIX name > + *  @param mode Reference for file mode > + *  @param uid Reference for UID > + *  @param gid Reference for GID > + *  @param nlink Reference for number of hardlinks > + *  @param atime Reference for access time > + *  @param ctime Reference for createtion time > + *  @param mtime Reference for modification time > + *  @return 0=success; -1=failure > + */ > +int iso9660_rockridge_scan(struct iso9660_dirrec *dirrec,char > **_name,mode_t *mode,uid_t *uid,gid_t *gid,nlink_t *nlink,time_t > *atime,time_t *ctime,time_t *mtime) { +  struct iso9660_rockridge *sue = > ((void*)(dirrec->identifier))+dirrec->identifier_length; +  if > ((((uintptr_t)sue)&1)==1) sue = ((void*)sue)+1; > + > +  if (sue->sig!=ISO9660_ROCKRIDGE_SIG_RR) return -1; > + > +  char *name = NULL; > +  size_t name_size = 0; > + > +  while (sue->sig!=ISO9660_ROCKRIDGE_SIG_ST && sue->sig!=0 && > ((uintptr_t)sue-(uintptr_t)dirrec)+4record_size) { +    if > (sue->sig==ISO9660_ROCKRIDGE_SIG_PX) { > +      struct iso9660_rockridge_px *sue_px = (struct > iso9660_rockridge_px*)sue; +      if (mode!=NULL) *mode = sue_px->mode; > +      if (nlink!=NULL) *nlink = sue_px->nlink; > +      if (uid!=NULL) *uid = sue_px->uid; > +      if (gid!=NULL) *gid = sue_px->gid; > +    } > +    else if (sue->sig==ISO9660_ROCKRIDGE_SIG_NM) { > +      struct iso9660_rockridge_nm *sue_nm = (struct > iso9660_rockridge_nm*)sue; +      if > (sue_nm->flags&ISO9660_ROCKRIDGE_NAMEFLAG_CURRENT) *_name = strdup("."); + >      else if (sue_nm->flags&ISO9660_ROCKRIDGE_NAMEFLAG_PARENT) *_name = > strdup(".."); +      else { > +        size_t part_size = sue->size-offsetof(struct > iso9660_rockridge_nm,name); +        name = > realloc(name,name_size+part_size+1); > +        memcpy(name+name_size,sue_nm->name,part_size); > +        name_size += part_size; > +      } > +    } > +    sue = ((void*)sue)+sue->size; > +  } > + > +  if (name!=NULL) { > +    if (_name!=NULL) { > +      name[name_size] = 0; > +      *_name = name; > +    } > +    else free(name); > +  } > + > +  return 0; > +} > + > +#endif > diff -urNp tmp/rockridge.h iso9660/rockridge.h > --- tmp/rockridge.h     1970-01-01 01:00:00.000000000 +0100 > +++ iso9660/rockridge.h 2008-09-20 20:39:28.000000000 +0200 > @@ -0,0 +1,160 @@ > +/* > + * iso9660 - An iso9660 CDI driver with Rockridge support > + * > + * Copyright (C) 2008 Janosch Gräf > + * > + * 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 3 of the License, or (at your > option) + * any later version. > + * > + * This program is distributed in the hope that it will be useful, but > WITHOUT + * ANY WARRANTY; without even the implied warranty of > MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU > General Public License for + * more details. > + * > + * You should have received a copy of the GNU General Public License along > with + * this program; if not, see . > + */ > + > +#ifndef _ISO9660_ROCKRIDGE_H_ > +#define _ISO9660_ROCKRIDGE_H_ > + > +#include > +#include > + > +#include "directory_record.h" > + > +#define ISO9660_ROCKRIDGE_VERSION 1 > + > +#define ISO9660_ROCKRIDGE_SL_FLAG_LAST 1 > + > +#define ISO9660_ROCKRIDGE_NAMEFLAG_CONTINUE 1 > +#define ISO9660_ROCKRIDGE_NAMEFLAG_CURRENT  2 > +#define ISO9660_ROCKRIDGE_NAMEFLAG_PARENT   4 > +#define ISO9660_ROCKRIDGE_NAMEFLAG_ROOT     8 > + > +#define ISO9660_ROCKRIDGE_TFFLAG_CREATION   1 > +#define ISO9660_ROCKRIDGE_TFFLAG_MODIFY     2 > +#define ISO9660_ROCKRIDGE_TFFLAG_ACCESS     4 > +#define ISO9660_ROCKRIDGE_TFFLAG_ATTRIBUTES 8 > +#define ISO9660_ROCKRIDGE_TFFLAG_BACKUP     16 > +#define ISO9660_ROCKRIDGE_TFFLAG_EXPIRATION 32 > +#define ISO9660_ROCKRIDGE_TFFLAG_EFFECTIVE  64 > +#define ISO9660_ROCKRIDGE_TFFLAG_LONGFORM   128 > + > +#define ISO9660_ROCKRIDGE_SIG_SP ('S'|('P'<<8)) > +#define ISO9660_ROCKRIDGE_SIG_ST ('S'|('T'<<8)) > +#define ISO9660_ROCKRIDGE_SIG_RR ('R'|('R'<<8)) ///< @todo Actually the > SUE must start with SP and not with RR +#define ISO9660_ROCKRIDGE_SIG_PX > ('P'|('X'<<8)) > +#define ISO9660_ROCKRIDGE_SIG_PN ('P'|('N'<<8)) > +#define ISO9660_ROCKRIDGE_SIG_SL ('S'|('L'<<8)) > +#define ISO9660_ROCKRIDGE_SIG_NM ('N'|('M'<<8)) > +#define ISO9660_ROCKRIDGE_SIG_CL ('C'|('L'<<8)) > +#define ISO9660_ROCKRIDGE_SIG_PL ('P'|('L'<<8)) > +#define ISO9660_ROCKRIDGE_SIG_RE ('R'|('E'<<8)) > +#define ISO9660_ROCKRIDGE_SIG_RF ('R'|('F'<<8)) > +#define ISO9660_ROCKRIDGE_SIG_SF ('S'|('F'<<8)) > + > +// Rockridge System Use Entry > +struct iso9660_rockridge { > +  // Field signature > +  uint16_t sig; > + > +  // Size of field > +  uint8_t size; > + > +  // Version > +  uint8_t version; > +} __attribute__ ((packed)); > + > +///< @todo Actually the SUE must start with SP and not with RR > +struct iso9660_rockridge_rr { > +  // Size: 5 > +  struct iso9660_rockridge header; > +  uint8_t unknown; > +} __attribute__ ((packed)); > + > +// Rockridge System Use Entry for file permissions > +struct iso9660_rockridge_px { > +  // Size: 44 > +  struct iso9660_rockridge header; > + > +  // File mode (like in sys/stat.h) > +  uint32_t mode; > +  uint32_t mode_be; > + > +  // Number of links (like in sys/stat.h) > +  uint32_t nlink; > +  uint32_t nlink_be; > + > +  // Owner UID > +  uint32_t uid; > +  uint32_t uid_be; > + > +  // Owner GID > +  uint32_t gid; > +  uint32_t gid_be; > + > +  // File serial number > +  uint32_t serial; > +  uint32_t serial_be; > +} __attribute__ ((packed)); > + > +// Rockridge System Use Entry for device nodes > +struct iso9660_rockridge_pn { > +  // Size: 20 > +  struct iso9660_rockridge header; > + > +  // Device number > +  uint32_t devhi; > +  uint32_t devhi_be; > +  uint32_t devlo; > +  uint32_t devlo_be; > +} __attribute__ ((packed)); > + > +// Rockridge SL Component > +struct iso9660_rockridge_sl_component { > +  uint8_t flags; > +  uint8_t len; > +  uint8_t content[0]; > +} __attribute__ ((packed)); > + > +// Rockridge System Use Entry for symbolic links > +struct iso9660_rockridge_sl { > +  // Size: > +  struct iso9660_rockridge header; > + > +  // Flags > +  uint8_t flags; > + > +  // Component Area > +  struct iso9660_rockridge_sl_component component_area[0]; > +} __attribute__ ((packed)); > + > +// Rockridge System Use Entry for POSIX names > +struct iso9660_rockridge_nm { > +  // Size: > +  struct iso9660_rockridge header; > + > +  // Flags > +  uint8_t flags; > + > +  // Name content > +  uint8_t name[1]; > +} __attribute__ ((packed)); > + > +// Rockridge System Use Entry for timestamps > +struct iso9660_rockridge_tf { > +  // Size: > +  struct iso9660_rockridge header; > + > +  // Flags (Type of timestamp > +  uint8_t flags; > + > +  /// @todo > +} __attribute__ ((packed)); > + > +int iso9660_rockridge_scan(struct iso9660_dirrec *dirrec,char > **_name,mode_t *mode,uid_t *uid,gid_t *gid,nlink_t *nlink,time_t > *atime,time_t *ctime,time_t *mtime); + > +#endif > diff -urNp tmp/sector.c iso9660/sector.c > --- tmp/sector.c        1970-01-01 01:00:00.000000000 +0100 > +++ iso9660/sector.c    2008-09-20 20:39:29.000000000 +0200 > @@ -0,0 +1,85 @@ > +/* > + * iso9660 - An iso9660 CDI driver with Rockridge support > + * > + * Copyright (C) 2008 Janosch Gräf > + * > + * 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 3 of the License, or (at your > option) + * any later version. > + * > + * This program is distributed in the hope that it will be useful, but > WITHOUT + * ANY WARRANTY; without even the implied warranty of > MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU > General Public License for + * more details. > + * > + * You should have received a copy of the GNU General Public License along > with + * this program; if not, see . > + */ > + > +#include > + > +#include "cdi/fs.h" > +#include "cdi/cache.h" > + > +#include "iso9660def.h" > + > +#include "iso9660_cdi.h" > + > +/** > + * Reads data from device for cache > + *  @param cache CDI cache > + *  @param block Block to read > + *  @param count How many blocks to read > + *  @param dest Buffer to store data in > + *  @param prv Private data (CDI filesystem) > + *  @return 0=success; -1=failure > + */ > +size_t iso9660_sector_read_cache(struct cdi_cache *cache,uint64_t > block,size_t count,void *dest,void *prv) { + >  fprintf(stderr,"iso9660_sector_read_cache(0x%x,0x%x,0x%x,0x%x,0x%x,0x%x)\n >",cache,block,count,dest,prv); +  uint64_t start = > ((uint64_t)block)*ISO9660_DEFAULT_SECTOR_SIZE; +  size_t size = > count*ISO9660_DEFAULT_SECTOR_SIZE; > +  return > iso9660_sector_read(prv,start,size,dest)/ISO9660_DEFAULT_SECTOR_SIZE; +} > + > +/** > + * Read data from resource > + *  @param res Resource to read data from > + *  @param pos Position in resource > + *  @param size How many bytes to read > + *  @param Buffer Buffer to store data in > + *  @return How many bytes read > + */ > +size_t iso9660_read(struct iso9660_fs_res *res,size_t pos,size_t size,void > *buffer) { +  size_t block = pos/res->voldesc->sector_size; > +  size_t offset = pos%res->voldesc->sector_size; > +  size_t rem_size = size; > + > +  while (rem_size>0) { > +    //fprintf(stderr,"Block: 0x%x\n",res->data_sector+block++); > +    struct cdi_cache_block *cache_block = > cdi_cache_block_get(res->cache,res->data_sector+block++); +    size_t > cur_size = > rem_size>res->voldesc->sector_size?res->voldesc->sector_size:rem_size; +   >  memcpy(buffer,cache_block->data+offset,cur_size); > +    cdi_cache_block_release(res->cache,cache_block); > +    buffer += cur_size; > +    rem_size -= cur_size; > +    offset = 0; > +  } > + > +  return size; > +} > + > +/* > +int iso9660_sector_read_cache(struct cdi_cache *cache,uint64_t > block,size_t count,void *dest,void *prv) { +  struct cdi_fs_filesystem *fs > = prv; > +  struct iso9660_fs_res *res = (struct iso9660_fs_res*)fs->root_res; > +  uint64_t start = ((uint64_t)block)*ISO9660_DEFAULT_SECTOR_SIZE; > +  size_t size = count*ISO9660_DEFAULT_SECTOR_SIZE; > +  uint64_t maxsize = > ((uint64_t)res->voldesc->num_sectors)*res->voldesc->sector_size; + > +  if (start>maxsize) return 0; > +  if (start+size>maxsize) size = maxsize-start; > + > +  return iso9660_sector_read(prv,start,size,dest)==size?0:-1; > +} > +*/ > diff -urNp tmp/volume_descriptor.c iso9660/volume_descriptor.c > --- tmp/volume_descriptor.c     1970-01-01 01:00:00.000000000 +0100 > +++ iso9660/volume_descriptor.c 2008-09-20 20:39:30.000000000 +0200 > @@ -0,0 +1,69 @@ > +/* > + * iso9660 - An iso9660 CDI driver with Rockridge support > + * > + * Copyright (C) 2008 Janosch Gräf > + * > + * 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 3 of the License, or (at your > option) + * any later version. > + * > + * This program is distributed in the hope that it will be useful, but > WITHOUT + * ANY WARRANTY; without even the implied warranty of > MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU > General Public License for + * more details. > + * > + * You should have received a copy of the GNU General Public License along > with + * this program; if not, see . > + */ > + > +#include > + > +#include "cdi/fs.h" > + > +#include "iso9660_cdi.h" > + > +#include "iso9660def.h" > +#include "volume_descriptor.h" > + > +/** > + * Checks signature of volume descriptor > + *  @param sig Signature > + *  @return If signature is right > + */ > +static int iso9660_voldesc_checksig(uint8_t sig[6]) { > +  size_t i; > +  char right[6] = {'C','D','0','0','1',1}; > +  for (i=0;i<6;i++) { > +    if (sig[i]!=right[i]) return 0; > +  } > +  return 1; > +} > + > +/** > + * Loads a volume descriptor > + *  @param fs Filesystem > + *  @param type Type of volume descriptor > + *  @param buf Buffer for volume descriptor > + *  @return 0=success; -1=failure > + */ > +int iso9660_voldesc_load(struct cdi_fs_filesystem > *fs,iso9660_voldesc_type_t type,void *buf) { + >  fprintf(stderr,"iso9660_voldesc_load(0x%x,%d,0x%x)\n",fs,type,buf); + >  struct iso9660_voldesc header; > +  size_t i; > + > +  for (i=ISO9660_FIRST_SECTOR;header.type!=type && > header.type!=ISO9660_VOLDESC_TERM;i++) { +   >  iso9660_sector_read(fs,i*ISO9660_DEFAULT_SECTOR_SIZE,sizeof(header),&heade >r); +    if (!iso9660_voldesc_checksig(header.signature)) return -1; > +  } > +  i--; > + > +  if (header.type==type) { > +    iso9660_sector_read(fs,i*ISO9660_DEFAULT_SECTOR_SIZE,sizeof(struct > iso9660_voldesc_prim),buf); +    return 0; > +  } > +  else { > +    fprintf(stderr,"Volume Descriptor: Wrong type: %d\n",header.type); > +    return -1; > +  } > +} > diff -urNp tmp/volume_descriptor.h iso9660/volume_descriptor.h > --- tmp/volume_descriptor.h     1970-01-01 01:00:00.000000000 +0100 > +++ iso9660/volume_descriptor.h 2008-09-20 20:38:23.000000000 +0200 > @@ -0,0 +1,160 @@ > +/* > + * iso9660 - An iso9660 CDI driver with Rockridge support > + * > + * Copyright (C) 2008 Janosch Gräf > + * > + * 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 3 of the License, or (at your > option) + * any later version. > + * > + * This program is distributed in the hope that it will be useful, but > WITHOUT + * ANY WARRANTY; without even the implied warranty of > MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU > General Public License for + * more details. > + * > + * You should have received a copy of the GNU General Public License along > with + * this program; if not, see . > + */ > + > +#ifndef _VOLUME_DESCRIPTOR_H_ > +#define _VOLUME_DESCRIPTOR_H_ > + > +#include > + > +#include "directory_record.h" > + > +typedef enum { > +  ISO9660_VOLDESC_TERM = 255, > +  ISO9660_VOLDESC_PRIM = 1 > +} iso9660_voldesc_type_t; > + > +struct iso9660_voldesc { > +  iso9660_voldesc_type_t type:8; > +  uint8_t signature[6]; > +} __attribute__ ((packed)); > + > +struct i9660_voldesc_date { > +  // Year (as ASCII) > +  uint32_t year[4]; > + > +  // Month (as ASCII; 01=January, 02=February...) > +  uint8_t month[2]; > + > +  // Day of month (as ASCII) > +  uint8_t day[2]; > + > +  // Hour (as ASCII) > +  uint8_t hour[2]; > + > +  // Minute (as ASCII) > +  uint8_t minute[2]; > + > +  // Second (as ASCII) > +  uint8_t second[2]; > + > +  // Centisecond (as ASCII; hundredths of a second) > +  uint8_t centisecond[2]; > + > +  // Offset to GMT (in 15min intervals) > +  int8_t gmtoff; > +} __attribute__ ((packed)); > + > +struct iso9660_voldesc_prim { > +  // Volume Descriptor Header > +  struct iso9660_voldesc header; > + > +  // Zeros (0) > +  uint8_t zero1; > + > +  // System Identifier > +  uint8_t system_identifier[32]; > + > +  // Volume Identifier > +  uint8_t volume_identifier[32]; > + > +  // Zeros (0) > +  uint8_t zero2[8]; > + > +  // Total number of sectors > +  uint32_t num_sectors; > +  uint32_t num_sectors_be; > + > +  // Zeros (0) > +  uint8_t zero3[32]; > + > +  // Set size (1) > +  uint16_t set_size; > +  uint16_t set_size_be; > + > +  // Sequence number (1) > +  uint16_t seq_num; > +  uint16_t seq_num_be; > + > +  // Sector size (must be 2048) > +  uint16_t sector_size; > +  uint16_t sector_size_be; > + > +  // Size of path table > +  uint32_t pathtable_size; > +  uint32_t pathtable_size_be; > + > +  // First sectors of each path table > +  uint32_t pathtable1_sector; > +  uint32_t pathtable2_sector; > +  uint32_t pathtable1_sector_be; > +  uint32_t pathtable2_sector_be; > + > +  // Root directory record > +  struct iso9660_dirrec root_dir; > + > +  // Volume Set Identifier > +  uint8_t volume_set_identifier[128]; > + > +  // Publisher Identifier > +  uint8_t publisher_identifier[128]; > + > +  // Data Preparer Identifier > +  uint8_t datapreparer_identifier[128]; > + > +  // Application Identifier > +  uint8_t application_identifier[128]; > + > +  // Copyright File Identifier > +  uint8_t copyright_file_identifier[37]; > + > +  // Abstract File Identifier > +  uint8_t abstract_file_identifier[37]; > + > +  // Bibliographical File Identifier > +  uint8_t bibliographical_file_identifier[37]; > + > +  // Date of volume creation > +  struct i9660_voldesc_date date_creation; > + > +  // Date of most recent modification > +  struct i9660_voldesc_date date_modification; > + > +  // Date when volume expires > +  struct i9660_voldesc_date date_expire; > + > +  // Date when volume is effective > +  struct i9660_voldesc_date date_effective; > +#if 0 > +  // Ones (1) > +  uint8_t one1; > + > +  // Zeros (0) > +  uint8_t zero4; > + > +  // Reserved (usally 0) > +  uint8_t reserved[512]; > + > +  // Zeros (0) > +  uint8_t zero5[653]; > +#endif > +} __attribute__ ((packed)); > + > +int iso9660_voldesc_load(struct cdi_fs_filesystem > *fs,iso9660_voldesc_type_t type,void *buf); + > +#endif > _______________________________________________ > Lost mailing list > Lost at tyndur.org > http://list.tyndur.org/mailman/listinfo/lost From toni at famkaufmann.info Sat Sep 20 21:31:29 2008 From: toni at famkaufmann.info (Antoine Kaufmann) Date: Sat, 20 Sep 2008 21:31:29 +0200 Subject: [Lost] [Patch] init-Fehlermeldung Message-ID: <20080920193128.GA30628@thales.produktiv.lan> - init: Booten mit init.cfg und Fehlermeldung entfernen -- Antoine Kaufmann -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : init_error.patch Dateityp : text/x-diff Dateigröße : 3592 bytes Beschreibung: nicht verfügbar URL : -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : nicht verfügbar Dateityp : application/pgp-signature Dateigröße : 197 bytes Beschreibung: nicht verfügbar URL : From mail at kevin-wolf.de Sat Sep 20 22:08:18 2008 From: mail at kevin-wolf.de (Kevin Wolf) Date: Sat, 20 Sep 2008 22:08:18 +0200 Subject: [Lost] [Patch] init-Fehlermeldung In-Reply-To: <20080920193128.GA30628@thales.produktiv.lan> References: <20080920193128.GA30628@thales.produktiv.lan> Message-ID: <200809202208.18831@kevin-wolf.de> Am Samstag, 20. September 2008 21:31:29 schrieb Antoine Kaufmann: > - init: Booten mit init.cfg und Fehlermeldung entfernen Ack From mail at kevin-wolf.de Sat Sep 20 22:12:07 2008 From: mail at kevin-wolf.de (Kevin Wolf) Date: Sat, 20 Sep 2008 22:12:07 +0200 Subject: [Lost] =?iso-8859-1?q?=5BPatch=5D_Ein_bi=DFchen_POSIX_f=FCr_iso96?= =?iso-8859-1?q?60?= Message-ID: <200809202212.07675@kevin-wolf.de> + POSIX: stat.h: S_ISFIFO und S_ISSOCK + POSIX: Stub für mktime -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : posix.patch Dateityp : text/x-diff Dateigröße : 1451 bytes Beschreibung: nicht verfügbar URL : From toni at famkaufmann.info Sat Sep 20 22:17:12 2008 From: toni at famkaufmann.info (Antoine Kaufmann) Date: Sat, 20 Sep 2008 22:17:12 +0200 Subject: [Lost] =?iso-8859-1?q?=5BPatch=5D_Ein_bi=DFchen_POSIX_f=FCr_iso96?= =?iso-8859-1?q?60?= In-Reply-To: <200809202212.07675@kevin-wolf.de> References: <200809202212.07675@kevin-wolf.de> Message-ID: <20080920201712.GA15468@thales.produktiv.lan> On Sat, Sep 20 22:12, Kevin Wolf wrote: > + POSIX: stat.h: S_ISFIFO und S_ISSOCK > + POSIX: Stub für mktime Ack. -- Antoine Kaufmann -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : nicht verfügbar Dateityp : application/pgp-signature Dateigröße : 197 bytes Beschreibung: nicht verfügbar URL : From toni at famkaufmann.info Sun Sep 21 10:32:20 2008 From: toni at famkaufmann.info (Antoine Kaufmann) Date: Sun, 21 Sep 2008 10:32:20 +0200 Subject: [Lost] =?iso-8859-1?q?=5BPatch=5D_lpt_-_Fix_Abh=E4ngigkeiten?= Message-ID: <20080921083218.GA25829@thales.produktiv.lan> ! lpt: Beim Kopieren von Paketen auch Abhaengigkeiten mitkopieren ! lpt: Abhaengigkeiten nicht im aktuellen set suchen sondern im angegebenen, sonst ist das nur begrenzt sinnvoll. Es geht vermutlich noch schöner, aber ich weiss nicht wie. ;-) Vielleich wenn FPC sowas wie Kopierkonstruktoren kennt oder so... -- Antoine Kaufmann -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : lpt-deps.patch Dateityp : text/x-diff Dateigröße : 4245 bytes Beschreibung: nicht verfügbar URL : -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : nicht verfügbar Dateityp : application/pgp-signature Dateigröße : 197 bytes Beschreibung: nicht verfügbar URL : From mail at kevin-wolf.de Sun Sep 21 12:14:17 2008 From: mail at kevin-wolf.de (Kevin Wolf) Date: Sun, 21 Sep 2008 12:14:17 +0200 Subject: [Lost] =?utf-8?q?=5BPatch=5D_lpt_-_Fix_Abh=C3=A4ngigkeiten?= In-Reply-To: <20080921083218.GA25829@thales.produktiv.lan> References: <20080921083218.GA25829@thales.produktiv.lan> Message-ID: <200809211214.17130@kevin-wolf.de> Am Sonntag, 21. September 2008 10:32:20 schrieb Antoine Kaufmann: > ! lpt: Beim Kopieren von Paketen auch Abhaengigkeiten mitkopieren > ! lpt: Abhaengigkeiten nicht im aktuellen set suchen sondern im > angegebenen, sonst ist das nur begrenzt sinnvoll. > > Es geht vermutlich noch schöner, aber ich weiss nicht wie. ;-) Vielleich > wenn FPC sowas wie Kopierkonstruktoren kennt oder so... Wow. Bist du dir der Kaputtheit bewußt, die das ganze in sich hat? Andererseits steckt in der Kaputtheit auch genug Genialität, daß es trotzdem tun könnte... ;-) Ich versuch es mal in Pseudocode: pkgset_orig = [ kedit1: [ bin1: [ 0.42-1: [ repository = ...; pkg = &kedit1; section = &bin1 ]]] pkgset_copy = [ kedit2: [ bin2: [ 0.42-2: [ repository = ...; pkg = &kedit1; section = &bin1 ]]] From janosch.graef at gmx.net Sun Sep 21 15:15:44 2008 From: janosch.graef at gmx.net (=?UTF-8?B?SmFub3NjaCBHcsOkZg==?=) Date: Sun, 21 Sep 2008 15:15:44 +0200 Subject: [Lost] iso9660 In-Reply-To: <200809202130.23860@kevin-wolf.de> References: <48D543D7.2020805@gmx.net> <200809202130.23860@kevin-wolf.de> Message-ID: <48D64900.60801@gmx.net> So ich hab jetzt mal alles POSIX rausgenommen, was ich gefunden habe. Da man aber für Rockridge ein paar Sachen aus sys/stat.h braucht, habe ich diese einfach nach rockridge.h übernommen (und ein 'r' als Präfix). Kevin Wolf schrieb: > Im zitieren Code die Änderungen, die es braucht, um auf LOST überhaupt mal > kompiliert zu werden. Außerdem sind in LOST noch kleinere POSIX-Ergänzungen > nötig, damit ich einen Lauftest machen kann. Das ist natürlich generell kein > gutes Zeichen, CDI-Treiber sollten möglichst kein POSIX voraussetzen. An den > entsprechenden Stellen würde ich daher zumindest mal ein FIXME hinschreiben. -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : iso9660.patch Dateityp : text/x-patch Dateigröße : 42976 bytes Beschreibung: nicht verfügbar URL : From nicolas.seufert at netspyder.info Tue Sep 23 21:29:10 2008 From: nicolas.seufert at netspyder.info (Nicolas Seufert) Date: Tue, 23 Sep 2008 21:29:10 +0200 Subject: [Lost] =?iso-8859-1?q?_=5BPATCH=5D_sh_-_tab-completion_f=FCr_=09b?= =?iso-8859-1?q?eliebige_Befehle?= Message-ID: <1222198150.30065.6.camel@aardberry.hacklab.geek> Anbei mein erster und wenig erfolgreicher Versuch, apps/sh beizubringen, bei der tab-completion auch Programme in $PATH zu berücksichtigen. Das Ganze macht noch nicht ganz was erwünscht ist, würde es auch nicht wenn es funktionierte. - Der Inhalt von $PATH wird atm nur einmalig beim Start von sh gelesen. - Bei der Anzeige der zur Verfügung stehenden Befehle werden augenscheinlich die ersten 2 Zeichen des nächsten Befehlsnamens durch willkürliche ersetzt (?!) Kritik und natürlich Hinweise sind immer willkommen. kaffeefilter -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : tab-completion.patch Dateityp : text/x-patch Dateigröße : 5175 bytes Beschreibung: nicht verfügbar URL : From toni at famkaufmann.info Tue Sep 23 23:09:05 2008 From: toni at famkaufmann.info (Antoine Kaufmann) Date: Tue, 23 Sep 2008 23:09:05 +0200 Subject: [Lost] =?iso-8859-1?q?=5BPATCH=5D_sh_-_tab-completion_f=FCr_=3Fbe?= =?iso-8859-1?q?liebige_Befehle?= In-Reply-To: <1222198150.30065.6.camel@aardberry.hacklab.geek> References: <1222198150.30065.6.camel@aardberry.hacklab.geek> Message-ID: <20080923210904.GA28565@thales.produktiv.lan> On Tue, Sep 23 21:29, Nicolas Seufert wrote: > Anbei mein erster und wenig erfolgreicher Versuch, apps/sh beizubringen, > bei der tab-completion auch Programme in $PATH zu berücksichtigen. > Das Ganze macht noch nicht ganz was erwünscht ist, würde es auch nicht > wenn es funktionierte. > - Der Inhalt von $PATH wird atm nur einmalig beim Start von sh gelesen. > - Bei der Anzeige der zur Verfügung stehenden Befehle werden > augenscheinlich die ersten 2 Zeichen des nächsten Befehlsnamens durch > willkürliche ersetzt (?!) > Kritik und natürlich Hinweise sind immer willkommen. > > kaffeefilter > Index: src/include/collections.h > =================================================================== > --- src/include/collections.h (Revision 923) > +++ src/include/collections.h (Arbeitskopie) > @@ -12,6 +12,7 @@ > void list_destroy(list_t* list); > list_t* list_push(list_t* list, void* value); > void* list_pop(list_t* list); > +void list_merge_into(list_t* target, list_t* to_merge); > bool list_is_empty(list_t* list); > void* list_get_element_at(list_t* list, int index); > list_t* list_insert(list_t* list, int index, void* value); > Index: src/lib/collections/list.c > =================================================================== > --- src/lib/collections/list.c (Revision 923) > +++ src/lib/collections/list.c (Arbeitskopie) > @@ -163,7 +163,7 @@ > } > > return value; > -} > +} > > /** > * Gibt einen Knoten aus der Liste zur?ck. Wird von allen Funktionen benutzt, Whitespace-Aenderungen sind grundsaetzlich nicht wirklich erwuenscht in den Patches, und besonders wenn noch Trailing Spaces dazukommen, also weg damit. ;-) > @@ -212,6 +212,21 @@ > } > > /** > + * Vereinigt zwei Listen, indem eine Liste in die Ziel-Liste > + * eingefuegt wird und das Quell-Listenhandle zerstoert wird. > + * @param target Ziel-Liste > + * @param to_merge Quell-Liste > + */ > +void list_merge_into(list_t* target, list_t* to_merge) > +{ > + if ((!target) || (!to_merge)) return; > + (list_get_node_at(to_merge, ((to_merge->size)-1)))->next = target->anchor; > + target->anchor = to_merge->anchor; > + target->size += to_merge->size; > + free(to_merge); > + } void list_merge_into(list_t* dest, list_t* source) { struct list_node* node; if (!dest || !source) { return; } node = list_get_node_at(source, source->size -1); node->next = dest->anchor; dest->size += source->size; free(source); } Für ein paar Klammern weniger und ein paar Leerzeilen sind wir immer dankbar. ;-) > + > +/** > * Fragt den Wert eines Listenelements ab. > * > * @param list Liste, deren Element abgefragt werden soll Ich würde mal vorschlagen das du das hier in zwei Patches aufspaltest. > Index: src/modules/c/shell/completion.c > =================================================================== > --- src/modules/c/shell/completion.c (Revision 923) > +++ src/modules/c/shell/completion.c (Arbeitskopie) > @@ -44,6 +44,8 @@ > > #include "shell.h" > > +static list_t* executables_in_path; > + > /** > * Completion-Handler fuer Readline > * > @@ -56,13 +58,23 @@ > /** > * Matches in Befehlen suchen > * > + * @param word Wort, das vervollstaendigt werden soll > * @return Pointer auf Array oder NULL wenn keine Gefunden wurden > */ > static char** shell_command_matches(const char* word); > > /** > + * Matches in Befehlen suchen, die nicht in shell_commands[] > + * vorhanden sind. > + * > + * @param word Wort, das vervollstaendigt werden soll > + * @return Pointer auf list_t oder NULL bei null Uebereinstimmungen > + */ > +static list_t* shell_executable_matches(const char* word); > +/** > * Matches in Umgebungsvariabeln suchen > * > + * @param word Wort, das vervollstaendigt werden soll > * @return Pointer auf Array oder NULL wenn keine Gefunden wurden > */ > static char** shell_envvar_matches(const char* word); > @@ -70,6 +82,7 @@ > /** > * Matches in Dateien > * > + * @param word Wort, das vervollstaendigt werden soll > * @return Pointer auf Array oder NULL wenn keine Gefunden wurden > */ > static char** shell_file_matches(const char* word); > @@ -84,6 +97,7 @@ > */ > void completion_init() > { > + update_path_env(); Das wäre von mir aus gesehen praktischer wenn man das einfach in update_path_env zusammensucht. > rl_attempted_completion_function = rl_completion; > } > > @@ -110,6 +124,26 @@ > return matches; > } > > +void update_path_env(void) > +{ > + io_resource_t* dir; > + io_direntry_t* dentry; > + list_t* executables; > + > + const char* path = getenv("PATH"); Wenn wir hier mehrere Verzeichnisse haben, kommt das nicht gut raus. Versuchs mal irgendwie so: dirname = strtok(path, ";"); while (dirname != NULL) { ... dirname = strtok(NULL, ";"); } > + if ((dir = directory_open(path)) == NULL) return; if (!(dir = directory_open(path))) { return; } > + executables = list_create(); > + while ((dentry = directory_read(dir))) { > + if (dentry->type == IO_DIRENTRY_DIR) continue; if (dentry->type != IO_DIRENTRY_DIR) { > + list_push(executables, strdup (dentry->name)); } > + } > + > + list_destroy(executables_in_path); > + executables_in_path = executables; > +} > + > + So, genug für heute, ich gehe auch schlafen. ;-) -- Antoine Kaufmann -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : nicht verfügbar Dateityp : application/pgp-signature Dateigröße : 197 bytes Beschreibung: nicht verfügbar URL : From toni at famkaufmann.info Wed Sep 24 22:21:41 2008 From: toni at famkaufmann.info (Antoine Kaufmann) Date: Wed, 24 Sep 2008 22:21:41 +0200 Subject: [Lost] [PATCH] + cdi: Header fuer cdi/scsi (ungetestet) Message-ID: <20080924202140.GA29729@thales.produktiv.lan> So ich habe mich hier mal an einem Header fuer CDI/scsi versucht. Ich weiss aber nicht wirklich ob das reicht was ich da habe, da ich SCSI bis jetzt noch nie implementiert habe. ;-) --- src/modules/cdi/include/cdi/scsi.h | 81 ++++++++++++++++++++++++++++++++++++ 1 files changed, 81 insertions(+), 0 deletions(-) create mode 100644 src/modules/cdi/include/cdi/scsi.h diff --git a/src/modules/cdi/include/cdi/scsi.h b/src/modules/cdi/include/cdi/scsi.h new file mode 100644 index 0000000..377ec38 --- /dev/null +++ b/src/modules/cdi/include/cdi/scsi.h @@ -0,0 +1,81 @@ +/* + * Copyright (c) 2008 Antoine Kaufmann + * + * This program is free software. It comes without any warranty, to + * the extent permitted by applicable law. You can redistribute it + * and/or modify it under the terms of the Do What The Fuck You Want + * To Public License, Version 2, as published by Sam Hocevar. See + * http://sam.zoy.org/projects/COPYING.WTFPL for more details. + */ + +#ifndef _CDI_SCSI_H_ +#define _CDI_SCSI_H_ + +#include + +#include "cdi.h" + +struct cdi_scsi_device { + struct cdi_device dev; +}; + +struct cdi_scsi_driver { + struct cdi_driver drv; + + /** + * Sendet einen SCSI-Request ab, und wartet auf eine Response die dann + * zurueckgegeben wird. + * + * @param request Pointer auf den Request + * @param size Groesse des Requests + * + * @return Pointer auf ein SCSI-Paket (muss vom Aufrufer freigegeben werden + * mit cdi_scsi_packet_free) oder NULL im Fehlerfall. + */ + struct cdi_scsi_packet* (*request)(struct cdi_scsi_device* device, + struct cdi_scsi_packet* packet); +}; + +/** SCSI-Paket */ +struct cdi_scsi_packet { + /** Pointer auf die Daten */ + void* data; + + /** Groesse der Daten */ + uint32_t size; +}; + +/** + * Ein SCSI-Paket allozieren + * + * @param size Benoetigte Groesse + * + * @return Pointer auf das Paket oder NULL im Fehlerfall + */ +struct cdi_scsi_packet* cdi_scsi_packet_alloc(uint32_t size); + +/** + * Ein SCSI-Paket freigeben + * + * @param packet Pointer auf das Paket + */ +void cdi_scsi_packet_free(struct cdi_scsi_packet* packet); + + + +/** + * Initialisiert die Datenstrukturen fuer einen SCSI-Treiber + */ +void cdi_scsi_driver_init(struct cdi_scsi_driver* driver); + +/** + * Deinitialisiert die Datenstrukturen fuer einen SCSI-Treiber + */ +void cdi_scsi_driver_destroy(struct cdi_scsi_driver* driver); + +/** + * Registiert einen SCSI-Treiber + */ +void cdi_scsi_driver_register(struct cdi_scsi_driver* driver); + +#endif -- 1.5.6.4 -- Antoine Kaufmann -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : nicht verfügbar Dateityp : application/pgp-signature Dateigröße : 197 bytes Beschreibung: nicht verfügbar URL : From janosch.graef at gmx.net Fri Sep 26 18:01:13 2008 From: janosch.graef at gmx.net (=?ISO-8859-15?Q?Janosch_Gr=E4f?=) Date: Fri, 26 Sep 2008 18:01:13 +0200 Subject: [Lost] [PATCH] + cdi: Header fuer cdi/scsi (ungetestet) In-Reply-To: <20080924202140.GA29729@thales.produktiv.lan> References: <20080924202140.GA29729@thales.produktiv.lan> Message-ID: <48DD0749.3080302@gmx.net> Hi, Im Anhang ist meine Version von cdi/scsi.h. Tut mir leid, dass das jetzt alles neu und auch noch in meinem Codestil geschrieben ist, aber der Header ist nun mal für meinOS und deswegen schreibe ich den lieber selber. Eigentlich habe ich nur ein paar uint32_t's mit size_t's ersetzt, struct cdi_scsi_packet nach oben verschoben (da das in struct cdi_scsi_driver benötigt wird) und struct cdi_scsi_command hinzugefügt. Da das ehemalige Data-Field auch zum empfangen ist, also vorher keine Daten enthalten muss, denke ich, dass sich der Begriff "buffer" besser eignet, ist aber eigentlich vollkommen egal (Jetzt wo ich drüber nachdenke). Das Command-Struct wird benötigt, da jeder SCSI-Treiber ja unterschiedliche Kommandos sendet und es macht auch nicht wirklich Sinn, das in das ehemalige Data-Feld zu packen. Es wäre nur gut, sich irgendwas für die Größe des Arrays "parameters" auszudenken. So daß die Größe automatisch gesetzt wird (eventuell union) und man das ganze Command-Struct per PIO direkt versenden kann. Antoine Kaufmann schrieb: > So ich habe mich hier mal an einem Header fuer CDI/scsi versucht. Ich > weiss aber nicht wirklich ob das reicht was ich da habe, da ich SCSI bis > jetzt noch nie implementiert habe. ;-) -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : cdi_scsi.patch Dateityp : text/x-patch Dateigröße : 1758 bytes Beschreibung: nicht verfügbar URL : From nicolas.seufert at netspyder.info Sun Sep 28 20:07:39 2008 From: nicolas.seufert at netspyder.info (Nicolas Seufert) Date: Sun, 28 Sep 2008 20:07:39 +0200 Subject: [Lost] =?iso-8859-1?q?_=5BPatch=5D_/apps/sh_-_tabcompletion_f=FCr?= =?iso-8859-1?q?_=09beliebige_Befehle?= Message-ID: <1222625259.18072.3.camel@aardberry.hacklab.geek> Tüdelü, Ich hab mal meinen Patch auf den Codestil (auch wenn ich taljeth doc noch nicht gelesen hab) hin bearbeitet und auch das Nicht-Funktionieren-Problem gelöst :). Ich hoffe ihr befindet ihn eines commits für würdig, aber falls ihr das tut solltet ihr doch daran denken, dass mein Code nur Sachen kaputt macht. Aber ich nehm an, das ist euch schon klar :) mfg -------------- nächster Teil -------------- Ein Dateianhang mit Binärdaten wurde abgetrennt... Dateiname : tab-completion.patch Dateityp : text/x-patch Dateigröße : 5479 bytes Beschreibung: nicht verfügbar URL :