diff options
-rw-r--r-- | loader2/Makefile | 2 | ||||
-rw-r--r-- | loader2/driverdisk.c | 85 | ||||
-rw-r--r-- | loader2/driverdisk.h | 11 | ||||
-rw-r--r-- | loader2/driverselect.c | 264 | ||||
-rw-r--r-- | loader2/hardware.c | 10 | ||||
-rw-r--r-- | loader2/hardware.h | 1 | ||||
-rw-r--r-- | loader2/hdinstall.c | 4 | ||||
-rw-r--r-- | loader2/loader.c | 83 | ||||
-rw-r--r-- | loader2/modules.c | 14 | ||||
-rw-r--r-- | loader2/modules.h | 5 |
10 files changed, 415 insertions, 64 deletions
diff --git a/loader2/Makefile b/loader2/Makefile index a83f7d252..4f9803faf 100644 --- a/loader2/Makefile +++ b/loader2/Makefile @@ -29,7 +29,7 @@ HWOBJS = pcmcia.o usb.o firewire.o hardware.o METHOBJS = method.o cdinstall.o hdinstall.o nfsinstall.o urlinstall.o OBJS = log.o moduleinfo.o loadermisc.o modules.o moduledeps.o windows.o \ lang.o kbd.o modules.o modstubs.o driverdisk.o \ - md5.o mediacheck.o kickstart.o \ + md5.o mediacheck.o kickstart.o driverselect.o \ $(HWOBJS) $(METHOBJS) LOADEROBJS = loader.o loader-pcmcia.o NETOBJS = net.o urls.o ftp.o telnet.o telnetd.o diff --git a/loader2/driverdisk.c b/loader2/driverdisk.c index ae24d01d0..c1e7c736e 100644 --- a/loader2/driverdisk.c +++ b/loader2/driverdisk.c @@ -170,14 +170,16 @@ int getRemovableDevices(char *** devNames) { /* Prompt for loading a driver from "media" * * class: type of driver to load. + * usecancel: if 1, use cancel instead of back */ -int loadDriverFromMedia(int class, moduleList modLoaded, moduleDeps * modDepsPtr, - moduleInfoSet modInfo, struct knownDevices * kd, - int flags) { +int loadDriverFromMedia(int class, moduleList modLoaded, + moduleDeps * modDepsPtr, moduleInfoSet modInfo, + struct knownDevices * kd, int flags, int usecancel) { char * device = NULL; char ** devNames = NULL; - enum { DEV_DEVICE, DEV_INSERT, DEV_LOAD, DEV_DONE } stage = DEV_DEVICE; + enum { DEV_DEVICE, DEV_INSERT, DEV_LOAD, DEV_PROBE, + DEV_DONE } stage = DEV_DEVICE; int rc, i, num = 0; while (stage != DEV_DONE) { @@ -193,7 +195,8 @@ int loadDriverFromMedia(int class, moduleList modLoaded, moduleDeps * modDepsPtr "as sources for a driver disk. Which would " "you like to use?"), 40, 10, 10, rc < 6 ? rc : 6, devNames, - &num, _("OK"), _("Back"), NULL); + &num, _("OK"), + (usecancel) ? _("Cancel") : _("Back"), NULL); if (rc == 2) { free(devNames); @@ -206,7 +209,8 @@ int loadDriverFromMedia(int class, moduleList modLoaded, moduleDeps * modDepsPtr case DEV_INSERT: { char * buf; - buf = sdupprintf(_("Insert your driver disk into /dev/%s and press \"OK\" to continue."), device); + buf = sdupprintf(_("Insert your driver disk into /dev/%s " + "and press \"OK\" to continue."), device); rc = newtWinChoice(_("Insert Driver Disk"), _("OK"), _("Back"), buf); if (rc == 2) { @@ -235,7 +239,19 @@ int loadDriverFromMedia(int class, moduleList modLoaded, moduleDeps * modDepsPtr break; } case DEV_LOAD: { - int found = 0; + int found = 0, before = 0; + + if (class != CLASS_UNSPEC) { + for (i = 0; i < kd->numKnown; i++) { + if (kd->known[i].class == class) { + stage = DEV_DONE; + before++; + break; + } + } + } else { + before = kd->numKnown; + } rc = loadDriverDisk(modInfo, modLoaded, modDepsPtr, "/tmp/drivers", flags); @@ -244,7 +260,10 @@ int loadDriverFromMedia(int class, moduleList modLoaded, moduleDeps * modDepsPtr stage = DEV_INSERT; break; } + /* fall through to probing */ + stage = DEV_PROBE; + case DEV_PROBE: busProbe(modInfo, modLoaded, *modDepsPtr, 0, kd, flags); if (class != CLASS_UNSPEC) { @@ -256,20 +275,40 @@ int loadDriverFromMedia(int class, moduleList modLoaded, moduleDeps * modDepsPtr } } } else { - /* JKFIXME: for now, we'll just assume that the driver disk - * loading did what they wanted */ - found = 1; + found = kd->numKnown; } - if (found > 0) + if (found > before) break; + + /* we don't have any more modules of the proper class. ask + * them to manually load */ + rc = newtWinTernary(_("Error"), _("Manually choose"), + _("Continue"), _("Load another disk"), + _("No devices of the appropriate type were " + "found on this driver disk. Would you " + "like to manually select the driver, " + "continue anyway, or load another " + "driver disk?")); - /* if we get here then we couldn't find it */ - /* JKFIXME: this should allow manual loading of drivers */ - newtWinMessage(_("Error"), _("OK"), - _("Unable to find a device driver of the needed " - "type on this driver disk.")); - stage = DEV_INSERT; + if (rc == 2) { + /* if they choose to continue, just go ahead and continue */ + stage = DEV_DONE; + } else if (rc == 3) { + /* if they choose to load another disk, back to the + * beginning with them */ + stage = DEV_DEVICE; + } else { + rc = chooseManualDriver(class, modLoaded, *modDepsPtr, modInfo, + kd, flags); + /* if they go back from a manual driver, we'll ask again. + * if they load something, assume it's what we need */ + if (rc == LOADER_OK) { + updateKnownDevices(kd); + stage = DEV_DONE; + } + } + break; } @@ -283,16 +322,4 @@ int loadDriverFromMedia(int class, moduleList modLoaded, moduleDeps * modDepsPtr } -/* simple test */ -#if 0 -int main(int argc, char **argv) { - char * devName = NULL; - loadDriverFromMedia(CLASS_NETWORK, &devName, 0); - - stopNewt(); - fprintf(stdout, "chosen device is %s\n", devName); - - return 0; -} -#endif diff --git a/loader2/driverdisk.h b/loader2/driverdisk.h index 7a3995bfb..0d9af2cc7 100644 --- a/loader2/driverdisk.h +++ b/loader2/driverdisk.h @@ -6,10 +6,15 @@ #include "moduleinfo.h" #include "../isys/probe.h" -int loadDriverFromMedia(int class, moduleList modLoaded, moduleDeps * modDeps, - moduleInfoSet modInfo, struct knownDevices * kd, - int flags); +int loadDriverFromMedia(int class, moduleList modLoaded, + moduleDeps * modDepsPtr, moduleInfoSet modInfo, + struct knownDevices * kd, int flags, int usecancel); int getRemovableDevices(char *** devNames); + +int chooseManualDriver(int class, moduleList modLoaded, moduleDeps modDeps, + moduleInfoSet modInfo, struct knownDevices * kd, + int flags); + #endif diff --git a/loader2/driverselect.c b/loader2/driverselect.c new file mode 100644 index 000000000..9e3564af9 --- /dev/null +++ b/loader2/driverselect.c @@ -0,0 +1,264 @@ +/* + * driverselect.c - functionality for manually selecting drivers + * + * Erik Troan <ewt@redhat.com> + * Jeremy Katz <katzj@redhat.com> + * + * Copyright 1997-2002 Red Hat, Inc. + * + * This software may be freely redistributed under the terms of the GNU + * General Public License. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <ctype.h> +#include <newt.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> + +#include "modules.h" +#include "moduleinfo.h" +#include "../isys/probe.h" +#include "loader.h" +#include "loadermisc.h" +#include "log.h" +#include "lang.h" +#include "hardware.h" + +struct sortModuleList { + int index; + moduleInfoSet modInfo; +}; + +static int sortDrivers(const void * a, const void * b) { + const struct sortModuleList * one = a; + const struct sortModuleList * two = b; + + return strcmp(one->modInfo->moduleList[one->index].description, + one->modInfo->moduleList[two->index].description); +} + +static int getManualModuleArgs(struct moduleInfo * mod, char *** moduleArgs) { + newtGrid grid, buttons; + newtComponent text, f, ok, back, entry; + struct newtExitStruct es; + int done = 0, i; + char * buf; + char *argsEntry = ""; + + if (*moduleArgs) { + for (i = 0; (*moduleArgs)[i]; i++) + argsEntry = strcat(argsEntry, (*moduleArgs)[i]); + } + + f = newtForm(NULL, NULL, 0); + buf = sdupprintf(_("Please enter any parameters which you wish to pass " + "to the %s module separated by spaces. If you don't " + "know what parameters to supply, skip this screen " + "by pressing the \"OK\" button. A list of available " + "options can be obtained by pressing the F1 key."), + mod->moduleName); + text = newtTextboxReflowed(-1, -1, buf, 60, 0, 10, 0); + entry = newtEntry(-1, -1, argsEntry, 50, &argsEntry, + NEWT_ENTRY_SCROLL); + + newtFormAddHotKey(f, NEWT_KEY_F1); + newtFormAddHotKey(f, NEWT_KEY_F12); + + buttons = newtButtonBar(_("OK"), &ok, _("Back"), &back, NULL); + + grid = newtCreateGrid(1, 3); + newtGridSetField(grid, 0, 0, NEWT_GRID_COMPONENT, text, + 0, 0, 0, 1, 0, 0); + newtGridSetField(grid, 0, 1, NEWT_GRID_COMPONENT, entry, + 0, 0, 0, 1, 0, 0); + newtGridSetField(grid, 0, 2, NEWT_GRID_SUBGRID, buttons, + 0, 0, 0, 0, 0, NEWT_GRID_FLAG_GROWX); + + newtGridWrappedWindow(grid, _("Enter Module Parameters")); + newtGridAddComponentsToForm(grid, f, 1); + + do { + newtFormRun(f, &es); + + if (es.reason == NEWT_EXIT_COMPONENT && es.u.co == back) { + done = -1; + } else if (es.reason == NEWT_EXIT_HOTKEY && es.u.key == NEWT_KEY_F1) { + logMessage("need to pop up 'help' with module options here"); + /* JKFIXME: ^^^ */ + } else { + done = 1; + } + } while (done == 0); + + newtGridFree(grid, 1); + + if (done == -1) { + newtFormDestroy(f); + newtPopWindow(); + + return LOADER_BACK; + } + logMessage("specified args of %s for %s", argsEntry, mod->moduleName); + + if (strlen(argsEntry) > 0) { + int numAlloced = 5; + char * start; + char * end; + + i = 0; + + *moduleArgs = malloc((numAlloced + 1) * sizeof(*moduleArgs)); + start = argsEntry; + while (start && *start) { + end = start; + while (!isspace(*end) && *end) end++; + *end = '\0'; + (*moduleArgs)[i++] = strdup(start); + start = end + 1; + *end = ' '; + start = strchr(end, ' '); + if (start) start++; + + if (i >= numAlloced) { + numAlloced += 5; + *moduleArgs = realloc(*moduleArgs, + sizeof(*moduleArgs) * (numAlloced + 1)); + } + } + (*moduleArgs)[i] = NULL; + } + + newtFormDestroy(f); + newtPopWindow(); + + return LOADER_OK; +} + +int chooseManualDriver(int class, moduleList modLoaded, moduleDeps modDeps, + moduleInfoSet modInfo, struct knownDevices * kd, + int flags) { + int i, numSorted, num = 0, done = 0; + enum driverMajor type; + struct sortModuleList * sortedOrder; + char giveArgs = ' '; + char ** moduleArgs = NULL; + + newtComponent text, f, ok, back, argcheckbox, listbox; + newtGrid grid, buttons; + struct newtExitStruct es; + + if (class == CLASS_NETWORK) + type = DRIVER_NET; + else if ((class == CLASS_SCSI) || (class == CLASS_HD) || + (class == CLASS_CDROM)) + type = DRIVER_SCSI; + else if (class == CLASS_UNSPEC) + type = -1; + else { + logMessage("unknown device class %d specified; aborting manual " + "selection", class); + return LOADER_ERROR; + } + + sortedOrder = malloc(sizeof(*sortedOrder) * modInfo->numModules); + numSorted = 0; + + for (i = 0; i < modInfo->numModules; i++) { + if (mlModuleInList(modInfo->moduleList[i].moduleName, modLoaded) || + !modInfo->moduleList[i].description || + ((type >= 0) && (type != modInfo->moduleList[i].major))) + continue; + sortedOrder[numSorted].index = i; + sortedOrder[numSorted++].modInfo = modInfo; + } + + if (numSorted == 0) { + /* JKFIXME: if no drivers to load, should we ask about driver disk? */ + logMessage("no drivers to load"); + return LOADER_BACK; + } + + qsort(sortedOrder, numSorted, sizeof(*sortedOrder), sortDrivers); + + f = newtForm(NULL, NULL, 0); + + text = newtTextboxReflowed(-1, -1, + _("Please select the driver below which you " + "wish to load. If it does not appear and " + "you have a driver disk, press F2."), + 60, 0, 10, 0); + + listbox = newtListbox(-1, -1, 6, NEWT_FLAG_SCROLL | NEWT_FLAG_RETURNEXIT); + + buttons = newtButtonBar(_("OK"), &ok, _("Back"), &back, NULL); + argcheckbox = newtCheckbox(-1, -1, _("Specify optional module arguments"), + giveArgs, NULL, &giveArgs); + + newtFormAddHotKey(f, NEWT_KEY_F2); + newtFormAddHotKey(f, NEWT_KEY_F12); + + for (i = 0; i < numSorted; i++) { + newtListboxAppendEntry(listbox, sdupprintf("%s (%s)", + modInfo->moduleList[sortedOrder[i].index].description, + modInfo->moduleList[sortedOrder[i].index].moduleName), (void *) sortedOrder[i].index); + } + + grid = newtCreateGrid(1, 4); + newtGridSetField(grid, 0, 0, NEWT_GRID_COMPONENT, text, 0, 0, 0, 1, 0, 0); + newtGridSetField(grid, 0, 1, NEWT_GRID_COMPONENT, listbox, + 0, 0, 0, 1, 0, 0); + newtGridSetField(grid, 0, 2, NEWT_GRID_COMPONENT, argcheckbox, + 0, 0, 0, 1, 0, 0); + newtGridSetField(grid, 0, 3, NEWT_GRID_SUBGRID, buttons, + 0, 0, 0, 0, 0, NEWT_GRID_FLAG_GROWX); + newtGridWrappedWindow(grid, _("Select Device Driver to Load")); + + newtGridAddComponentsToForm(grid, f, 1); + + do { + newtFormRun(f, &es); + + num = (int) newtListboxGetCurrent(listbox); + + if (es.reason == NEWT_EXIT_COMPONENT && es.u.co == back) { + done = -1; + } else if (es.reason == NEWT_EXIT_HOTKEY && es.u.key == NEWT_KEY_F2) { + logMessage("need to go to load a driver disk here"); + /* JKFIXME: ^^^ */ + done = -1; + } else { + if (giveArgs != ' ') { + i = getManualModuleArgs(&(modInfo->moduleList[num]), + &moduleArgs); + if (i == LOADER_BACK) + done = 0; + else + done = 1; + } else { + done = 1; + } + } + } while (done == 0); + + newtGridFree(grid, 1); + newtFormDestroy(f); + newtPopWindow(); + + if (done == -1) + return LOADER_BACK; + + + mlLoadModule(modInfo->moduleList[num].moduleName, modLoaded, modDeps, + modInfo, moduleArgs, flags); + updateKnownDevices(kd); + free(sortedOrder); + + return LOADER_OK; +} + + diff --git a/loader2/hardware.c b/loader2/hardware.c index ec694d1dd..cdf4374fc 100644 --- a/loader2/hardware.c +++ b/loader2/hardware.c @@ -139,6 +139,11 @@ void initializeParallelPort(moduleList modLoaded, moduleDeps modDeps, } } +void updateKnownDevices(struct knownDevices * kd) { + kdFindScsiList(kd, 0); + kdFindNetList(kd, 0); +} + int busProbe(moduleInfoSet modInfo, moduleList modLoaded, moduleDeps modDeps, int justProbe, struct knownDevices * kd, int flags) { int i; @@ -165,9 +170,8 @@ int busProbe(moduleInfoSet modInfo, moduleList modLoaded, moduleDeps modDeps, } mlLoadModuleSet(modules, modLoaded, modDeps, modInfo, flags); - - kdFindScsiList(kd, 0); - kdFindNetList(kd, 0); + + updateKnownDevices(kd); } else logMessage("found nothing"); } diff --git a/loader2/hardware.h b/loader2/hardware.h index d4f1da772..d72f1bd7c 100644 --- a/loader2/hardware.h +++ b/loader2/hardware.h @@ -9,6 +9,7 @@ int agpgartInitialize(moduleList modLoaded, moduleDeps modDeps, void initializeParallelPort(moduleList modLoaded, moduleDeps modDeps, moduleInfoSet modInfo, int flags); +void updateKnownDevices(struct knownDevices * kd); int busProbe(moduleInfoSet modInfo, moduleList modLoaded, moduleDeps modDeps, int justProbe, struct knownDevices * kd, int flags); diff --git a/loader2/hdinstall.c b/loader2/hdinstall.c index a466532d6..65e667b21 100644 --- a/loader2/hdinstall.c +++ b/loader2/hdinstall.c @@ -372,7 +372,7 @@ char * mountHardDrive(struct installMethod * method, return NULL; rc = loadDriverFromMedia(CLASS_HD, modLoaded, modDepsPtr, - modInfo, kd, flags); + modInfo, kd, flags, 0); if (rc == LOADER_BACK) return NULL; @@ -458,7 +458,7 @@ char * mountHardDrive(struct installMethod * method, return NULL; } else if (es.reason == NEWT_EXIT_HOTKEY && es.u.key == NEWT_KEY_F2) { rc = loadDriverFromMedia(CLASS_HD, modLoaded, modDepsPtr, - modInfo, kd, flags); + modInfo, kd, flags, 0); if (rc == LOADER_BACK) return NULL; diff --git a/loader2/loader.c b/loader2/loader.c index 6e52c3004..e3cd12943 100644 --- a/loader2/loader.c +++ b/loader2/loader.c @@ -284,8 +284,9 @@ void loadUpdates(struct knownDevices *kd, int flags) { return; } -static void checkForHardDrives(struct knownDevices * kd, int flags) { +static void checkForHardDrives(struct knownDevices * kd, int * flagsPtr) { int i; + int flags = (*flagsPtr); for (i = 0; i < kd->numKnown; i++) if (kd->known[i].class == CLASS_HD) break; @@ -299,15 +300,8 @@ static void checkForHardDrives(struct knownDevices * kd, int flags) { "to manually choose device drivers for the " "installation to succeed. Would you like to " "select drivers now?")); - if (i != 2) flags |= LOADER_FLAGS_ISA; + if (i != 2) (*flagsPtr) = (*flagsPtr) | LOADER_FLAGS_ISA; - if (((access("/proc/bus/devices", R_OK) && - access("/proc/openprom", R_OK) && - access("/proc/iSeries", R_OK)) || - FL_ISA(flags) || FL_NOPROBE(flags)) && !FL_KICKSTART(flags)) { - /* JKFIXME: do a manual device load */ - } - return; } @@ -548,7 +542,7 @@ static char *doLoaderMain(char * location, moduleDeps * modDepsPtr, int flags) { enum { STEP_LANG, STEP_KBD, STEP_METHOD, STEP_DRIVER, - STEP_URL, STEP_DONE } step; + STEP_DRIVERDISK, STEP_URL, STEP_DONE } step; char * url = NULL; int dir = 1; int rc, i; @@ -673,19 +667,47 @@ static char *doLoaderMain(char * location, dir = 1; break; } - - rc = loadDriverFromMedia(installMethods[validMethods[methodNum]].deviceType, - modLoaded, modDepsPtr, modInfo, kd, flags); - if (rc == LOADER_BACK) { + + + rc = newtWinTernary(_("No driver found"), _("Select driver"), + _("Use a driver disk"), _("Back"), + _("Unable to find any devices of the type " + "needed for this installation type. " + "Would you like to manually select your " + "driver or use a driver disk?")); + if (rc == 2) { + step = STEP_DRIVERDISK; + dir = 1; + break; + } else if (rc == 3) { step = STEP_METHOD; dir = -1; break; } - step = STEP_URL; - dir = 1; + chooseManualDriver(installMethods[validMethods[methodNum]].deviceType, + modLoaded, *modDepsPtr, modInfo, kd, flags); + /* it doesn't really matter what we return here; we just want + * to reprobe and make sure we have the driver */ + step = STEP_DRIVER; break; } + + case STEP_DRIVERDISK: + + rc = loadDriverFromMedia(installMethods[validMethods[methodNum]].deviceType, + modLoaded, modDepsPtr, modInfo, kd, + flags, 0); + if (rc == LOADER_BACK) { + step = STEP_DRIVER; + dir = -1; + break; + } + + /* need to come back to driver so that we can ensure that we found + * the right kind of driver after loading the driver disk */ + step = STEP_DRIVER; + break; case STEP_URL: logMessage("starting to STEP_URL"); @@ -712,6 +734,15 @@ static char *doLoaderMain(char * location, return url; } +static int manualDeviceCheck(moduleInfoSet modInfo, moduleList modLoaded, + moduleDeps * modDepsPtr, struct knownDevices * kd, + int flags) { + /* JKFIXME: need to give a "these devices are on your system, + * add more? type of thing */ + return 0; +} + + int main(int argc, char ** argv) { int flags = 0; struct stat sb; @@ -737,13 +768,11 @@ int main(int argc, char ** argv) { char * cmdLine = NULL; char * ksFile = NULL; int testing = 0; - int probeOnly; /* JKFIXME: this option can probably die */ int mediacheck = 0; poptContext optCon; struct poptOption optionTable[] = { { "cmdline", '\0', POPT_ARG_STRING, &cmdLine, 0 }, { "ksfile", '\0', POPT_ARG_STRING, &ksFile, 0 }, - { "probe", '\0', POPT_ARG_NONE, &probeOnly, 0 }, { "test", '\0', POPT_ARG_NONE, &testing, 0 }, { "mediacheck", '\0', POPT_ARG_NONE, &mediacheck, 0}, { 0, 0, 0, 0, 0 } @@ -852,10 +881,12 @@ int main(int argc, char ** argv) { access("/proc/openprom", R_OK) && access("/proc/iSeries", R_OK)) || FL_MODDISK(flags)) { startNewt(flags); - /* JKFIXME: do the driver disk thing here for an isa machine. bah. */ + + loadDriverFromMedia(CLASS_UNSPEC, modLoaded, &modDeps, + modInfo, &kd, flags, 1); } - busProbe(modInfo, modLoaded, modDeps, probeOnly, &kd, flags); + busProbe(modInfo, modLoaded, modDeps, 0, &kd, flags); /* JKFIXME: loaderData->ksFile is set to the arg from the command line, * and then getKickstartFile() changes it and sets FL_KICKSTART. @@ -907,7 +938,17 @@ int main(int argc, char ** argv) { scsiSetup(modLoaded, modDeps, modInfo, flags, &kd); busProbe(modInfo, modLoaded, modDeps, 0, &kd, flags); - checkForHardDrives(&kd, flags); + checkForHardDrives(&kd, &flags); + + if (((access("/proc/bus/devices", R_OK) && + access("/proc/openprom", R_OK) && + access("/proc/iSeries", R_OK)) || + FL_ISA(flags) || FL_NOPROBE(flags)) && !FL_KICKSTART(flags)) { + + startNewt(flags); + manualDeviceCheck(modInfo, modLoaded, &modDeps, &kd, flags); + } + if (FL_UPDATES(flags)) loadUpdates(&kd, flags); diff --git a/loader2/modules.c b/loader2/modules.c index b7ff4d89a..1c1c7f0c5 100644 --- a/loader2/modules.c +++ b/loader2/modules.c @@ -38,7 +38,6 @@ #include "../isys/cpio.h" -static int mlModuleInList(const char * modName, moduleList list); static int writeModulesConf(moduleList list, int fd); static struct extractedModule * extractModules (char * const * modNames, struct extractedModule * oldPaths, @@ -214,7 +213,7 @@ char ** tsortModules(moduleList modLoaded, moduleDeps ml, char ** args, return list; } -static int mlModuleInList(const char * modName, moduleList list) { +int mlModuleInList(const char * modName, moduleList list) { int i; if (!list) return 0; @@ -506,8 +505,15 @@ static int doLoadModules(const char * origModNames, moduleList modLoaded, return i; } -/* loads a : separated list of modules. the arg only applies to the - first module in the list */ +/* load a module with a given list of arguments */ +int mlLoadModule(const char * module, moduleList modLoaded, + moduleDeps modDeps, moduleInfoSet modInfo, + char ** args, int flags) { + return doLoadModules(module, modLoaded, modDeps, modInfo, flags, module, + args, NULL); +} + +/* loads a : separated list of modules */ int mlLoadModuleSet(const char * modNames, moduleList modLoaded, moduleDeps modDeps, moduleInfoSet modInfo, int flags) { diff --git a/loader2/modules.h b/loader2/modules.h index 9e055ee84..90cb92bd0 100644 --- a/loader2/modules.h +++ b/loader2/modules.h @@ -28,6 +28,9 @@ struct moduleList_s { }; int mlReadLoadedList(moduleList * mlp); +int mlLoadModule(const char * module, moduleList modLoaded, + moduleDeps modDeps, moduleInfoSet modInfo, + char ** args, int flags); int mlLoadModuleSet(const char * modNames, moduleList modLoaded, moduleDeps modDeps, moduleInfoSet modInfo, int flags); @@ -38,6 +41,6 @@ int mlLoadModuleSetLocation(const char * modNames, moduleInfoSet modInfo, int flags, struct moduleBallLocation * location); - +int mlModuleInList(const char * modName, moduleList list); #endif |