[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
[PATCH 3/3] Adjust loader to new hardware code.
- From: Bill Nottingham <notting redhat com>
- To: anaconda-devel-list redhat com
- Cc: Bill Nottingham <notting redhat com>
- Subject: [PATCH 3/3] Adjust loader to new hardware code.
- Date: Thu, 20 Dec 2007 17:18:14 -0500
---
loader2/Makefile | 2 +-
loader2/cdinstall.c | 4 +-
loader2/driverdisk.c | 81 ++++++++++-------------------------------------
loader2/driverselect.c | 15 ++-------
loader2/hardware.c | 1 -
loader2/hdinstall.c | 4 +-
loader2/kickstart.c | 21 ++++++------
loader2/loader.c | 26 ++++++++--------
loader2/loader.h | 1 +
loader2/method.h | 4 +--
loader2/net.c | 17 +++-------
loader2/urlinstall.c | 2 +-
12 files changed, 57 insertions(+), 121 deletions(-)
diff --git a/loader2/Makefile b/loader2/Makefile
index 3258543..7d5b9ad 100644
--- a/loader2/Makefile
+++ b/loader2/Makefile
@@ -60,7 +60,7 @@ LOADEROBJS = loader.o loader-pcmcia.o
NETOBJS = net.o urls.o ftp.o telnet.o telnetd.o
SOURCES = $(subst .o,.c,$(OBJS)) loader.c
-LIBS += -lkudzu_loader -lpci
+LIBS +=
CFLAGS += -DUSE_LOGDEV -DVERSION='"$(VERSION)"'
STATIC =
diff --git a/loader2/cdinstall.c b/loader2/cdinstall.c
index 54598b0..2ea64f9 100644
--- a/loader2/cdinstall.c
+++ b/loader2/cdinstall.c
@@ -239,7 +239,7 @@ char * setupCdrom(char * location, struct loaderData_s * loaderData,
r = asprintf(&stage2loc, "%s/images/stage2.img", location);
r = asprintf(&discinfoloc, "%s/.discinfo", location);
- devices = probeDevices(CLASS_CDROM, BUS_UNSPEC, 0);
+ devices = getDevices(DEVICE_CDROM);
if (!devices) {
logMessage(ERROR, "got to setupCdrom without a CD device");
return NULL;
@@ -375,7 +375,7 @@ int kickstartFromCD(char *kssrc) {
logMessage(INFO, "getting kickstart file from first CDROM");
- devices = probeDevices(CLASS_CDROM, BUS_UNSPEC, 0);
+ devices = getDevices(DEVICE_CDROM);
if (!devices) {
logMessage(ERROR, "No CDROM devices found!");
return 1;
diff --git a/loader2/driverdisk.c b/loader2/driverdisk.c
index f19efcf..1ef83e3 100644
--- a/loader2/driverdisk.c
+++ b/loader2/driverdisk.c
@@ -22,7 +22,6 @@
#include <errno.h>
#include <fcntl.h>
-#include <kudzu/kudzu.h>
#include <newt.h>
#include <popt.h>
#include <stdlib.h>
@@ -159,9 +158,6 @@ static int loadDriverDisk(struct loaderData_s *loaderData, char *mntpt) {
sprintf(file, "%s/modinfo", mntpt);
readModuleInfo(file, modInfo, location, 1);
- sprintf(file, "%s/modules.alias", mntpt);
- pciReadDrivers(file);
-
if (!FL_CMDLINE(flags))
newtPopWindow();
@@ -175,64 +171,23 @@ static int loadDriverDisk(struct loaderData_s *loaderData, char *mntpt) {
* of device names
*/
int getRemovableDevices(char *** devNames) {
- struct device **devices, **floppies, **cdroms, **disks;
+ struct device **devs;
int numDevices = 0;
- int i = 0, j = 0;
-
- floppies = probeDevices(CLASS_FLOPPY,
- BUS_IDE | BUS_SCSI | BUS_MISC, PROBE_LOADED);
- cdroms = probeDevices(CLASS_CDROM,
- BUS_IDE | BUS_SCSI | BUS_MISC, PROBE_LOADED);
- disks = probeDevices(CLASS_HD,
- BUS_IDE | BUS_SCSI | BUS_MISC, PROBE_LOADED);
-
- /* we should probably take detached into account here, but it just
- * means we use a little bit more memory than we really need to */
- if (floppies)
- for (i = 0; floppies[i]; i++) numDevices++;
- if (cdroms)
- for (i = 0; cdroms[i]; i++) numDevices++;
- if (disks)
- for (i = 0; disks[i]; i++) numDevices++;
-
- /* JKFIXME: better error handling */
+ int i = 0;
+
+ devs = getDevices(DEVICE_DISK | DEVICE_CDROM);
+
+ for (i = 0; devs[i] ; i++) {
+ if (devs[i]->priv.removable) {
+ *devNames = realloc(*devNames, (numDevices + 2) * sizeof(char *));
+ (*devNames)[numDevices] = strdup(devs[i]->device);
+ (*devNames)[numDevices+1] = NULL;
+ numDevices ++;
+ }
+ }
if (!numDevices) {
logMessage(ERROR, "no devices found to load drivers from");
- return numDevices;
}
-
- devices = malloc((numDevices + 1) * sizeof(**devices));
-
- i = 0;
- if (floppies)
- for (j = 0; floppies[j]; j++)
- if ((floppies[j]->detached == 0) && (floppies[j]->device != NULL))
- devices[i++] = floppies[j];
- if (cdroms)
- for (j = 0; cdroms[j]; j++)
- if ((cdroms[j]->detached == 0) && (cdroms[j]->device != NULL))
- devices[i++] = cdroms[j];
- if (disks)
- for (j = 0; disks[j]; j++)
- if ((disks[j]->detached == 0) && (disks[j]->device != NULL))
- devices[i++] = disks[j];
-
- devices[i] = NULL;
- numDevices = i;
-
- for (i = 0; devices[i]; i++) {
- logMessage(DEBUGLVL, "devices[%d] is %s", i, devices[i]->device);
- }
-
- *devNames = malloc((numDevices + 1) * sizeof(*devNames));
- for (i = 0; devices[i] && (i < numDevices); i++)
- (*devNames)[i] = strdup(devices[i]->device);
- free(devices);
- (*devNames)[i] = NULL;
-
- if (i != numDevices)
- logMessage(WARNING, "somehow numDevices != len(devices)");
-
return numDevices;
}
@@ -434,7 +389,7 @@ int loadDriverFromMedia(int class, struct loaderData_s *loaderData,
before = 0;
found = 0;
- devices = probeDevices(class, BUS_UNSPEC, PROBE_LOADED);
+ devices = getDevices(class);
if (devices)
for(; devices[before]; before++);
@@ -470,7 +425,7 @@ int loadDriverFromMedia(int class, struct loaderData_s *loaderData,
busProbe(0);
- devices = probeDevices(class, BUS_UNSPEC, PROBE_LOADED);
+ devices = getDevices(class);
if (devices)
for(; devices[found]; found++);
@@ -526,7 +481,7 @@ int loadDriverDisks(int class, struct loaderData_s *loaderData) {
if (rc != 1)
return LOADER_OK;
- rc = loadDriverFromMedia(CLASS_UNSPEC, loaderData, 1, 0);
+ rc = loadDriverFromMedia(DEVICE_ANY, loaderData, 1, 0);
if (rc == LOADER_BACK)
return LOADER_OK;
@@ -535,7 +490,7 @@ int loadDriverDisks(int class, struct loaderData_s *loaderData) {
_("Do you wish to load any more driver disks?"));
if (rc != 1)
break;
- loadDriverFromMedia(CLASS_UNSPEC, loaderData, 0, 0);
+ loadDriverFromMedia(DEVICE_ANY, loaderData, 0, 0);
} while (1);
return LOADER_OK;
@@ -571,7 +526,7 @@ void getDDFromSource(struct loaderData_s * loaderData, char * src) {
* scsi cdrom drives */
#if !defined(__s390__) && !defined(__s390x__)
} else if (!strncmp(src, "cdrom", 5)) {
- loadDriverDisks(CLASS_UNSPEC, loaderData);
+ loadDriverDisks(DEVICE_ANY, loaderData);
return;
#endif
} else if (!strncmp(src, "path:", 5)) {
diff --git a/loader2/driverselect.c b/loader2/driverselect.c
index 0c87481..8105c35 100644
--- a/loader2/driverselect.c
+++ b/loader2/driverselect.c
@@ -26,7 +26,6 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
-#include <kudzu/kudzu.h>
#include "modules.h"
#include "moduleinfo.h"
@@ -34,7 +33,6 @@
#include "loadermisc.h"
#include "log.h"
#include "lang.h"
-#include "hardware.h"
#include "driverdisk.h"
struct sortModuleList {
@@ -154,19 +152,12 @@ int chooseManualDriver(int class, struct loaderData_s *loaderData) {
newtGrid grid, buttons;
struct newtExitStruct es;
- if (class == CLASS_NETWORK)
+ if (class == DEVICE_NETWORK)
type = DRIVER_NET;
- else if ((class == CLASS_SCSI) || (class == CLASS_HD) ||
- (class == CLASS_CDROM) || (class == CLASS_IDE) ||
- (class == CLASS_ATA) || (class == CLASS_SATA))
+ else if (class == DEVICE_DISK || class == DEVICE_CDROM)
type = DRIVER_SCSI;
- else if (class == CLASS_UNSPEC)
+ else
type = DRIVER_ANY;
- else {
- logMessage(ERROR, "unknown device class %d specified; aborting manual "
- "selection", class);
- return LOADER_ERROR;
- }
do {
sortedOrder = malloc(sizeof(*sortedOrder) * modInfo->numModules);
diff --git a/loader2/hardware.c b/loader2/hardware.c
index b1d7751..cecdf13 100644
--- a/loader2/hardware.c
+++ b/loader2/hardware.c
@@ -25,7 +25,6 @@
#include <errno.h>
#include <fcntl.h>
-#include <kudzu/kudzu.h>
#include <popt.h>
#include <string.h>
#include <strings.h>
diff --git a/loader2/hdinstall.c b/loader2/hdinstall.c
index d98a350..1c7fe7f 100644
--- a/loader2/hdinstall.c
+++ b/loader2/hdinstall.c
@@ -290,7 +290,7 @@ char * mountHardDrive(struct installMethod * method,
if (rc == 2)
return NULL;
- rc = loadDriverFromMedia(CLASS_HD, loaderData, 0, 0);
+ rc = loadDriverFromMedia(DEVICE_DISK, loaderData, 0, 0);
if (rc == LOADER_BACK)
return NULL;
@@ -376,7 +376,7 @@ char * mountHardDrive(struct installMethod * method,
if (es.reason == NEWT_EXIT_COMPONENT && es.u.co == back) {
return NULL;
} else if (es.reason == NEWT_EXIT_HOTKEY && es.u.key == NEWT_KEY_F2) {
- rc = loadDriverFromMedia(CLASS_HD, loaderData, 0, 0);
+ rc = loadDriverFromMedia(DEVICE_DISK, loaderData, 0, 0);
if (rc == LOADER_BACK)
return NULL;
diff --git a/loader2/kickstart.c b/loader2/kickstart.c
index e626c57..96c2f5e 100644
--- a/loader2/kickstart.c
+++ b/loader2/kickstart.c
@@ -27,7 +27,6 @@
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
-#include <kudzu/kudzu.h>
#include <newt.h>
#include <popt.h>
#include <stdlib.h>
@@ -246,27 +245,27 @@ int ksGetCommand(int cmd, char ** last, int * argc, char *** argv) {
return 1;
}
-int kickstartFromFloppy(char *kssrc) {
+int kickstartFromRemovable(char *kssrc) {
struct device ** devices;
char *p, *kspath;
int i, rc;
- logMessage(INFO, "doing kickstart from floppy");
- devices = probeDevices(CLASS_FLOPPY, BUS_MISC | BUS_IDE | BUS_SCSI, PROBE_LOADED);
+ logMessage(INFO, "doing kickstart from removable media");
+ devices = getDevices(DEVICE_DISK);
if (!devices) {
- logMessage(ERROR, "no floppy devices");
+ logMessage(ERROR, "no disks");
return 1;
}
for (i = 0; devices[i]; i++) {
- if (devices[i]->detached == 0) {
- logMessage(INFO, "first non-detached floppy is %s", devices[i]->device);
+ if (devices[i]->priv.removable == 1) {
+ logMessage(INFO, "first removable media is %s", devices[i]->device);
break;
}
}
- if (!devices[i] || (devices[i]->detached != 0)) {
- logMessage(ERROR, "no floppy devices");
+ if (!devices[i] || (devices[i]->priv.removable == 0)) {
+ logMessage(ERROR, "no removable devices");
return 1;
}
@@ -283,7 +282,7 @@ int kickstartFromFloppy(char *kssrc) {
if (rc == 3) {
startNewt();
newtWinMessage(_("Error"), _("OK"),
- _("Cannot find ks.cfg on boot floppy."));
+ _("Cannot find ks.cfg on removable media."));
}
return 1;
}
@@ -420,7 +419,7 @@ void getKickstartFile(struct loaderData_s *loaderData) {
rc = kickstartFromNfs(c+4, loaderData);
loaderData->ksFile = strdup("/tmp/ks.cfg");
} else if (!strncmp(c, "floppy", 6)) {
- rc = kickstartFromFloppy(c);
+ rc = kickstartFromRemovable(c);
loaderData->ksFile = strdup("/tmp/ks.cfg");
} else if (!strncmp(c, "hd:", 3)) {
rc = kickstartFromHD(c);
diff --git a/loader2/loader.c b/loader2/loader.c
index f64843c..6c4be47 100644
--- a/loader2/loader.c
+++ b/loader2/loader.c
@@ -120,11 +120,11 @@ int post_link_sleep = 0;
static struct installMethod installMethods[] = {
#if !defined(__s390__) && !defined(__s390x__)
- { N_("Local CD/DVD"), 0, CLASS_CDROM, mountCdromImage },
+ { N_("Local CD/DVD"), 0, DEVICE_CDROM, mountCdromImage },
#endif
- { N_("Hard drive"), 0, CLASS_HD, mountHardDrive },
- { N_("NFS directory"), 1, CLASS_NETWORK, mountNfsImage },
- { "URL", 1, CLASS_NETWORK, mountUrlImage },
+ { N_("Hard drive"), 0, DEVICE_DISK, mountHardDrive },
+ { N_("NFS directory"), 1, DEVICE_NETWORK, mountNfsImage },
+ { "URL", 1, DEVICE_NETWORK, mountUrlImage },
};
static int numMethods = sizeof(installMethods) / sizeof(struct installMethod);
@@ -932,7 +932,7 @@ static void checkForRam(void) {
static int haveDeviceOfType(int type) {
struct device ** devices;
- devices = probeDevices(type, BUS_UNSPEC, PROBE_LOADED);
+ devices = getDevices(type);
if (devices) {
return 1;
}
@@ -1091,7 +1091,7 @@ static char *doLoaderMain(char * location,
step = STEP_KBD;
dir = -1;
} else {
- needed = installMethods[validMethods[methodNum]].deviceType;
+ needed = installMethods[validMethods[methodNum]].type;
step = STEP_DRIVER;
dir = 1;
}
@@ -1121,7 +1121,7 @@ static char *doLoaderMain(char * location,
break;
}
- chooseManualDriver(installMethods[validMethods[methodNum]].deviceType,
+ chooseManualDriver(installMethods[validMethods[methodNum]].type,
loaderData);
/* it doesn't really matter what we return here; we just want
* to reprobe and make sure we have the driver */
@@ -1144,8 +1144,8 @@ static char *doLoaderMain(char * location,
break;
case STEP_NETWORK:
- if ( (installMethods[validMethods[methodNum]].deviceType !=
- CLASS_NETWORK) && (!hasGraphicalOverride()) &&
+ if ( (installMethods[validMethods[methodNum]].type !=
+ DEVICE_NETWORK) && (!hasGraphicalOverride()) &&
!FL_ASKNETWORK(flags)) {
needsNetwork = 0;
if (dir == 1)
@@ -1156,8 +1156,8 @@ static char *doLoaderMain(char * location,
}
needsNetwork = 1;
- if (!haveDeviceOfType(CLASS_NETWORK)) {
- needed = CLASS_NETWORK;
+ if (!haveDeviceOfType(DEVICE_NETWORK)) {
+ needed = DEVICE_NETWORK;
step = STEP_DRIVER;
break;
}
@@ -1346,7 +1346,7 @@ static int manualDeviceCheck(struct loaderData_s *loaderData) {
if (rc != 2)
break;
- chooseManualDriver(CLASS_UNSPEC, loaderData);
+ chooseManualDriver(DEVICE_ANY, loaderData);
} while (1);
return 0;
}
@@ -1586,7 +1586,7 @@ int main(int argc, char ** argv) {
if (FL_MODDISK(flags)) {
startNewt();
- loadDriverDisks(CLASS_UNSPEC, &loaderData);
+ loadDriverDisks(DEVICE_ANY, &loaderData);
}
if (!access("/dd.img", R_OK)) {
diff --git a/loader2/loader.h b/loader2/loader.h
index 6e14c69..b5c1a79 100644
--- a/loader2/loader.h
+++ b/loader2/loader.h
@@ -115,6 +115,7 @@ char * getProductPath(void);
char * getProductArch(void);
#include "modules.h"
+#include "../isys/devices.h"
/* JKFIXME: I don't like all of the _set attribs, but without them,
* we can't tell if it was explicitly set by kickstart/cmdline or
* if we just got it going through the install. */
diff --git a/loader2/method.h b/loader2/method.h
index 4f1f295..ec34781 100644
--- a/loader2/method.h
+++ b/loader2/method.h
@@ -20,9 +20,7 @@
#ifndef H_METHOD
#define H_METHOD
-#include "modules.h"
#include "loader.h"
-#include <kudzu/kudzu.h>
/* method identifiers, needs to match struct installMethod order in loader.c */
enum {
@@ -37,7 +35,7 @@ enum {
struct installMethod {
char * name;
int network;
- enum deviceClass deviceType; /* for pcmcia */
+ enum deviceType type;
char * (*mountImage)(struct installMethod * method,
char * location, struct loaderData_s * loaderData);
};
diff --git a/loader2/net.c b/loader2/net.c
index 652aab0..edc16fb 100644
--- a/loader2/net.c
+++ b/loader2/net.c
@@ -34,7 +34,6 @@
#include <string.h>
#include <strings.h>
#include <unistd.h>
-#include <kudzu/kudzu.h>
#include "../isys/dns.h"
#include "../isys/isys.h"
@@ -1409,7 +1408,7 @@ int writeNetInfo(const char * fn, struct networkDeviceConfig * dev) {
char ret[48];
ip_addr_t *tip;
- devices = probeDevices(CLASS_NETWORK, BUS_UNSPEC, PROBE_LOADED);
+ devices = getDevices(DEVICE_NETWORK);
if (!devices)
return 0;
@@ -1729,7 +1728,7 @@ int chooseNetworkInterface(struct loaderData_s * loaderData) {
struct device ** devs;
char * ksMacAddr = NULL;
- devs = probeDevices(CLASS_NETWORK, BUS_UNSPEC, PROBE_LOADED);
+ devs = getDevices(DEVICE_NETWORK);
if (!devs) {
logMessage(ERROR, "no network devices in choose network device!");
return LOADER_ERROR;
@@ -1753,22 +1752,16 @@ int chooseNetworkInterface(struct loaderData_s * loaderData) {
if (!devs[i]->device)
continue;
- /* if kudzu hands us a device name of 'eth', we lack firmware */
- /* skip the device as an option for installation (#251941) */
- if ((strlen(devs[i]->device) == 3) &&
- (!strncmp(devs[i]->device, "eth", 3)))
- continue;
-
/* require passing a flag for wireless while our wireless support
* sucks */
if (is_wireless_interface(devs[i]->device) && !FL_ALLOW_WIRELESS(flags))
continue;
- if (devs[i]->desc) {
+ if (devs[i]->description) {
deviceNames[deviceNums] = alloca(strlen(devs[i]->device) +
- strlen(devs[i]->desc) + 4);
+ strlen(devs[i]->description) + 4);
sprintf(deviceNames[deviceNums],"%s - %s",
- devs[i]->device, devs[i]->desc);
+ devs[i]->device, devs[i]->description);
if (strlen(deviceNames[deviceNums]) > max)
max = strlen(deviceNames[deviceNums]);
devices[deviceNums] = devs[i]->device;
diff --git a/loader2/urlinstall.c b/loader2/urlinstall.c
index 54a1b26..58cdc63 100644
--- a/loader2/urlinstall.c
+++ b/loader2/urlinstall.c
@@ -356,7 +356,7 @@ int getFileFromUrl(char * url, char * dest,
char *dev, *mac, *tmpstr;
struct device **devices;
- devices = probeDevices(CLASS_NETWORK, BUS_UNSPEC, PROBE_LOADED);
+ devices = getDevices(DEVICE_NETWORK);
for (i = 0; devices && devices[i]; i++) {
dev = devices[i]->device;
mac = netlink_interfaces_mac2str(dev);
--
1.5.3.7
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]