diff options
author | Matt Wilson <msw@redhat.com> | 1999-09-16 20:49:35 +0000 |
---|---|---|
committer | Matt Wilson <msw@redhat.com> | 1999-09-16 20:49:35 +0000 |
commit | f72087a736a96bf38c383dc2586b542686789061 (patch) | |
tree | 54c56efd0ebd53d37a1ed2e2e6811233b6d0a327 /isys | |
parent | 9a14f8a105704760556af2af17abf895328b2abe (diff) | |
download | anaconda-f72087a736a96bf38c383dc2586b542686789061.tar.gz anaconda-f72087a736a96bf38c383dc2586b542686789061.tar.xz anaconda-f72087a736a96bf38c383dc2586b542686789061.zip |
look for drives on dac960 and compaq smartarray controllers
Diffstat (limited to 'isys')
-rw-r--r-- | isys/probe.c | 89 |
1 files changed, 89 insertions, 0 deletions
diff --git a/isys/probe.c b/isys/probe.c index 567c4afeb..27906ca14 100644 --- a/isys/probe.c +++ b/isys/probe.c @@ -9,6 +9,9 @@ #include "probe.h" +int dac960GetDevices(struct knownDevices * devices); +static int CompaqSmartArrayGetDevices(struct knownDevices * devices); + static int sortDevices(const void * a, const void * b) { const struct kddevice * one = a; const struct kddevice * two = b; @@ -296,6 +299,9 @@ int kdFindScsiList(struct knownDevices * devices) { start = next; } + dac960GetDevices(devices); + CompaqSmartArrayGetDevices(devices); + qsort(devices->known, devices->numKnown, sizeof(*devices->known), sortDevices); @@ -309,3 +315,86 @@ struct knownDevices kdInit(void) { return kd; } + +static int dac960GetDevices(struct knownDevices * devices) { + const char *filename; + char buf[256]; + char *ptr, *iptr; + int numMatches = 0; + int numIDIs = 0; + FILE* f; + struct kddevice newDevice; + + if (!access("/var/log/dmesg", R_OK)) + filename = "/var/log/dmesg"; + else + filename = "/tmp/syslog"; + + if (!(f = fopen(filename, "r"))) { + return 1; + } + + /* We are looking for lines of this format: +DAC960#0: /dev/rd/c0d0: RAID-7, Online, 17928192 blocks, Write Thru +0123456790123456789012 + */ + buf [sizeof(buf) - 1] = '\0'; + while (fgets(buf, sizeof(buf) - 1, f)) { + ptr = strstr (buf, "/dev/rd/"); + if (ptr) { + iptr = strchr (ptr, ':'); + if (iptr) { + /* put a NULL at the ':' */ + *iptr = '\0'; + + if (!deviceKnown(devices, ptr + 5)) { + newDevice.name = strdup(ptr + 5); + newDevice.class = CLASS_HD; + + ptr = iptr; + while (*ptr != ',') + ptr++; + *ptr = '\0'; + + newDevice.model = strdup(iptr + 2); + + addDevice(devices, newDevice); + } + } + } + } + + return 0; +} + +static int CompaqSmartArrayGetDevices(struct knownDevices * devices) { + struct kddevice newDevice; + FILE *f; + char buf[256]; + char *ptr; + int numMatches = 0, ctlNum = 0; + char ctl[20]; + + printf("here\n"); + + sprintf(ctl, "/proc/array/ida%d", ctlNum++); + + while ((f = fopen(ctl, "r"))){ + while (fgets(buf, sizeof(buf) - 1, f)) { + if (!strncmp(buf, "ida/", 4)) { + ptr = strchr(buf, ':'); + *ptr = '\0'; + + if (!deviceKnown(devices, buf)) { + newDevice.name = strdup(buf); + newDevice.model = strdup("Compaq RAID logical disk"); + newDevice.class = CLASS_HD; + addDevice(devices, newDevice); + } + } + } + sprintf(ctl, "/proc/array/ida%d", ctlNum++); + } + + return 0; +} |