summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorErik Troan <ewt@redhat.com>2001-03-14 18:24:06 +0000
committerErik Troan <ewt@redhat.com>2001-03-14 18:24:06 +0000
commitf1881c05f2fb5ef726e2f29439bc75c37ffcb924 (patch)
treef7d7d07ed2e645cb83190ec3bc8e7a3cc6dce9cd
parent2dae3cac7cbdf590141f4ec915e60669d3b54c07 (diff)
downloadanaconda-f1881c05f2fb5ef726e2f29439bc75c37ffcb924.tar.gz
anaconda-f1881c05f2fb5ef726e2f29439bc75c37ffcb924.tar.xz
anaconda-f1881c05f2fb5ef726e2f29439bc75c37ffcb924.zip
added magic to work around promise raid controllers
-rw-r--r--isys/Makefile2
-rw-r--r--isys/isys.c54
-rw-r--r--isys/isys.py1
-rw-r--r--isys/probe.c48
-rw-r--r--isys/probe.h6
5 files changed, 74 insertions, 37 deletions
diff --git a/isys/Makefile b/isys/Makefile
index 588cf937f..ca6393eb4 100644
--- a/isys/Makefile
+++ b/isys/Makefile
@@ -6,7 +6,7 @@ CFLAGS = -I/usr/include/python1.5 -I.. -Wall -O2 -g -fPIC -DHAVE_NFS -D_LARGEFIL
OBJECTS = nfsmount.o dns.o nfsmount_clnt.o nfsmount_xdr.o imount.o \
smp.o moduleinfo.o devnodes.o cpio.o probe.o uncpio.o \
- lang.o isofs.o
+ lang.o isofs.o pdc.o
SOURCES = $(patsubst %.o,%.c,$(OBJECTS)) isys.c
STATICOBJS = otherinsmod.o
LOADLIBES = -lbz2 -lresolv -lz -lpci -lpopt -lpump -lext2fs
diff --git a/isys/isys.c b/isys/isys.c
index 37b7e458c..0f20a6972 100644
--- a/isys/isys.c
+++ b/isys/isys.c
@@ -41,6 +41,7 @@
#include "smp.h"
#include "lang.h"
#include "../balkan/byteswap.h"
+#include "../balkan/balkan.h"
#ifndef CDROMEJECT
#define CDROMEJECT 0x5309
@@ -855,10 +856,61 @@ static PyObject * probedListScsi(probedListObject * o, PyObject * args) {
return Py_None;
}
+int pdc_dev_running_raid(int fd);
+
+#ifdef __i386__
+static int ideFilter(struct kddevice * dev) {
+ char where[50];
+ int fd;
+ int rc;
+ struct partitionTable table;
+ int i;
+
+ sprintf(where, "/tmp/%s", dev->name);
+ if (devMakeInode(dev->name, where)) return 1;
+
+ if ((fd = open(where, O_RDONLY)) < 0) return 1;
+ rc = pdc_dev_running_raid(fd);
+
+ /* no pdc magic, so include this device */
+ if (rc != 1)
+ return 1;
+
+ /* it's a pdc device w/o a valid partition table, skip it (probably
+ raid 5) */
+ if (balkanReadTable(fd, &table)) {
+ close(fd);
+ return 0;
+ }
+
+ close(fd);
+
+ /* we have a pdc device with a valid partition table. if there are
+ windows partitions on it, ignore this device */
+ for (i = 0; i < table.maxNumPartitions; i++) {
+ if (table.parts[i].type == BALKAN_PART_DOS ||
+ table.parts[i].type == BALKAN_PART_NTFS) {
+ return 0;
+ }
+ }
+
+ /* otherwise we have a pdc device with partition table, but no windows
+ filesystems */
+
+ return 1;
+}
+#endif
+
static PyObject * probedListIde(probedListObject * o, PyObject * args) {
+ kdFilterType filter = NULL;
+
+#ifdef __i386__
+ filter = ideFilter;
+#endif
+
if (!PyArg_ParseTuple(args, "")) return NULL;
- kdFindIdeList(&o->list, 0);
+ kdFindFilteredIdeList(&o->list, 0, filter);
Py_INCREF(Py_None);
return Py_None;
diff --git a/isys/isys.py b/isys/isys.py
index 364777c28..608f58297 100644
--- a/isys/isys.py
+++ b/isys/isys.py
@@ -1,4 +1,5 @@
import kudzu
+import _balkan
import _isys
import string
import os
diff --git a/isys/probe.c b/isys/probe.c
index 3991e239b..3f97364f0 100644
--- a/isys/probe.c
+++ b/isys/probe.c
@@ -152,15 +152,16 @@ bye:
}
int kdFindIdeList(struct knownDevices * devices, int code) {
+ return kdFindFilteredIdeList(devices, code, NULL);
+}
+
+int kdFindFilteredIdeList(struct knownDevices * devices, int code,
+ kdFilterType filter) {
DIR * dir;
char path[80];
int fd, i;
struct dirent * ent;
struct kddevice device;
- struct hd_driveid hdId;
- char devChar;
- char name[10];
- struct cdrom_volctrl vol;
if (access("/proc/ide", R_OK)) return 0;
@@ -199,7 +200,12 @@ int kdFindIdeList(struct knownDevices * devices, int code) {
device.model = strdup(path);
}
- addDevice(devices, device);
+ if (filter && !filter(&device)) {
+ free(device.model);
+ free(device.name);
+ } else {
+ addDevice(devices, device);
+ }
}
}
}
@@ -209,34 +215,6 @@ int kdFindIdeList(struct knownDevices * devices, int code) {
closedir(dir);
- for (devChar = 'a'; devChar <= 'h'; devChar++) {
- sprintf(name, "hd%c", devChar);
- if (deviceKnown(devices, name)) continue;
-
- devMakeInode(name, "/tmp/ideprobe");
- fd = open("/tmp/ideprobe", O_RDONLY | O_NONBLOCK);
- unlink("/tmp/ideprobe");
-
- if (fd < 0) continue;
-
- device.name = strdup(name);
-
- ioctl(fd, HDIO_GET_IDENTITY, &hdId);
- close(fd);
-
- if (!ioctl(fd, CDROMVOLCTRL, &vol))
- device.class = CLASS_CDROM;
- else if (hdId.command_set_1 & 4)
- device.class = CLASS_FLOPPY;
- else
- device.class = CLASS_HD;
-
- if (*hdId.model)
- device.model = strdup(hdId.model);
-
- addDevice(devices, device);
- }
-
qsort(devices->known, devices->numKnown, sizeof(*devices->known),
sortDevices);
@@ -482,7 +460,7 @@ static int CompaqSmartArrayGetDevices(struct knownDevices * devices) {
FILE *f;
char buf[256];
char *ptr;
- int numMatches = 0, ctlNum = 0;
+ int ctlNum = 0;
char ctl[64];
char *path;
@@ -602,7 +580,7 @@ static int CompaqSmartArray5300GetDevices(struct knownDevices * devices) {
FILE *f;
char buf[256];
char *ptr;
- int numMatches = 0, ctlNum = 0;
+ int ctlNum = 0;
char ctl[64];
char *path;
diff --git a/isys/probe.h b/isys/probe.h
index ea14b5d94..90a4ee4c0 100644
--- a/isys/probe.h
+++ b/isys/probe.h
@@ -16,9 +16,15 @@ struct knownDevices {
int numKnownAlloced;
};
+/* 0 if the device should be filtered from the list, 1 if it should be
+ included */
+typedef int (*kdFilterType)(const struct kddevice * dev);
+
struct knownDevices kdInit(void);
int kdFindNetList(struct knownDevices * devices, int code);
int kdFindIdeList(struct knownDevices * devices, int code);
+int kdFindFilteredIdeList(struct knownDevices * devices, int code,
+ kdFilterType filter);
int kdFindScsiList(struct knownDevices * devices, int code);
void kdFree(struct knownDevices * devices);
void kdAddDevice(struct knownDevices * devices, enum deviceClass devClass,