From 5d4bf69e4eaab0f080fc04e318b48249ccaba398 Mon Sep 17 00:00:00 2001 From: John Hodge Date: Sun, 9 Feb 2014 14:00:20 +0800 Subject: [PATCH] Kernel/modules - Add support for argument strings to alternate loaders --- KernelLand/Kernel/include/modules.h | 2 +- KernelLand/Kernel/modules.c | 2 +- KernelLand/Modules/Interfaces/UDI/main.c | 7 +++++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/KernelLand/Kernel/include/modules.h b/KernelLand/Kernel/include/modules.h index 1c561463..cb436a60 100644 --- a/KernelLand/Kernel/include/modules.h +++ b/KernelLand/Kernel/include/modules.h @@ -102,7 +102,7 @@ typedef struct sModuleLoader struct sModuleLoader *Next; //!< Kernel Only - Next loader in list char *Name; //!< Friendly name for the loader int (*Detector)(void *Base); //!< Simple detector function - int (*Loader)(void *Base); //!< Initialises the module + int (*Loader)(void *Base, const char *ArgumentString); //!< Initialises the module int (*Unloader)(void *Base); //!< Calls module's cleanup } PACKED tModuleLoader; diff --git a/KernelLand/Kernel/modules.c b/KernelLand/Kernel/modules.c index 5fff929a..cbcf859b 100644 --- a/KernelLand/Kernel/modules.c +++ b/KernelLand/Kernel/modules.c @@ -383,7 +383,7 @@ int Module_LoadFile(const char *Path, const char *ArgString) if( loader ) { - if( loader->Loader(base) ) + if( loader->Loader(base, ArgString) ) { Binary_Unload(base); return EINVAL; diff --git a/KernelLand/Modules/Interfaces/UDI/main.c b/KernelLand/Modules/Interfaces/UDI/main.c index 7a61d81f..1c9fc29c 100644 --- a/KernelLand/Modules/Interfaces/UDI/main.c +++ b/KernelLand/Modules/Interfaces/UDI/main.c @@ -19,7 +19,7 @@ // === PROTOTYPES === int UDI_Install(char **Arguments); int UDI_DetectDriver(void *Base); - int UDI_LoadDriver(void *Base); + int UDI_LoadDriver(void *Base, const char *ArgumentString); tUDI_DriverModule *UDI_int_LoadDriver(void *LoadBase, const udi_init_t *info, const char *udiprops, size_t udiprops_size); const tUDI_MetaLang *UDI_int_GetMetaLangByName(const char *Name); @@ -73,7 +73,7 @@ int UDI_DetectDriver(void *Base) /** * \fn int UDI_LoadDriver(void *Base) */ -int UDI_LoadDriver(void *Base) +int UDI_LoadDriver(void *Base, const char *ArgumentString) { udi_init_t *info; char *udiprops = NULL; @@ -90,6 +90,9 @@ int UDI_LoadDriver(void *Base) UDI_int_LoadDriver(Base, info, udiprops, udiprops_end - udiprops); + // TODO: Parse 'ArgumentString' and extract properties for module/instances + // - Including debug flag + return 0; } -- 2.20.1