summaryrefslogtreecommitdiffstats
path: root/isys
diff options
context:
space:
mode:
authorMatt Wilson <msw@redhat.com>1999-09-08 18:27:40 +0000
committerMatt Wilson <msw@redhat.com>1999-09-08 18:27:40 +0000
commitbfee0e7611dd99a4c1b7ffa2cd038c943aba5117 (patch)
tree27d84756da7ee78a2c672f88da663bdf34e2be33 /isys
parentecce42954effad096e4c613b9705ca55f430efb3 (diff)
downloadanaconda-bfee0e7611dd99a4c1b7ffa2cd038c943aba5117.tar.gz
anaconda-bfee0e7611dd99a4c1b7ffa2cd038c943aba5117.tar.xz
anaconda-bfee0e7611dd99a4c1b7ffa2cd038c943aba5117.zip
o patches for jj for moving to kudzu for probing
o don't change the root text for a messagewindow
Diffstat (limited to 'isys')
-rw-r--r--isys/Makefile6
-rw-r--r--isys/isys.c15
-rw-r--r--isys/probe.c30
-rw-r--r--isys/probe.h10
4 files changed, 29 insertions, 32 deletions
diff --git a/isys/Makefile b/isys/Makefile
index a3ead4a8c..a60ae8d9b 100644
--- a/isys/Makefile
+++ b/isys/Makefile
@@ -1,9 +1,9 @@
-CFLAGS = -I/usr/include/python1.5 -g
+CFLAGS = -I/usr/include/python1.5 -I.. -g
OBJECTS = isys.o nfsmount.o dns.o mount_clnt.o mount_xdr.o imount.o \
smp.o moduleinfo.o devnodes.o cpio.o probe.o
STATICOBJS = otherinsmod.o
-STATICLIBS = pci/libpciprobe.a
-LOADLIBES = -lrpm -lresolv -lz -lpci -lpopt
+STATICLIBS = ../kudzu/libkudzu.a
+LOADLIBES = -lrpm -lbz2 -lresolv -lz -lpci -lpopt
SUBDIRS = modutils pci
PYTHONLIBDIR = $(DESTDIR)/usr/lib/python1.5/site-packages
diff --git a/isys/isys.c b/isys/isys.c
index dc93baa4f..b80945da0 100644
--- a/isys/isys.c
+++ b/isys/isys.c
@@ -9,7 +9,6 @@
#include "imount.h"
#include "isys.h"
-#include "pci/pciprobe.h"
#include "probe.h"
#include "smp.h"
@@ -455,16 +454,13 @@ static PyObject * doReadModInfo(PyObject * s, PyObject * args) {
}
static PyObject * doPciProbe(PyObject * s, PyObject * args) {
- struct pciDevice ** matches, ** item;
+ struct device ** matches, ** item;
PyObject * list;
if (!PyArg_ParseTuple(args, "")) return NULL;
- /* may as well try <shrug> */
- probePciReadDrivers("isys/pci/pcitable");
- probePciReadDrivers("/etc/pcitable");
+ matches = probeDevices(CLASS_UNSPEC,BUS_PCI|BUS_SBUS,PROBE_ALL);
- matches = probePci(0, 1);
if (!matches) {
Py_INCREF(Py_None);
return Py_None;
@@ -473,6 +469,7 @@ static PyObject * doPciProbe(PyObject * s, PyObject * args) {
list = PyList_New(0);
for (item = matches; *item; item++) {
PyList_Append(list, Py_BuildValue("s", (*item)->driver));
+ freeDevice (*item);
}
free(matches);
@@ -682,11 +679,11 @@ static PyObject * probedListSubscript(probedListObject * o, int item) {
if (po->list.known[item].model) model = po->list.known[item].model;
switch (po->list.known[item].class) {
- case DEVICE_CDROM:
+ case CLASS_CDROM:
class = "cdrom"; break;
- case DEVICE_DISK:
+ case CLASS_HD:
class = "disk"; break;
- case DEVICE_NET:
+ case CLASS_NETWORK:
class = "net"; break;
}
diff --git a/isys/probe.c b/isys/probe.c
index 4b0a9d7ae..567c4afeb 100644
--- a/isys/probe.c
+++ b/isys/probe.c
@@ -10,8 +10,8 @@
#include "probe.h"
static int sortDevices(const void * a, const void * b) {
- const struct device * one = a;
- const struct device * two = b;
+ const struct kddevice * one = a;
+ const struct kddevice * two = b;
return strcmp(one->name, two->name);
}
@@ -25,7 +25,7 @@ static int deviceKnown(struct knownDevices * devices, char * dev) {
return 0;
}
-static void addDevice(struct knownDevices * devices, struct device dev) {
+static void addDevice(struct knownDevices * devices, struct kddevice dev) {
if (devices->numKnown == devices->numKnownAlloced) {
devices->numKnownAlloced += 5;
devices->known = realloc(devices->known,
@@ -37,7 +37,7 @@ static void addDevice(struct knownDevices * devices, struct device dev) {
void kdAddDevice(struct knownDevices * devices, enum deviceClass devClass,
char * devName, char * devModel) {
- struct device new;
+ struct kddevice new;
new.class = devClass;
new.name = devName;
@@ -56,7 +56,7 @@ int kdFindNetList(struct knownDevices * devices) {
int fd;
char buf[1024];
char * start, * end;
- struct device newDevice;
+ struct kddevice newDevice;
if ((fd = open("/proc/net/dev", O_RDONLY)) < 0) {
fprintf(stderr, "failed to open /proc/net/dev!\n");
@@ -84,7 +84,7 @@ int kdFindNetList(struct knownDevices * devices) {
newDevice.name = strdup(start);
newDevice.model = NULL;
- newDevice.class = DEVICE_NET;
+ newDevice.class = CLASS_NETWORK;
addDevice(devices, newDevice);
}
@@ -103,7 +103,7 @@ int kdFindIdeList(struct knownDevices * devices) {
char path[80];
int fd, i;
struct dirent * ent;
- struct device device;
+ struct kddevice device;
if (access("/proc/ide", R_OK)) return 0;
@@ -121,13 +121,13 @@ int kdFindIdeList(struct knownDevices * devices) {
close(fd);
path[i - 1] = '\0'; /* chop off trailing \n */
- device.class = DEVICE_UNKNOWN;
+ device.class = CLASS_UNSPEC;
if (!strcmp(path, "cdrom"))
- device.class = DEVICE_CDROM;
+ device.class = CLASS_CDROM;
else if (!strcmp(path, "disk"))
- device.class = DEVICE_DISK;
+ device.class = CLASS_HD;
- if (device.class != DEVICE_UNKNOWN) {
+ if (device.class != CLASS_UNSPEC) {
device.name = strdup(ent->d_name);
sprintf(path, "/proc/ide/%s/model", ent->d_name);
@@ -169,7 +169,7 @@ int kdFindScsiList(struct knownDevices * devices) {
char driveName = 'a';
char cdromNum = '0';
char tapeNum = '0';
- struct device device;
+ struct kddevice device;
if (access("/proc/scsi/scsi", R_OK)) return 0;
@@ -269,13 +269,13 @@ int kdFindScsiList(struct knownDevices * devices) {
*typebuf = '\0';
if (strstr(start, "Direct-Access")) {
sprintf(typebuf, "sd%c", driveName++);
- device.class = DEVICE_DISK;
+ device.class = CLASS_HD;
} else if (strstr(start, "Sequential-Access")) {
sprintf(typebuf, "st%c", tapeNum++);
- device.class = DEVICE_TAPE;
+ device.class = CLASS_TAPE;
} else if (strstr(start, "CD-ROM")) {
sprintf(typebuf, "scd%c", cdromNum++);
- device.class = DEVICE_CDROM;
+ device.class = CLASS_CDROM;
}
if (*typebuf && !deviceKnown(devices, typebuf)) {
diff --git a/isys/probe.h b/isys/probe.h
index 4c4c29556..f236a9845 100644
--- a/isys/probe.h
+++ b/isys/probe.h
@@ -1,16 +1,16 @@
#ifndef H_PROBE
#define H_PROBE
-struct device {
+#include "kudzu/kudzu.h"
+
+struct kddevice {
char * name; /* malloced */
char * model;
- enum deviceClass { DEVICE_UNKNOWN, DEVICE_DISK, DEVICE_CDROM, DEVICE_NET,
- DEVICE_TAPE }
- class;
+ enum deviceClass class;
};
struct knownDevices {
- struct device * known;
+ struct kddevice * known;
int numKnown;
int numKnownAlloced;
};