diff --git a/src/sys/kmods/kmod.c b/src/sys/kmods/kmod.c index c04f1cd..10e0fcb 100644 --- a/src/sys/kmods/kmod.c +++ b/src/sys/kmods/kmod.c @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -41,38 +42,33 @@ #include List_t *List = 0x0; -kmod_t *kmods = 0x0; uInt32 kmod_add(const char *kmod_file, const char *name) { uInt32 addr = 0x0; - kmod_t *tmp; + Item_t *tmp; + kmod_t *kmods; - tmp = kmalloc(sizeof *kmods); - if(tmp == NULL) - { - kprintf("kmod_add: unable to allocate memory!\n"); - return 0x0; - } - + addr = kmod_load(kmod_file); if (addr == 0x0) return 0x0; - if(kmods == 0x0) + if(List == 0x0) { List = InitializeList(); - - kmods = kmalloc(sizeof *kmods); - if(kmods == NULL) - { - kprintf("kmod_add: unable to allocate memory!\n"); - return 0x0; - } - kmods->next = NULL; - kmods->prev = NULL; - } + + tmp = CreateItem(); + InsertItemAtFront(List, tmp); + kmods = kmalloc(sizeof *kmods); + tmp->data = kmods; + if(kmods == NULL) + { + kprintf("kmod_add: unable to allocate memory!\n"); + return 0x0; + } + return 0x0; }