[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Lost] Ramdisk - Richtiger Patch ;)



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
--- old/file.c	2008-09-01 20:02:04.000000000 +0200
+++ file.c	2008-09-01 19:50:49.000000000 +0200
@@ -63,7 +63,7 @@ size_t ramdisk_fs_file_write(struct cdi_
             stream->error = CDI_FS_ERROR_INTERNAL;
             return 0;
         }
-        memset(res->buffer + res->size, 0, new_size - res->size);
+        memset(new_buffer + res->size, 0, new_size - res->size);
         res->buffer = new_buffer;
         res->size = new_size;
     }

--- old/init.c	2008-09-01 20:02:04.000000000 +0200
+++ init.c	2008-09-01 20:01:35.000000000 +0200
@@ -34,6 +34,7 @@
  */
 
 #include "ramdisk_cdi.h"
+#include "cdi/lists.h"
 #include <stdio.h>
 
 static int dir_clear(struct cdi_fs_res* real_res)
@@ -65,6 +66,7 @@ int ramdisk_fs_init(struct cdi_fs_filesy
     root_res->res.res = &ramdisk_fs_res;
     root_res->res.dir = &ramdisk_fs_dir;
     root_res->res.loaded = 1;
+    root_res->res.children = cdi_list_create();
 
     cdi_fs->root_res = (struct cdi_fs_res*) root_res;
     return 1;
@@ -73,5 +75,6 @@ int ramdisk_fs_init(struct cdi_fs_filesy
 int ramdisk_fs_destroy(struct cdi_fs_filesystem* fs)
 {
     dir_clear(fs->root_res);
+    cdi_list_destroy(fs->root_res->children);
     return 0;
 }