diff options
-rw-r--r-- | loader2/Makefile | 7 | ||||
-rw-r--r-- | loader2/cdinstall.c | 54 | ||||
-rw-r--r-- | loader2/cdinstall.h | 9 | ||||
-rw-r--r-- | loader2/driverdisk.c | 79 | ||||
-rw-r--r-- | loader2/driverdisk.h | 17 | ||||
-rw-r--r-- | loader2/driverselect.c | 11 | ||||
-rw-r--r-- | loader2/hardware.c | 29 | ||||
-rw-r--r-- | loader2/hardware.h | 16 | ||||
-rw-r--r-- | loader2/hdinstall.c | 11 | ||||
-rw-r--r-- | loader2/hdinstall.h | 6 | ||||
-rw-r--r-- | loader2/kbd.c | 3 | ||||
-rw-r--r-- | loader2/kbd.h | 3 | ||||
-rw-r--r-- | loader2/kickstart.c | 40 | ||||
-rw-r--r-- | loader2/kickstart.h | 7 | ||||
-rw-r--r-- | loader2/lang.c | 3 | ||||
-rw-r--r-- | loader2/lang.h | 4 | ||||
-rw-r--r-- | loader2/loader.c | 94 | ||||
-rw-r--r-- | loader2/method.h | 5 | ||||
-rw-r--r-- | loader2/modules.c | 3 | ||||
-rw-r--r-- | loader2/net.c | 63 | ||||
-rw-r--r-- | loader2/net.h | 13 | ||||
-rw-r--r-- | loader2/nfsinstall.c | 18 | ||||
-rw-r--r-- | loader2/nfsinstall.h | 13 | ||||
-rw-r--r-- | loader2/telnetd.c | 6 | ||||
-rw-r--r-- | loader2/telnetd.h | 2 | ||||
-rw-r--r-- | loader2/urlinstall.c | 27 | ||||
-rw-r--r-- | loader2/urlinstall.h | 13 | ||||
-rw-r--r-- | loader2/usb.c | 2 |
28 files changed, 225 insertions, 333 deletions
diff --git a/loader2/Makefile b/loader2/Makefile index ccc7946b1..82c7c4c5b 100644 --- a/loader2/Makefile +++ b/loader2/Makefile @@ -26,7 +26,12 @@ NETOBJS = net.o urls.o ftp.o telnet.o telnetd.o PCMCIAOBJS = pcmcia.o $(NETOBJS) SOURCES = $(subst .o,.c,$(OBJS)) loader.c -HWLIBS = -lkudzu_loader -lpci +HWLIBS = -lkudzu_loader +ifeq (1, $(USEDIET)) +HWLIBS += -lpci_loader +else +HWLIBS += -lpci +endif DEBUG = -ggdb COPTS = $(DEBUG) -Os -Wall -DUSE_LOGDEV -DVERSION='"$(VERSION)"' -Werror diff --git a/loader2/cdinstall.c b/loader2/cdinstall.c index 3e2231029..1bbc6cb76 100644 --- a/loader2/cdinstall.c +++ b/loader2/cdinstall.c @@ -39,7 +39,6 @@ #include "cdinstall.h" #include "mediacheck.h" -#include "../isys/probe.h" #include "../isys/imount.h" #include "../isys/isys.h" @@ -286,7 +285,6 @@ static void queryCDMediaCheck(char *dev, int flags) { * as /mnt/runtime. */ char * setupCdrom(char * location, - struct knownDevices * kd, struct loaderData_s * loaderData, moduleInfoSet modInfo, moduleList modLoaded, @@ -299,25 +297,19 @@ char * setupCdrom(char * location, int stage2inram = 0; char * buf; char *stage2img; + struct device ** devices = NULL; -#if 0 - if (FL_TESTING(flags) && interactive) { - for (i = 0; i < kd->numKnown; i++) { - if (kd->known[i].class != CLASS_CDROM) continue; - buf = malloc(200); - sprintf(buf, "cdrom://%s:/mnt/source", kd->known[i].name); - return buf; - } + devices = probeDevices(CLASS_CDROM, BUS_UNSPEC, PROBE_ALL); + if (!devices) { + logMessage("got to setupCdrom without a CD device"); + return NULL; } -#endif - + /* JKFIXME: ASSERT -- we have a cdrom device when we get here */ do { - for (i = 0; i < kd->numKnown; i++) { - if (kd->known[i].class != CLASS_CDROM) continue; - - logMessage("trying to mount CD device %s", kd->known[i].name); - devMakeInode(kd->known[i].name, "/tmp/cdrom"); + for (i = 0; devices[i]; i++) { + logMessage("trying to mount CD device %s", devices[i]->device); + devMakeInode(devices[i]->device, "/tmp/cdrom"); if (!doPwMount("/tmp/cdrom", "/mnt/source", "iso9660", 1, 0, NULL, NULL, 0, 0)) { char path[1024]; @@ -351,7 +343,7 @@ char * setupCdrom(char * location, } /* do the media check */ - queryCDMediaCheck(kd->known[i].name, flags); + queryCDMediaCheck(devices[i]->device, flags); /* if in rescue mode and we copied stage2 to RAM */ /* we can now unmount the CD */ @@ -361,7 +353,7 @@ char * setupCdrom(char * location, } buf = malloc(200); - sprintf(buf, "cdrom://%s:/mnt/source", kd->known[i].name); + sprintf(buf, "cdrom://%s:/mnt/source", devices[i]->device); return buf; } @@ -399,29 +391,26 @@ char * setupCdrom(char * location, /* try to find a Red Hat CD non-interactively */ char * findRedHatCD(char * location, - struct knownDevices * kd, moduleInfoSet modInfo, moduleList modLoaded, moduleDeps modDeps, int flags, int requirepkgs) { - return setupCdrom(location, kd, NULL, modInfo, modLoaded, modDeps, flags, 0, requirepkgs); + return setupCdrom(location, NULL, modInfo, modLoaded, modDeps, flags, 0, requirepkgs); } /* look for a Red Hat CD and mount it. if we have problems, ask */ char * mountCdromImage(struct installMethod * method, - char * location, struct knownDevices * kd, - struct loaderData_s * loaderData, + char * location, struct loaderData_s * loaderData, moduleInfoSet modInfo, moduleList modLoaded, moduleDeps * modDepsPtr, int flags) { - return setupCdrom(location, kd, loaderData, modInfo, modLoaded, *modDepsPtr, flags, 1, 1); + return setupCdrom(location, loaderData, modInfo, modLoaded, *modDepsPtr, flags, 1, 1); } -void setKickstartCD(struct knownDevices * kd, - struct loaderData_s * loaderData, int argc, +void setKickstartCD(struct loaderData_s * loaderData, int argc, char ** argv, int * flagsPtr) { logMessage("kickstartFromCD"); @@ -429,18 +418,15 @@ void setKickstartCD(struct knownDevices * kd, loaderData->method = strdup("cdrom"); } -int kickstartFromCD(char *kssrc, struct knownDevices * kd, int flags) { +int kickstartFromCD(char *kssrc, int flags) { int rc; - int i; char *p, *kspath; + struct device ** devices; logMessage("getting kickstart file from first CDROM"); - for (i = 0; i < kd->numKnown; i++) - if (kd->known[i].class == CLASS_CDROM) - break; - - if (i >= kd->numKnown) { + devices = probeDevices(CLASS_CDROM, BUS_UNSPEC, PROBE_ALL); + if (!devices) { logMessage("No CDROM devices found!"); return 1; } @@ -454,7 +440,7 @@ int kickstartFromCD(char *kssrc, struct knownDevices * kd, int flags) { if (!p || strlen(kspath) < 1) kspath = "/ks.cfg"; - if ((rc=getKickstartFromBlockDevice(kd->known[i].name, kspath))) { + if ((rc=getKickstartFromBlockDevice(devices[0]->device, kspath))) { if (rc == 3) { startNewt(flags); newtWinMessage(_("Error"), _("OK"), diff --git a/loader2/cdinstall.h b/loader2/cdinstall.h index 2585deca0..e2e7b9e6e 100644 --- a/loader2/cdinstall.h +++ b/loader2/cdinstall.h @@ -4,13 +4,11 @@ #include "method.h" char * mountCdromImage(struct installMethod * method, - char * location, struct knownDevices * kd, - struct loaderData_s * loaderData, + char * location, struct loaderData_s * loaderData, moduleInfoSet modInfo, moduleList modLoaded, moduleDeps * modDepsPtr, int flags); char * findRedHatCD(char * location, - struct knownDevices * kd, moduleInfoSet modInfo, moduleList modLoaded, moduleDeps modDeps, @@ -18,9 +16,8 @@ char * findRedHatCD(char * location, int requirepkgs); -void setKickstartCD(struct knownDevices * kd, - struct loaderData_s * loaderData, int argc, +void setKickstartCD(struct loaderData_s * loaderData, int argc, char ** argv, int * flagsPtr); -int kickstartFromCD(char *kssrc, struct knownDevices * kd, int flags); +int kickstartFromCD(char *kssrc, int flags); #endif diff --git a/loader2/driverdisk.c b/loader2/driverdisk.c index 4a236ba93..049d83d79 100644 --- a/loader2/driverdisk.c +++ b/loader2/driverdisk.c @@ -40,7 +40,6 @@ #include "../isys/isys.h" #include "../isys/imount.h" -#include "../isys/probe.h" static char * driverDiskFiles[] = { "modinfo", "modules.dep", "pcitable", "modules.cgz", NULL }; @@ -213,14 +212,13 @@ int getRemovableDevices(char *** devNames) { */ int loadDriverFromMedia(int class, moduleList modLoaded, moduleDeps * modDepsPtr, moduleInfoSet modInfo, - struct knownDevices * kd, int flags, - int usecancel, int noprobe) { + int flags, int usecancel, int noprobe) { char * device = NULL; char ** devNames = NULL; enum { DEV_DEVICE, DEV_INSERT, DEV_LOAD, DEV_PROBE, DEV_DONE } stage = DEV_DEVICE; - int rc, i, num = 0; + int rc, num = 0; int dir = 1; while (stage != DEV_DONE) { @@ -298,18 +296,11 @@ int loadDriverFromMedia(int class, moduleList modLoaded, } case DEV_LOAD: { int found = 0, before = 0; + struct device ** devices; - 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; - } + devices = probeDevices(class, BUS_UNSPEC, PROBE_ALL); + if (devices) + for(; devices[before]; before++); rc = loadDriverDisk(modInfo, modLoaded, modDepsPtr, "/tmp/drivers", flags); @@ -329,19 +320,11 @@ int loadDriverFromMedia(int class, moduleList modLoaded, break; } - busProbe(modInfo, modLoaded, *modDepsPtr, 0, kd, flags); + busProbe(modInfo, modLoaded, *modDepsPtr, 0, flags); - if (class != CLASS_UNSPEC) { - for (i = 0; i < kd->numKnown; i++) { - if (kd->known[i].class == class) { - stage = DEV_DONE; - found++; - break; - } - } - } else { - found = kd->numKnown; - } + devices = probeDevices(class, BUS_UNSPEC, PROBE_ALL); + if (devices) + for(; devices[before]; found++); if (found > before) { stage = DEV_DONE; @@ -367,11 +350,10 @@ int loadDriverFromMedia(int class, moduleList modLoaded, stage = DEV_DEVICE; } else { rc = chooseManualDriver(class, modLoaded, modDepsPtr, modInfo, - kd, flags); + 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; } } @@ -392,7 +374,7 @@ int loadDriverFromMedia(int class, moduleList modLoaded, /* looping way to load driver disks */ int loadDriverDisks(int class, moduleList modLoaded, moduleDeps * modDepsPtr, moduleInfoSet modInfo, - struct knownDevices * kd, int flags) { + int flags) { int rc; rc = newtWinChoice(_("Driver disk"), _("Yes"), _("No"), @@ -401,7 +383,7 @@ int loadDriverDisks(int class, moduleList modLoaded, return LOADER_OK; rc = loadDriverFromMedia(CLASS_UNSPEC, modLoaded, modDepsPtr, modInfo, - kd, flags, 1, 0); + flags, 1, 0); if (rc == LOADER_BACK) return LOADER_OK; @@ -411,15 +393,14 @@ int loadDriverDisks(int class, moduleList modLoaded, if (rc != 1) break; loadDriverFromMedia(CLASS_UNSPEC, modLoaded, modDepsPtr, modInfo, - kd, flags, 0, 0); + flags, 0, 0); } while (1); return LOADER_OK; } -static void loadFromLocation(struct knownDevices * kd, - struct loaderData_s * loaderData, - char * dir, int flags) { +static void loadFromLocation(struct loaderData_s * loaderData, + char * dir, int flags) { if (verifyDriverDisk(dir, flags) == LOADER_BACK) { logMessage("not a valid driver disk"); return; @@ -428,25 +409,24 @@ static void loadFromLocation(struct knownDevices * kd, loadDriverDisk(loaderData->modInfo, loaderData->modLoaded, loaderData->modDepsPtr, dir, flags); busProbe(loaderData->modInfo, loaderData->modLoaded, * - loaderData->modDepsPtr, 0, kd, flags); + loaderData->modDepsPtr, 0, flags); } -void getDDFromSource(struct knownDevices * kd, - struct loaderData_s * loaderData, +void getDDFromSource(struct loaderData_s * loaderData, char * src, int flags) { char *path = "/tmp/dd.img"; int unlinkf = 0; if (!strncmp(src, "nfs:", 4)) { unlinkf = 1; - if (getFileFromNfs(src + 4, "/tmp/dd.img", kd, loaderData, + if (getFileFromNfs(src + 4, "/tmp/dd.img", loaderData, flags)) { logMessage("unable to retrieve driver disk: %s", src); return; } } else if (!strncmp(src, "ftp://", 6) || !strncmp(src, "http://", 7)) { unlinkf = 1; - if (getFileFromUrl(src, "/tmp/dd.img", kd, loaderData, flags)) { + if (getFileFromUrl(src, "/tmp/dd.img", loaderData, flags)) { logMessage("unable to retrieve driver disk: %s", src); return; } @@ -454,8 +434,7 @@ void getDDFromSource(struct knownDevices * kd, * scsi cdrom drives */ } else if (!strncmp(src, "cdrom", 5)) { loadDriverDisks(CLASS_UNSPEC, loaderData->modLoaded, - loaderData->modDepsPtr, loaderData->modInfo, - kd, flags); + loaderData->modDepsPtr, loaderData->modInfo, flags); return; } else if (!strncmp(src, "path:", 5)) { path = src + 5; @@ -466,7 +445,7 @@ void getDDFromSource(struct knownDevices * kd, } if (!mountLoopback(path, "/tmp/drivers", "loop6")) { - loadFromLocation(kd, loaderData, "/tmp/drivers", flags); + loadFromLocation(loaderData, "/tmp/drivers", flags); umountLoopback("/tmp/drivers", "loop6"); unlink("/tmp/drivers"); if (unlinkf) unlink(path); @@ -474,11 +453,10 @@ void getDDFromSource(struct knownDevices * kd, } -static void getDDFromDev(struct knownDevices * kd, - struct loaderData_s * loaderData, char * dev, +static void getDDFromDev(struct loaderData_s * loaderData, char * dev, char * fstype, int flags); -void useKickstartDD(struct knownDevices * kd, struct loaderData_s * loaderData, +void useKickstartDD(struct loaderData_s * loaderData, int argc, char ** argv, int * flagsPtr) { char * fstype = NULL; char * dev = NULL; @@ -510,14 +488,13 @@ void useKickstartDD(struct knownDevices * kd, struct loaderData_s * loaderData, } if (dev) { - return getDDFromDev(kd, loaderData, dev, fstype, flags); + return getDDFromDev(loaderData, dev, fstype, flags); } else { - return getDDFromSource(kd, loaderData, src, flags); + return getDDFromSource(loaderData, src, flags); } } -static void getDDFromDev(struct knownDevices * kd, - struct loaderData_s * loaderData, char * dev, +static void getDDFromDev(struct loaderData_s * loaderData, char * dev, char * fstype, int flags) { devMakeInode(dev, "/tmp/dddev"); if (fstype) { @@ -535,7 +512,7 @@ static void getDDFromDev(struct knownDevices * kd, } } - loadFromLocation(kd, loaderData, "/tmp/drivers", flags); + loadFromLocation(loaderData, "/tmp/drivers", flags); umount("/tmp/drivers"); unlink("/tmp/drivers"); unlink("/tmp/dddev"); diff --git a/loader2/driverdisk.h b/loader2/driverdisk.h index 2f376b2c6..63173817c 100644 --- a/loader2/driverdisk.h +++ b/loader2/driverdisk.h @@ -5,28 +5,23 @@ #include "modules.h" #include "moduledeps.h" #include "moduleinfo.h" -#include "../isys/probe.h" int loadDriverFromMedia(int class, moduleList modLoaded, moduleDeps * modDepsPtr, moduleInfoSet modInfo, - struct knownDevices * kd, int flags, - int usecancel, int noprobe); + int flags, int usecancel, int noprobe); int loadDriverDisks(int class, moduleList modLoaded, - moduleDeps * modDepsPtr, moduleInfoSet modInfo, - struct knownDevices * kd, int flags); + moduleDeps * modDepsPtr, moduleInfoSet modInfo, int flags); int getRemovableDevices(char *** devNames); int chooseManualDriver(int class, moduleList modLoaded, - moduleDeps * modDepsPtr, moduleInfoSet modInfo, - struct knownDevices * kd, int flags); -void useKickstartDD(struct knownDevices * kd, - struct loaderData_s * loaderData, int argc, + moduleDeps * modDepsPtr, moduleInfoSet modInfo, + int flags); +void useKickstartDD(struct loaderData_s * loaderData, int argc, char ** argv, int * flagsPtr); -void getDDFromSource(struct knownDevices * kd, - struct loaderData_s * loaderData, +void getDDFromSource(struct loaderData_s * loaderData, char * src, int flags); #endif diff --git a/loader2/driverselect.c b/loader2/driverselect.c index ba9adaa3a..f2cc4a000 100644 --- a/loader2/driverselect.c +++ b/loader2/driverselect.c @@ -19,10 +19,10 @@ #include <stdlib.h> #include <string.h> #include <unistd.h> +#include <kudzu/kudzu.h> #include "modules.h" #include "moduleinfo.h" -#include "../isys/probe.h" #include "loader.h" #include "loadermisc.h" #include "log.h" @@ -142,7 +142,7 @@ static int getManualModuleArgs(struct moduleInfo * mod, char *** moduleArgs) { int chooseManualDriver(int class, moduleList modLoaded, moduleDeps * modDepsPtr, moduleInfoSet modInfo, - struct knownDevices * kd, int flags) { + int flags) { int i, numSorted, num = 0, done = 0; enum driverMajor type; struct sortModuleList * sortedOrder; @@ -190,7 +190,7 @@ int chooseManualDriver(int class, moduleList modLoaded, if (i != 1) return LOADER_BACK; - loadDriverFromMedia(class, modLoaded, modDepsPtr, modInfo, kd, + loadDriverFromMedia(class, modLoaded, modDepsPtr, modInfo, flags, 1, 1); continue; } else { @@ -265,15 +265,14 @@ int chooseManualDriver(int class, moduleList modLoaded, if (done == -1) return LOADER_BACK; if (done == -2) { - loadDriverFromMedia(class, modLoaded, modDepsPtr, modInfo, kd, + loadDriverFromMedia(class, modLoaded, modDepsPtr, modInfo, flags, 1, 1); return chooseManualDriver(class, modLoaded, modDepsPtr, modInfo, - kd, flags); + flags); } 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 1212239a9..5658d03f6 100644 --- a/loader2/hardware.c +++ b/loader2/hardware.c @@ -205,20 +205,12 @@ void initializeParallelPort(moduleList modLoaded, moduleDeps modDeps, } } -void updateKnownDevices(struct knownDevices * kd) { - kdFindIdeList(kd, 0); - kdFindScsiList(kd, 0); - kdFindDasdList(kd, 0); - kdFindNetList(kd, 0); -} - int probeiSeries(moduleInfoSet modInfo, moduleList modLoaded, - moduleDeps modDeps, struct knownDevices * kd, int flags) { + moduleDeps modDeps, int flags) { /* this is a hack since we can't really probe on iSeries */ #ifdef __powerpc__ if (!access("/proc/iSeries", X_OK)) { mlLoadModuleSet("veth:viodasd:viocd", modLoaded, modDeps, modInfo, flags); - updateKnownDevices(kd); } #endif return 0; @@ -231,8 +223,7 @@ int probeiSeries(moduleInfoSet modInfo, moduleList modLoaded, * but is done as a quick hack for the present. */ int earlyModuleLoad(moduleInfoSet modInfo, moduleList modLoaded, - moduleDeps modDeps, int justProbe, - struct knownDevices * kd, int flags) { + moduleDeps modDeps, int justProbe, int flags) { int fd, len, i; char buf[1024], *cmdLine; int argc; @@ -259,12 +250,11 @@ int earlyModuleLoad(moduleInfoSet modInfo, moduleList modLoaded, mlLoadModuleSet(argv[i] + 11, modLoaded, modDeps, modInfo, flags); } } - updateKnownDevices(kd); return 0; } int busProbe(moduleInfoSet modInfo, moduleList modLoaded, moduleDeps modDeps, - int justProbe, struct knownDevices * kd, int flags) { + int justProbe, int flags) { int i; char ** modList; char modules[1024]; @@ -276,7 +266,7 @@ int busProbe(moduleInfoSet modInfo, moduleList modLoaded, moduleDeps modDeps, if (FL_NOPROBE(flags)) return 0; /* we can't really *probe* on iSeries, but we can pretend */ - probeiSeries(modInfo, modLoaded, modDeps, kd, flags); + probeiSeries(modInfo, modLoaded, modDeps, flags); if (canProbeDevices()) { /* autodetect whatever we can */ @@ -297,8 +287,6 @@ int busProbe(moduleInfoSet modInfo, moduleList modLoaded, moduleDeps modDeps, mlLoadModuleSet(modules, modLoaded, modDeps, modInfo, flags); startPcmciaDevices(modLoaded, flags); - - updateKnownDevices(kd); } else logMessage("found nothing"); } @@ -308,14 +296,12 @@ int busProbe(moduleInfoSet modInfo, moduleList modLoaded, moduleDeps modDeps, void scsiSetup(moduleList modLoaded, moduleDeps modDeps, - moduleInfoSet modInfo, int flags, - struct knownDevices * kd) { + moduleInfoSet modInfo, int flags) { mlLoadModuleSet("scsi_mod:sd_mod:sr_mod", modLoaded, modDeps, modInfo, flags); } void ideSetup(moduleList modLoaded, moduleDeps modDeps, - moduleInfoSet modInfo, int flags, - struct knownDevices * kd) { + moduleInfoSet modInfo, int flags) { struct device ** devices; int fd, i; @@ -360,8 +346,7 @@ void ideSetup(moduleList modLoaded, moduleDeps modDeps, /* then parse proc to find active DASDs */ /* Reload dasd_mod with correct range of DASD ports */ void dasdSetup(moduleList modLoaded, moduleDeps modDeps, - moduleInfoSet modInfo, int flags, - struct knownDevices * kd) { + moduleInfoSet modInfo, int flags) { #if !defined(__s390__) && !defined(__s390x__) return; #else diff --git a/loader2/hardware.h b/loader2/hardware.h index 5b3ed14f5..7d20172d6 100644 --- a/loader2/hardware.h +++ b/loader2/hardware.h @@ -2,7 +2,6 @@ #define LOADERHW_H #include "modules.h" -#include "../isys/probe.h" int canProbeDevices(void); @@ -13,21 +12,16 @@ int scsiTapeInitialize(moduleList modLoaded, moduleDeps modDeps, void initializeParallelPort(moduleList modLoaded, moduleDeps modDeps, moduleInfoSet modInfo, int flags); -void updateKnownDevices(struct knownDevices * kd); int earlyModuleLoad(moduleInfoSet modInfo, moduleList modLoaded, - moduleDeps modDeps, int justProbe, - struct knownDevices * kd, int flags); + moduleDeps modDeps, int justProbe, int flags); int busProbe(moduleInfoSet modInfo, moduleList modLoaded, moduleDeps modDeps, - int justProbe, struct knownDevices * kd, int flags); + int justProbe, int flags); void scsiSetup(moduleList modLoaded, moduleDeps modDeps, - moduleInfoSet modInfo, int flags, - struct knownDevices * kd); + moduleInfoSet modInfo, int flags); void ideSetup(moduleList modLoaded, moduleDeps modDeps, - moduleInfoSet modInfo, int flags, - struct knownDevices * kd); + moduleInfoSet modInfo, int flags); void dasdSetup(moduleList modLoaded, moduleDeps modDeps, - moduleInfoSet modInfo, int flags, - struct knownDevices * kd); + moduleInfoSet modInfo, int flags); #endif diff --git a/loader2/hdinstall.c b/loader2/hdinstall.c index ad1d93a46..875d611c2 100644 --- a/loader2/hdinstall.c +++ b/loader2/hdinstall.c @@ -37,7 +37,6 @@ #include "method.h" #include "mediacheck.h" -#include "../isys/probe.h" #include "../isys/imount.h" #include "../isys/isys.h" @@ -388,8 +387,7 @@ static char * setupIsoImages(char * device, char * dirName, int flags) { * ISO images on that filesystem */ char * mountHardDrive(struct installMethod * method, - char * location, struct knownDevices * kd, - struct loaderData_s * loaderData, + char * location, struct loaderData_s * loaderData, moduleInfoSet modInfo, moduleList modLoaded, moduleDeps * modDepsPtr, int flags) { int rc; @@ -469,7 +467,7 @@ char * mountHardDrive(struct installMethod * method, return NULL; rc = loadDriverFromMedia(CLASS_HD, modLoaded, modDepsPtr, - modInfo, kd, flags, 0, 0); + modInfo, flags, 0, 0); if (rc == LOADER_BACK) return NULL; @@ -555,7 +553,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, 0, 0); + modInfo, flags, 0, 0); if (rc == LOADER_BACK) return NULL; @@ -583,8 +581,7 @@ char * mountHardDrive(struct installMethod * method, return url; } -void setKickstartHD(struct knownDevices * kd, - struct loaderData_s * loaderData, int argc, +void setKickstartHD(struct loaderData_s * loaderData, int argc, char ** argv, int * flagsPtr) { char *partition, *dir; poptContext optCon; diff --git a/loader2/hdinstall.h b/loader2/hdinstall.h index be7047bbc..c4277a41e 100644 --- a/loader2/hdinstall.h +++ b/loader2/hdinstall.h @@ -9,12 +9,10 @@ struct hdInstallData { }; -void setKickstartHD(struct knownDevices * kd, - struct loaderData_s * loaderData, int argc, +void setKickstartHD(struct loaderData_s * loaderData, int argc, char ** argv, int * flagsPtr); char * mountHardDrive(struct installMethod * method, - char * location, struct knownDevices * kd, - struct loaderData_s * loaderData, + char * location, struct loaderData_s * loaderData, moduleInfoSet modInfo, moduleList modLoaded, moduleDeps * modDepsPtr, int flags); int kickstartFromHD(char *kssrc, int flags); diff --git a/loader2/kbd.c b/loader2/kbd.c index f0de1472f..5c4d05f7f 100644 --- a/loader2/kbd.c +++ b/loader2/kbd.c @@ -162,8 +162,7 @@ int chooseKeyboard(char ** keymap, char ** kbdtypep, int flags) { return rc; } -void setKickstartKeyboard(struct knownDevices * kd, - struct loaderData_s * loaderData, int argc, +void setKickstartKeyboard(struct loaderData_s * loaderData, int argc, char ** argv, int * flagsPtr) { if (argc < 2) { logMessage("no argument passed to keyboard kickstart command"); diff --git a/loader2/kbd.h b/loader2/kbd.h index b18d8dfa0..90a4f88b1 100644 --- a/loader2/kbd.h +++ b/loader2/kbd.h @@ -2,8 +2,7 @@ #define H_KBD int chooseKeyboard(char ** keymap, char ** kbdtypep, int flags); -void setKickstartKeyboard(struct knownDevices * kd, - struct loaderData_s * loaderData, int argc, +void setKickstartKeyboard(struct loaderData_s * loaderData, int argc, char ** argv, int * flagsPtr); #endif diff --git a/loader2/kickstart.c b/loader2/kickstart.c index 8c630fe7e..809841389 100644 --- a/loader2/kickstart.c +++ b/loader2/kickstart.c @@ -47,13 +47,11 @@ #include "../isys/imount.h" #include "../isys/isys.h" -#include "../isys/probe.h" struct ksCommandNames { int code; char * name; - void (*setupData) (struct knownDevices * kd, - struct loaderData_s *loaderData, + void (*setupData) (struct loaderData_s *loaderData, int argc, char ** argv, int * flagsPtr); } ; @@ -62,17 +60,13 @@ struct ksCommand { char ** argv; }; -static void setTextMode(struct knownDevices * kd, - struct loaderData_s * loaderData, int argc, +static void setTextMode(struct loaderData_s * loaderData, int argc, char ** argv, int * flagsPtr); -static void setGraphicalMode(struct knownDevices * kd, - struct loaderData_s * loaderData, int argc, +static void setGraphicalMode(struct loaderData_s * loaderData, int argc, char ** argv, int * flagsPtr); -static void setCmdlineMode(struct knownDevices * kd, - struct loaderData_s * loaderData, int argc, +static void setCmdlineMode(struct loaderData_s * loaderData, int argc, char ** argv, int * flagsPtr); -void loadKickstartModule(struct knownDevices * kd, - struct loaderData_s * loaderData, int argc, +void loadKickstartModule(struct loaderData_s * loaderData, int argc, char ** argv, int * flagsPtr); struct ksCommandNames ksTable[] = { @@ -303,19 +297,18 @@ void getHostandPath(char * ksSource, char **host, char ** file, char * ip) { } } -void getKickstartFile(struct knownDevices * kd, - struct loaderData_s * loaderData, int * flagsPtr) { +void getKickstartFile(struct loaderData_s * loaderData, int * flagsPtr) { char * c = loaderData->ksFile; int flags = *flagsPtr; loaderData->ksFile = NULL; if (!strncmp(c, "ks=http://", 10) || !strncmp(c, "ks=ftp://", 9)) { - if (kickstartFromUrl(c + 3, kd, loaderData, flags)) + if (kickstartFromUrl(c + 3, loaderData, flags)) return; loaderData->ksFile = strdup("/tmp/ks.cfg"); } else if (!strncmp(c, "ks=nfs:", 7)) { - if (kickstartFromNfs(c + 7, kd, loaderData, flags)) + if (kickstartFromNfs(c + 7, loaderData, flags)) return; loaderData->ksFile = strdup("/tmp/ks.cfg"); } else if (!strncmp(c, "ks=floppy", 9)) { @@ -327,13 +320,13 @@ void getKickstartFile(struct knownDevices * kd, return; loaderData->ksFile = strdup("/tmp/ks.cfg"); } else if (!strncmp(c, "ks=cdrom", 8)) { - if (kickstartFromCD(c, kd, *flagsPtr)) + if (kickstartFromCD(c, *flagsPtr)) return; loaderData->ksFile = strdup("/tmp/ks.cfg"); } else if (!strncmp(c, "ks=file:", 8)) { loaderData->ksFile = c + 8; } else if (!strcmp(c, "ks")) { - if (kickstartFromNfs(NULL, kd, loaderData, flags)) + if (kickstartFromNfs(NULL, loaderData, flags)) return; loaderData->ksFile = strdup("/tmp/ks.cfg"); } @@ -342,28 +335,25 @@ void getKickstartFile(struct knownDevices * kd, return; } -static void setTextMode(struct knownDevices * kd, - struct loaderData_s * loaderData, int argc, +static void setTextMode(struct loaderData_s * loaderData, int argc, char ** argv, int * flagsPtr) { (*flagsPtr) = (*flagsPtr) | LOADER_FLAGS_TEXT; return; } -static void setGraphicalMode(struct knownDevices * kd, - struct loaderData_s * loaderData, int argc, +static void setGraphicalMode(struct loaderData_s * loaderData, int argc, char ** argv, int * flagsPtr) { (*flagsPtr) = (*flagsPtr) | LOADER_FLAGS_GRAPHICAL; return; } -static void setCmdlineMode(struct knownDevices * kd, - struct loaderData_s * loaderData, int argc, +static void setCmdlineMode(struct loaderData_s * loaderData, int argc, char ** argv, int * flagsPtr) { (*flagsPtr) = (*flagsPtr) | LOADER_FLAGS_CMDLINE; return; } -void runKickstart(struct knownDevices * kd, struct loaderData_s * loaderData, +void runKickstart(struct loaderData_s * loaderData, int * flagsPtr) { struct ksCommandNames * cmd; int argc; @@ -372,7 +362,7 @@ void runKickstart(struct knownDevices * kd, struct loaderData_s * loaderData, logMessage("setting up kickstart"); for (cmd = ksTable; cmd->name; cmd++) { if ((!ksGetCommand(cmd->code, NULL, &argc, &argv)) && cmd->setupData) { - cmd->setupData(kd, loaderData, argc, argv, flagsPtr); + cmd->setupData(loaderData, argc, argv, flagsPtr); } } } diff --git a/loader2/kickstart.h b/loader2/kickstart.h index ab941a595..29d0c7baf 100644 --- a/loader2/kickstart.h +++ b/loader2/kickstart.h @@ -1,6 +1,5 @@ #ifndef H_KICKSTART -#include "../isys/probe.h" #include "loader.h" #define KS_CMD_NONE 0 @@ -21,10 +20,8 @@ int ksReadCommands(char * cmdFile, int flags); int ksGetCommand(int cmd, char ** last, int * argc, char *** argv); int ksHasCommand(int cmd); -void getKickstartFile(struct knownDevices * kd, - struct loaderData_s * loaderData, int * flagsPtr); -void runKickstart(struct knownDevices * kd, struct loaderData_s * loaderData, - int * flagsPtr); +void getKickstartFile(struct loaderData_s * loaderData, int * flagsPtr); +void runKickstart(struct loaderData_s * loaderData, int * flagsPtr); int getKickstartFromBlockDevice(char *device, char *path); void getHostandPath(char * ksSource, char **host, char ** file, char * ip); diff --git a/loader2/lang.c b/loader2/lang.c index 38c1588cd..44c6c82a4 100644 --- a/loader2/lang.c +++ b/loader2/lang.c @@ -388,8 +388,7 @@ int chooseLanguage(char ** lang, int flags) { return setupLanguage(choice, flags); } -void setKickstartLanguage(struct knownDevices * kd, - struct loaderData_s * loaderData, int argc, +void setKickstartLanguage(struct loaderData_s * loaderData, int argc, char ** argv, int * flagsPtr) { if (argc < 2) { logMessage("no argument passed to lang kickstart command"); diff --git a/loader2/lang.h b/loader2/lang.h index 68e9a048b..e2517934e 100644 --- a/loader2/lang.h +++ b/loader2/lang.h @@ -2,7 +2,6 @@ #define _LANG_H_ #include "loader.h" -#include "../isys/probe.h" #define _(x) translateString (x) #define N_(foo) (foo) @@ -17,8 +16,7 @@ char * translateString(char * str); int setLanguage (char * key, int flags); int getLangInfo(struct langInfo **langs, int flags); -void setKickstartLanguage(struct knownDevices * kd, - struct loaderData_s * loaderData, int argc, +void setKickstartLanguage(struct loaderData_s * loaderData, int argc, char ** argv, int * flagsPtr); #endif /* _LANG_H_ */ diff --git a/loader2/loader.c b/loader2/loader.c index 020a19b42..706d5b3e6 100644 --- a/loader2/loader.c +++ b/loader2/loader.c @@ -75,7 +75,6 @@ #include "../isys/imount.h" #include "../isys/isys.h" -#include "../isys/probe.h" #include "../isys/stubs.h" #include "../isys/lang.h" @@ -302,7 +301,7 @@ static void spawnShell(int flags) { return; } -void loadUpdates(struct knownDevices *kd, int flags) { +void loadUpdates(int flags) { int done = 0; int rc; char * device = NULL, ** devNames = NULL; @@ -363,14 +362,13 @@ void loadUpdates(struct knownDevices *kd, int flags) { return; } -static void checkForHardDrives(struct knownDevices * kd, int * flagsPtr) { - int i; +static void checkForHardDrives(int * flagsPtr) { int flags = (*flagsPtr); - - for (i = 0; i < kd->numKnown; i++) - if (kd->known[i].class == CLASS_HD) break; - - if (i != kd->numKnown) + int i; + struct device ** devices; + + devices = probeDevices(CLASS_HD, BUS_UNSPEC, PROBE_ALL); + if (devices) return; startNewt(flags); @@ -634,20 +632,18 @@ static void checkForRam(int flags) { } } -static int haveDeviceOfType(struct knownDevices * kd, int type) { - int i; +static int haveDeviceOfType(int type) { + struct device ** devices; - for (i = 0; i < kd->numKnown; i++) { - if (type == kd->known[i].class) - return 1; - } + devices = probeDevices(type, BUS_UNSPEC, PROBE_ALL); + if (devices) + return 1; return 0; } /* fsm for the basics of the loader. */ static char *doLoaderMain(char * location, struct loaderData_s * loaderData, - struct knownDevices * kd, moduleInfoSet modInfo, moduleList modLoaded, moduleDeps * modDepsPtr, @@ -693,7 +689,7 @@ static char *doLoaderMain(char * location, * we can fast-path the CD and not make people answer questions in * text mode. */ if (!FL_ASKMETHOD(flags) && !FL_KICKSTART(flags)) { - url = findRedHatCD(location, kd, modInfo, modLoaded, * modDepsPtr, flags, !FL_RESCUE(flags)); + url = findRedHatCD(location, modInfo, modLoaded, * modDepsPtr, flags, !FL_RESCUE(flags)); /* if we found a CD and we're not in rescue or vnc mode return */ /* so we can short circuit straight to stage 2 from CD */ if (url && (!FL_RESCUE(flags) && !hasGraphicalOverride())) @@ -804,8 +800,7 @@ static char *doLoaderMain(char * location, break; case STEP_DRIVER: { - updateKnownDevices(kd); - if (needed == -1 || haveDeviceOfType(kd, needed)) { + if (needed == -1 || haveDeviceOfType(needed)) { step = STEP_NETWORK; dir = 1; needed = -1; @@ -830,7 +825,7 @@ static char *doLoaderMain(char * location, } chooseManualDriver(installMethods[validMethods[methodNum]].deviceType, - modLoaded, modDepsPtr, modInfo, kd, flags); + modLoaded, modDepsPtr, modInfo, 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; @@ -840,7 +835,7 @@ static char *doLoaderMain(char * location, case STEP_DRIVERDISK: rc = loadDriverFromMedia(needed, - modLoaded, modDepsPtr, modInfo, kd, + modLoaded, modDepsPtr, modInfo, flags, 0, 0); if (rc == LOADER_BACK) { step = STEP_DRIVER; @@ -865,7 +860,7 @@ static char *doLoaderMain(char * location, } needsNetwork = 1; - if (!haveDeviceOfType(kd, CLASS_NETWORK)) { + if (!haveDeviceOfType(CLASS_NETWORK)) { needed = CLASS_NETWORK; step = STEP_DRIVER; break; @@ -879,7 +874,7 @@ static char *doLoaderMain(char * location, /* fall through to interface selection */ case STEP_IFACE: logMessage("going to pick interface"); - rc = chooseNetworkInterface(kd, loaderData, flags); + rc = chooseNetworkInterface(loaderData, flags); if ((rc == LOADER_BACK) || (rc == LOADER_ERROR) || ((dir == -1) && (rc == LOADER_NOOP))) { step = STEP_METHOD; @@ -909,7 +904,7 @@ static char *doLoaderMain(char * location, break; } - writeNetInfo("/tmp/netinfo", &netDev, kd); + writeNetInfo("/tmp/netinfo", &netDev); step = STEP_URL; dir = 1; @@ -924,7 +919,7 @@ static char *doLoaderMain(char * location, url = installMethods[validMethods[methodNum]].mountImage( installMethods + validMethods[methodNum], - location, kd, loaderData, modInfo, modLoaded, + location, loaderData, modInfo, modLoaded, modDepsPtr, flags); if (!url) { step = STEP_IP ; @@ -946,8 +941,7 @@ static char *doLoaderMain(char * location, } static int manualDeviceCheck(moduleInfoSet modInfo, moduleList modLoaded, - moduleDeps * modDepsPtr, struct knownDevices * kd, - int flags) { + moduleDeps * modDepsPtr, int flags) { char ** devices; int i, j, rc, num = 0; struct moduleInfo * mi; @@ -995,7 +989,7 @@ static int manualDeviceCheck(moduleInfoSet modInfo, moduleList modLoaded, break; chooseManualDriver(CLASS_UNSPEC, modLoaded, modDepsPtr, modInfo, - kd, flags); + flags); } while (1); return 0; } @@ -1046,7 +1040,6 @@ int main(int argc, char ** argv) { char twelve = 12; - struct knownDevices kd; moduleInfoSet modInfo; moduleList modLoaded; moduleDeps modDeps; @@ -1150,7 +1143,6 @@ int main(int argc, char ** argv) { sleep(5); exit(1); } - kd = kdInit(); mlReadLoadedList(&modLoaded); modDeps = mlNewDeps(); mlLoadDeps(&modDeps, "/modules/modules.dep"); @@ -1163,13 +1155,13 @@ int main(int argc, char ** argv) { if (isVioConsole()) setenv("TERM", "vt100", 1); - mlLoadModuleSet("cramfs:fat:vfat:sunrpc:lockd:nfs:loop:isofs:floppy", modLoaded, modDeps, + mlLoadModuleSet("cramfs:vfat:nfs:loop:isofs:floppy", modLoaded, modDeps, modInfo, flags); /* now let's do some initial hardware-type setup */ - ideSetup(modLoaded, modDeps, modInfo, flags, &kd); - scsiSetup(modLoaded, modDeps, modInfo, flags, &kd); - dasdSetup(modLoaded, modDeps, modInfo, flags, &kd); + ideSetup(modLoaded, modDeps, modInfo, flags); + scsiSetup(modLoaded, modDeps, modInfo, flags); + dasdSetup(modLoaded, modDeps, modInfo, flags); /* Note we *always* do this. If you could avoid this you could get a system w/o USB keyboard support, which would be bad. */ @@ -1178,8 +1170,6 @@ int main(int argc, char ** argv) { /* now let's initialize any possible firewire. fun */ firewireInitialize(modLoaded, modDeps, modInfo, flags); - updateKnownDevices(&kd); - /* explicitly read this to let libkudzu know we want to merge * in future tables rather than replace the initial one */ pciReadDrivers("/modules/pcitable"); @@ -1188,12 +1178,12 @@ int main(int argc, char ** argv) { startNewt(flags); loadDriverDisks(CLASS_UNSPEC, modLoaded, &modDeps, - modInfo, &kd, flags); + modInfo, flags); } if (!access("/dd.img", R_OK)) { logMessage("found /dd.img, loading drivers"); - getDDFromSource(&kd, &loaderData, "path:/dd.img", flags); + getDDFromSource(&loaderData, "path:/dd.img", flags); } /* this allows us to do an early load of modules specified on the @@ -1202,10 +1192,10 @@ int main(int argc, char ** argv) { * FIXME: this syntax is likely to change in a future release * but is done as a quick hack for the present. */ - earlyModuleLoad(modInfo, modLoaded, modDeps, 0, &kd, flags); + earlyModuleLoad(modInfo, modLoaded, modDeps, 0, flags); - busProbe(modInfo, modLoaded, modDeps, 0, &kd, flags); + busProbe(modInfo, modLoaded, modDeps, 0, flags); /* JKFIXME: should probably not be doing this, but ... */ loaderData.modLoaded = modLoaded; @@ -1216,7 +1206,7 @@ int main(int argc, char ** argv) { * we won't have network devices available (and that's the only thing * we support with this right now */ if (loaderData.ddsrc != NULL) { - getDDFromSource(&kd, &loaderData, loaderData.ddsrc, flags); + getDDFromSource(&loaderData, loaderData.ddsrc, flags); } /* JKFIXME: loaderData->ksFile is set to the arg from the command line, @@ -1226,18 +1216,18 @@ int main(int argc, char ** argv) { logMessage("getting kickstart file"); if (!ksFile) - getKickstartFile(&kd, &loaderData, &flags); + getKickstartFile(&loaderData, &flags); if (FL_KICKSTART(flags) && (ksReadCommands((ksFile) ? ksFile : loaderData.ksFile, flags) != LOADER_ERROR)) { - runKickstart(&kd, &loaderData, &flags); + runKickstart(&loaderData, &flags); } } if (FL_TELNETD(flags)) - startTelnetd(&kd, &loaderData, modInfo, modLoaded, modDeps, flags); + startTelnetd(&loaderData, modInfo, modLoaded, modDeps, flags); - url = doLoaderMain("/mnt/source", &loaderData, &kd, modInfo, modLoaded, &modDeps, flags); + url = doLoaderMain("/mnt/source", &loaderData, modInfo, modLoaded, &modDeps, flags); if (!FL_TESTING(flags)) { /* unlink dirs and link to the ones in /mnt/runtime */ @@ -1264,25 +1254,25 @@ int main(int argc, char ** argv) { /* we might have already loaded these, but trying again doesn't hurt */ - ideSetup(modLoaded, modDeps, modInfo, flags, &kd); - scsiSetup(modLoaded, modDeps, modInfo, flags, &kd); - busProbe(modInfo, modLoaded, modDeps, 0, &kd, flags); + ideSetup(modLoaded, modDeps, modInfo, flags); + scsiSetup(modLoaded, modDeps, modInfo, flags); + busProbe(modInfo, modLoaded, modDeps, 0, flags); - checkForHardDrives(&kd, &flags); + checkForHardDrives(&flags); if ((!canProbeDevices() || FL_ISA(flags) || FL_NOPROBE(flags)) && !loaderData.ksFile) { startNewt(flags); - manualDeviceCheck(modInfo, modLoaded, &modDeps, &kd, flags); + manualDeviceCheck(modInfo, modLoaded, &modDeps, flags); } if (FL_UPDATES(flags)) - loadUpdates(&kd, flags); + loadUpdates(flags); /* look for cards which require the agpgart module */ agpgartInitialize(modLoaded, modDeps, modInfo, flags); - mlLoadModuleSetLocation("md:raid0:raid1:raid5:fat:msdos:ext3:reiserfs:jfs:xfs:lvm-mod", + mlLoadModuleSetLocation("md:raid0:raid1:raid5:fat:msdos:jbd:ext3:reiserfs:jfs:xfs:lvm-mod", modLoaded, modDeps, modInfo, flags, secondStageModuleLocation); diff --git a/loader2/method.h b/loader2/method.h index 3cfce30d6..2d5e120ca 100644 --- a/loader2/method.h +++ b/loader2/method.h @@ -1,10 +1,10 @@ #ifndef H_METHOD #define H_METHOD -#include "../isys/probe.h" #include "modules.h" #include "moduledeps.h" #include "loader.h" +#include <kudzu/kudzu.h> struct installMethod { char * name; @@ -12,8 +12,7 @@ struct installMethod { int network; enum deviceClass deviceType; /* for pcmcia */ char * (*mountImage)(struct installMethod * method, - char * location, struct knownDevices * kd, - struct loaderData_s * loaderData, + char * location, struct loaderData_s * loaderData, moduleInfoSet modInfo, moduleList modLoaded, moduleDeps * modDepsPtr, int flags); }; diff --git a/loader2/modules.c b/loader2/modules.c index 186fb4674..5358d75c7 100644 --- a/loader2/modules.c +++ b/loader2/modules.c @@ -898,8 +898,7 @@ int removeLoadedModule(const char * modName, moduleList modLoaded, return rc; } -void loadKickstartModule(struct knownDevices * kd, - struct loaderData_s * loaderData, int argc, +void loadKickstartModule(struct loaderData_s * loaderData, int argc, char ** argv, int * flagsPtr) { char * opts = NULL; char * module = NULL; diff --git a/loader2/net.c b/loader2/net.c index 1995a59db..840862413 100644 --- a/loader2/net.c +++ b/loader2/net.c @@ -28,6 +28,7 @@ #include <stdlib.h> #include <string.h> #include <unistd.h> +#include <kudzu/kudzu.h> #include "../isys/dns.h" #include "../isys/isys.h" @@ -557,19 +558,22 @@ int configureNetwork(struct networkDeviceConfig * dev) { return 0; } -int writeNetInfo(const char * fn, struct networkDeviceConfig * dev, - struct knownDevices * kd) { +int writeNetInfo(const char * fn, struct networkDeviceConfig * dev) { FILE * f; int i; + struct device ** devices; - for (i = 0; i < kd->numKnown; i++) - if (!strcmp(kd->known[i].name, dev->dev.device)) break; + devices = probeDevices(CLASS_NETWORK, BUS_UNSPEC, PROBE_ALL); + if (!devices) + return 0; + + for (i = 0; devices[i]; i++) + if (!strcmp(devices[i]->device, dev->dev.device)) break; if (!(f = fopen(fn, "w"))) return -1; fprintf(f, "DEVICE=%s\n", dev->dev.device); - /* JKFIXME: this used kd->known[i].code == CODE_PCMCIA to toggle onboot */ fprintf(f, "ONBOOT=yes\n"); if (dev->isDynamic) { @@ -672,8 +676,7 @@ int findHostAndDomain(struct networkDeviceConfig * dev, int flags) { return 0; } -void setKickstartNetwork(struct knownDevices * kd, - struct loaderData_s * loaderData, int argc, +void setKickstartNetwork(struct loaderData_s * loaderData, int argc, char ** argv, int * flagsPtr) { char * arg, * bootProto = NULL, * device = NULL, *ethtool = NULL; int noDns = 0, rc; @@ -766,8 +769,7 @@ void setKickstartNetwork(struct knownDevices * kd, /* if multiple interfaces get one to use from user. */ /* NOTE - uses kickstart data available in loaderData */ -int chooseNetworkInterface(struct knownDevices * kd, - struct loaderData_s * loaderData, +int chooseNetworkInterface(struct loaderData_s * loaderData, int flags) { int i, rc, max = 40; int deviceNums = 0; @@ -775,30 +777,36 @@ int chooseNetworkInterface(struct knownDevices * kd, char ** devices; char ** deviceNames; int foundDev = 0; + struct device ** devs; + + devs = probeDevices(CLASS_NETWORK, BUS_UNSPEC, PROBE_ALL); + if (!devs) { + logMessage("no network devices in choose network device!"); + return LOADER_ERROR; + } + + for (i = 0; devs[i]; i++); - /* JKFIXME: this is a lot bigger than it has to be.. */ - devices = alloca((kd->numKnown + 1) * sizeof(*devices)); - deviceNames = alloca((kd->numKnown + 1) * sizeof(*devices)); - for (i = 0; i < kd->numKnown; i++) { - if (kd->known[i].class != CLASS_NETWORK) - continue; - if (kd->known[i].model) { - deviceNames[deviceNums] = alloca(strlen(kd->known[i].name) + - strlen(kd->known[i].model) + 4); + devices = alloca((i + 1) * sizeof(*devices)); + deviceNames = alloca((i + 1) * sizeof(*devices)); + for (i = 0; devs[i]; i++) { + if (devs[i]->desc) { + deviceNames[deviceNums] = alloca(strlen(devs[i]->device) + + strlen(devs[i]->desc) + 4); sprintf(deviceNames[deviceNums],"%s - %s", - kd->known[i].name, kd->known[i].model); + devs[i]->device, devs[i]->desc); if (strlen(deviceNames[deviceNums]) > max) max = strlen(deviceNames[deviceNums]); - devices[deviceNums++] = kd->known[i].name; + devices[deviceNums++] = devs[i]->device; } else { - devices[deviceNums] = kd->known[i].name; - deviceNames[deviceNums++] = kd->known[i].name; + devices[deviceNums] = devs[i]->device; + deviceNames[deviceNums++] = devs[i]->device; } /* this device has been set and we don't really need to ask * about it again... */ if (loaderData->netDev && (loaderData->netDev_set == 1) && - !strcmp(loaderData->netDev, kd->known[i].name)) + !strcmp(loaderData->netDev, devs[i]->device)) foundDev = 1; } if (foundDev == 1) @@ -856,9 +864,9 @@ int chooseNetworkInterface(struct knownDevices * kd, /* turn off the non-active interface. this should keep things from * breaking when we need the interface to do the install as long as * you keep using that device */ - for (i = 0; i < deviceNums; i++) { + for (i = 0; devs[i]; i++) { if (strcmp(loaderData->netDev, devices[i])) - pumpDisableInterface(kd->known[i].name); + pumpDisableInterface(devs[i]->device); } return LOADER_OK; @@ -867,8 +875,7 @@ int chooseNetworkInterface(struct knownDevices * kd, /* JKFIXME: bad name. this function brings up networking early on a * kickstart install so that we can do things like grab the ks.cfg from * the network */ -int kickstartNetworkUp(struct knownDevices * kd, - struct loaderData_s * loaderData, +int kickstartNetworkUp(struct loaderData_s * loaderData, struct networkDeviceConfig *netCfgPtr, int flags) { int rc; @@ -881,7 +888,7 @@ int kickstartNetworkUp(struct knownDevices * kd, do { /* this is smart and does the right thing based on whether or not * we have ksdevice= specified */ - rc = chooseNetworkInterface(kd, loaderData, flags); + rc = chooseNetworkInterface(loaderData, flags); if (rc == LOADER_ERROR) { /* JKFIXME: ask for a driver disk? */ diff --git a/loader2/net.h b/loader2/net.h index 57de28f9e..c79bcf33b 100644 --- a/loader2/net.h +++ b/loader2/net.h @@ -3,7 +3,6 @@ #include "loader.h" #include "pump.h" -#include "../isys/probe.h" struct networkDeviceConfig { struct pumpNetIntf dev; @@ -15,26 +14,22 @@ struct networkDeviceConfig { int readNetConfig(char * device, struct networkDeviceConfig * dev, int flags); int configureNetwork(struct networkDeviceConfig * dev); -int writeNetInfo(const char * fn, struct networkDeviceConfig * dev, - struct knownDevices * kd); +int writeNetInfo(const char * fn, struct networkDeviceConfig * dev); int findHostAndDomain(struct networkDeviceConfig * dev, int flags); int writeResolvConf(struct networkDeviceConfig * net); extern char *netServerPrompt; int nfsGetSetup(char ** hostptr, char ** dirptr); void initLoopback(void); -int chooseNetworkInterface(struct knownDevices * kd, - struct loaderData_s * loaderData, +int chooseNetworkInterface(struct loaderData_s * loaderData, int flags); void setupNetworkDeviceConfig(struct networkDeviceConfig * cfg, struct loaderData_s * loaderData, int flags); -void setKickstartNetwork(struct knownDevices * kd, - struct loaderData_s * loaderData, int argc, +void setKickstartNetwork(struct loaderData_s * loaderData, int argc, char ** argv, int * flagsPtr); -int kickstartNetworkUp(struct knownDevices * kd, - struct loaderData_s * loaderData, +int kickstartNetworkUp(struct loaderData_s * loaderData, struct networkDeviceConfig *netCfgPtr, int flags); diff --git a/loader2/nfsinstall.c b/loader2/nfsinstall.c index 2f5c28bc7..84b381f7e 100644 --- a/loader2/nfsinstall.c +++ b/loader2/nfsinstall.c @@ -71,8 +71,7 @@ int nfsGetSetup(char ** hostptr, char ** dirptr) { char * mountNfsImage(struct installMethod * method, - char * location, struct knownDevices * kd, - struct loaderData_s * loaderData, + char * location, struct loaderData_s * loaderData, moduleInfoSet modInfo, moduleList modLoaded, moduleDeps * modDepsPtr, int flags) { char * host = NULL; @@ -230,8 +229,7 @@ char * mountNfsImage(struct installMethod * method, } -void setKickstartNfs(struct knownDevices * kd, - struct loaderData_s * loaderData, int argc, +void setKickstartNfs(struct loaderData_s * loaderData, int argc, char ** argv, int * flagsPtr) { char * host = NULL, * dir = NULL; poptContext optCon; @@ -270,13 +268,13 @@ void setKickstartNfs(struct knownDevices * kd, } -int getFileFromNfs(char * url, char * dest, struct knownDevices * kd, - struct loaderData_s * loaderData, int flags) { +int getFileFromNfs(char * url, char * dest, struct loaderData_s * loaderData, + int flags) { char * host = NULL, *path = NULL, * file = NULL; int failed = 0; struct networkDeviceConfig netCfg; - if (kickstartNetworkUp(kd, loaderData, &netCfg, flags)) { + if (kickstartNetworkUp(loaderData, &netCfg, flags)) { logMessage("unable to bring up network"); return 1; } @@ -337,7 +335,7 @@ int getFileFromNfs(char * url, char * dest, struct knownDevices * kd, return failed; } -int kickstartFromNfs(char * url, struct knownDevices * kd, - struct loaderData_s * loaderData, int flags) { - return getFileFromNfs(url, "/tmp/ks.cfg", kd, loaderData, flags); +int kickstartFromNfs(char * url, struct loaderData_s * loaderData, + int flags) { + return getFileFromNfs(url, "/tmp/ks.cfg", loaderData, flags); } diff --git a/loader2/nfsinstall.h b/loader2/nfsinstall.h index a2820403a..2e4b97efb 100644 --- a/loader2/nfsinstall.h +++ b/loader2/nfsinstall.h @@ -9,17 +9,14 @@ struct nfsInstallData { }; -void setKickstartNfs(struct knownDevices * kd, - struct loaderData_s * loaderData, int argc, +void setKickstartNfs(struct loaderData_s * loaderData, int argc, char ** argv, int * flagsPtr); -int kickstartFromNfs(char * url, struct knownDevices * kd, - struct loaderData_s * loaderData, int flags); +int kickstartFromNfs(char * url, struct loaderData_s * loaderData, int flags); char * mountNfsImage(struct installMethod * method, - char * location, struct knownDevices * kd, - struct loaderData_s * loaderData, + char * location, struct loaderData_s * loaderData, moduleInfoSet modInfo, moduleList modLoaded, moduleDeps * modDepsPtr, int flags); -int getFileFromNfs(char * url, char * dest, struct knownDevices * kd, - struct loaderData_s * loaderData, int flags); +int getFileFromNfs(char * url, char * dest, struct loaderData_s * loaderData, + int flags); #endif diff --git a/loader2/telnetd.c b/loader2/telnetd.c index c2f28d923..208a15c3f 100644 --- a/loader2/telnetd.c +++ b/loader2/telnetd.c @@ -38,8 +38,6 @@ #include "telnet.h" #include "windows.h" -#include "../isys/probe.h" - #ifndef IPPORT_TELNET #define IPPORT_TELNET 23 #endif @@ -220,12 +218,12 @@ int beTelnet(int flags) { return 0; } -void startTelnetd(struct knownDevices * kd, struct loaderData_s * loaderData, +void startTelnetd(struct loaderData_s * loaderData, moduleInfoSet modInfo, moduleList modLoaded, moduleDeps modDeps, int flags) { struct networkDeviceConfig netCfg; - if (kickstartNetworkUp(kd, loaderData, &netCfg, flags)) { + if (kickstartNetworkUp(loaderData, &netCfg, flags)) { logMessage("unable to bring up network"); return; } diff --git a/loader2/telnetd.h b/loader2/telnetd.h index d9a2a6cd4..31ef65aed 100644 --- a/loader2/telnetd.h +++ b/loader2/telnetd.h @@ -1,7 +1,7 @@ #ifndef TELNETD_H #define TELNETD_H -void startTelnetd(struct knownDevices * kd, struct loaderData_s * loaderData, +void startTelnetd(struct loaderData_s * loaderData, moduleInfoSet modInfo, moduleList modLoaded, moduleDeps modDeps, int flags); diff --git a/loader2/urlinstall.c b/loader2/urlinstall.c index 480e32c74..d67bec1ee 100644 --- a/loader2/urlinstall.c +++ b/loader2/urlinstall.c @@ -187,8 +187,7 @@ static char * getLoginName(char * login, struct iurlinfo ui) { } char * mountUrlImage(struct installMethod * method, - char * location, struct knownDevices * kd, - struct loaderData_s * loaderData, + char * location, struct loaderData_s * loaderData, moduleInfoSet modInfo, moduleList modLoaded, moduleDeps * modDeps, int flags) { int rc; @@ -266,7 +265,7 @@ char * mountUrlImage(struct installMethod * method, /* ok messy - see if we have a stage2 on local CD */ /* before trying to pull one over network */ - cdurl = findRedHatCD(location, kd, modInfo, modLoaded, + cdurl = findRedHatCD(location, modInfo, modLoaded, *modDeps, flags, 0); if (cdurl) { logMessage("Detected stage 2 image on CD"); @@ -323,7 +322,7 @@ char * mountUrlImage(struct installMethod * method, return url; } -int getFileFromUrl(char * url, char * dest, struct knownDevices * kd, +int getFileFromUrl(char * url, char * dest, struct loaderData_s * loaderData, int flags) { struct iurlinfo ui; enum urlprotocol_t proto = @@ -333,7 +332,7 @@ int getFileFromUrl(char * url, char * dest, struct knownDevices * kd, struct networkDeviceConfig netCfg; char * ehdrs; - if (kickstartNetworkUp(kd, loaderData, &netCfg, flags)) { + if (kickstartNetworkUp(loaderData, &netCfg, flags)) { logMessage("unable to bring up network"); return 1; } @@ -364,13 +363,12 @@ int getFileFromUrl(char * url, char * dest, struct knownDevices * kd, /* find all ethernet devices and make a header entry for each one */ int i, hdrlen; char *dev, *mac, tmpstr[128]; + struct device ** devices; hdrlen = 0; - for (i = 0; i < kd->numKnown; i++) { - if (kd->known[i].class != CLASS_NETWORK) - continue; - - dev = kd->known[i].name; + devices = probeDevices(CLASS_NETWORK, BUS_UNSPEC, PROBE_ALL); + for (i = 0; devices && devices[i]; i++) { + dev = devices[i]->device; mac = getMacAddr(dev); if (mac) { @@ -410,13 +408,12 @@ int getFileFromUrl(char * url, char * dest, struct knownDevices * kd, } /* pull kickstart configuration file via http */ -int kickstartFromUrl(char * url, struct knownDevices * kd, - struct loaderData_s * loaderData, int flags) { - return getFileFromUrl(url, "/tmp/ks.cfg", kd, loaderData, flags); +int kickstartFromUrl(char * url, struct loaderData_s * loaderData, + int flags) { + return getFileFromUrl(url, "/tmp/ks.cfg", loaderData, flags); } -void setKickstartUrl(struct knownDevices * kd, - struct loaderData_s * loaderData, int argc, +void setKickstartUrl(struct loaderData_s * loaderData, int argc, char ** argv, int * flagsPtr) { char *url; diff --git a/loader2/urlinstall.h b/loader2/urlinstall.h index c03961cb9..2989c1c37 100644 --- a/loader2/urlinstall.h +++ b/loader2/urlinstall.h @@ -8,18 +8,15 @@ struct urlInstallData { }; -void setKickstartUrl(struct knownDevices * kd, - struct loaderData_s * loaderData, int argc, +void setKickstartUrl(struct loaderData_s * loaderData, int argc, char ** argv, int * flagsPtr); -int kickstartFromUrl(char * url, struct knownDevices * kd, - struct loaderData_s * loaderData, int flags); +int kickstartFromUrl(char * url, struct loaderData_s * loaderData, int flags); char * mountUrlImage(struct installMethod * method, - char * location, struct knownDevices * kd, - struct loaderData_s * loaderData, + char * location, struct loaderData_s * loaderData, moduleInfoSet modInfo, moduleList modLoaded, moduleDeps * modDepsPtr, int flags); -int getFileFromUrl(char * url, char * dest, struct knownDevices * kd, - struct loaderData_s * loaderData, int flags); +int getFileFromUrl(char * url, char * dest, struct loaderData_s * loaderData, + int flags); #endif diff --git a/loader2/usb.c b/loader2/usb.c index c619a3900..8a2fec736 100644 --- a/loader2/usb.c +++ b/loader2/usb.c @@ -121,7 +121,7 @@ int usbInitialize(moduleList modLoaded, moduleDeps modDeps, } buf = alloca(40); - sprintf(buf, "hid:keybdev%s", (loadUsbStorage ? ":usb-storage" : "")); + sprintf(buf, "hid:keybdev:%s", (loadUsbStorage ? ":usb-storage" : "")); mlLoadModuleSet(buf, modLoaded, modDeps, modInfo, flags); sleep(1); |