diff options
author | Jeremy Katz <katzj@redhat.com> | 2003-04-24 15:46:31 +0000 |
---|---|---|
committer | Jeremy Katz <katzj@redhat.com> | 2003-04-24 15:46:31 +0000 |
commit | 0a562126d84c59a113231ae7ab38984f92d62153 (patch) | |
tree | 5e87b9094f4ebdc328979e3a0640dee5f1fc40cb /isys | |
parent | dd200d781bd9012f562399c2ee69c23fe60d86b9 (diff) | |
download | anaconda-0a562126d84c59a113231ae7ab38984f92d62153.tar.gz anaconda-0a562126d84c59a113231ae7ab38984f92d62153.tar.xz anaconda-0a562126d84c59a113231ae7ab38984f92d62153.zip |
another taroon merge. tagged before as before-taroon-merge, after as
after-taroon-merge
this one adds s390 fixes, basic i/p series platform support, support for
multiple kernels and one second stage, cmdline kickstart mode (nice for s390),
some warning cleanups.
Diffstat (limited to 'isys')
-rw-r--r-- | isys/Makefile | 2 | ||||
-rw-r--r-- | isys/cpio.c | 1 | ||||
-rw-r--r-- | isys/devnodes.c | 26 | ||||
-rw-r--r-- | isys/isys.c | 10 | ||||
-rw-r--r-- | isys/isys.py | 7 | ||||
-rw-r--r-- | isys/probe.c | 76 | ||||
-rw-r--r-- | isys/probe.h | 7 | ||||
-rw-r--r-- | isys/smp.c | 3 | ||||
-rw-r--r-- | isys/stubs.h | 1 | ||||
-rw-r--r-- | isys/vio.c | 174 |
10 files changed, 269 insertions, 38 deletions
diff --git a/isys/Makefile b/isys/Makefile index 673ee934f..b0ae5daf1 100644 --- a/isys/Makefile +++ b/isys/Makefile @@ -4,7 +4,7 @@ CFLAGS = -ffunction-sections -I$(PYTHONINCLUDE) -I.. -Wall -Os -g -DHAVE_NFS -D OBJECTS = nfsmount.o nfsmount_clnt.o nfsmount_xdr.o imount.o \ smp.o devnodes.o cpio.o probe.o uncpio.o \ - lang.o isofs.o dns.o linkdetect.o pdc.o hpt.o silraid.o + lang.o isofs.o dns.o linkdetect.o pdc.o hpt.o silraid.o vio.o SOBJECTS = $(patsubst %.o,%.lo,$(OBJECTS)) SOURCES = $(patsubst %.o,%.c,$(OBJECTS)) isys.c LOADLIBES = -lresolv -lpci -lpopt -lpump -lext2fs -lz -lbterm -lbogl -lwlite diff --git a/isys/cpio.c b/isys/cpio.c index 7aeb16d38..008c6b97c 100644 --- a/isys/cpio.c +++ b/isys/cpio.c @@ -1,5 +1,4 @@ #include <fcntl.h> -#include <newt.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> diff --git a/isys/devnodes.c b/isys/devnodes.c index c130499e0..83d1fab5b 100644 --- a/isys/devnodes.c +++ b/isys/devnodes.c @@ -225,6 +225,32 @@ int devMakeInode(char * devName, char * path) { { minor = minor + atoi(devName + 7); } + } else if (!strncmp(devName, "iseries/vcd", 11)) { + /* IBM virtual cdrom (iseries) */ + type = S_IFBLK; + major = 113; + minor = devName[11] - 'a'; + } else if (!strncmp(devName, "iseries/vd", 10)) { + int drive = 0; + char * num = NULL; + + /* IBM virtual disk (iseries) */ + type = S_IFBLK; + major = 112; + + if (devName[11] && isdigit(devName[11])) { + drive = devName[10] - 'a'; + num = devName + 11; + } else if (devName[11] && islower(devName[11])) { + drive = ((devName[10] - 'a' + 1) * 26) + devName[11] - 'a'; + num = devName + 12; + } else { + drive = devName[10] - 'a'; + } + + minor = (drive * 8); + if (num && num[0]) + minor += (num[0] - '0'); } else { for (i = 0; i < numDevices; i++) { if (!strcmp(devices[i].name, devName)) break; diff --git a/isys/isys.c b/isys/isys.c index 21bc300d7..872b84654 100644 --- a/isys/isys.c +++ b/isys/isys.c @@ -102,6 +102,7 @@ static PyObject * hasIdeRaidMagic(PyObject * s, PyObject * args); static PyObject * start_bterm(PyObject * s, PyObject * args); static PyObject * py_getDasdPorts(PyObject * s, PyObject * args); static PyObject * py_isUsableDasd(PyObject * s, PyObject * args); +static PyObject * py_isLdlDasd(PyObject * s, PyObject * args); static PyMethodDef isysModuleMethods[] = { { "ejectcdrom", (PyCFunction) doEjectCdrom, METH_VARARGS, NULL }, @@ -153,6 +154,7 @@ static PyMethodDef isysModuleMethods[] = { { "startBterm", (PyCFunction) start_bterm, METH_VARARGS, NULL }, { "getDasdPorts", (PyCFunction) py_getDasdPorts, METH_VARARGS, NULL}, { "isUsableDasd", (PyCFunction) py_isUsableDasd, METH_VARARGS, NULL}, + { "isLdlDasd", (PyCFunction) py_isLdlDasd, METH_VARARGS, NULL}, { NULL } } ; @@ -1386,6 +1388,14 @@ static PyObject * py_isUsableDasd(PyObject * o, PyObject * args) { return Py_BuildValue("i", isUsableDasd(devname)); } +static PyObject * py_isLdlDasd(PyObject * o, PyObject * args) { + char *devname; + if (!PyArg_ParseTuple(args, "s", &devname)) + return NULL; + return Py_BuildValue("i", isLdlDasd(devname)); +} + + static PyObject * printObject (PyObject * o, PyObject * args) { PyObject * obj; char buf[256]; diff --git a/isys/isys.py b/isys/isys.py index 2ddb44e1c..d1e6f6dee 100644 --- a/isys/isys.py +++ b/isys/isys.py @@ -14,8 +14,6 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # -import kudzu -import parted import _isys import string import os @@ -251,6 +249,8 @@ def driveDict(klassArg): return dict def hardDriveDict(): + import parted + dict = driveDict("disk") # this is kind of ugly, but it's much easier to do this from python @@ -310,6 +310,9 @@ def getDasdPorts(): def isUsableDasd(device): return _isys.isUsableDasd(device) +def isLdlDasd(device): + return _isys.isLdlDasd(device) + def makeDevInode(name, fn=None): if fn: _isys.mkdevinode(name, fn) diff --git a/isys/probe.c b/isys/probe.c index 4d37e13a8..8da11c9b5 100644 --- a/isys/probe.c +++ b/isys/probe.c @@ -21,11 +21,12 @@ static int dac960GetDevices(struct knownDevices * devices); static int CompaqSmartArrayGetDevices(struct knownDevices * devices); static int CompaqSmartArray5300GetDevices(struct knownDevices * devices); static int ataraidGetDevices(struct knownDevices * devices); -/* Added support for I2O Block devices: Boji Kannanthanam - <boji.t.Kannanthanam@intel.com> */ +static int viodGetDevices(struct knownDevices * devices); +/* Added support for I2O Block devices: Boji Kannanthanam + <boji.t.Kannanthanam@intel.com> */ static int ProcPartitionsGetDevices(struct knownDevices * devices); -static int readFD (int fd, char **buf) +int readFD (int fd, char **buf) { char *p; size_t size = 4096; @@ -64,7 +65,7 @@ static int sortDevices(const void * a, const void * b) { return strcmp(one->name, two->name); } -static int deviceKnown(struct knownDevices * devices, char * dev) { +int deviceKnown(struct knownDevices * devices, char * dev) { int i; for (i = 0; i < devices->numKnown; i++) @@ -73,7 +74,7 @@ static int deviceKnown(struct knownDevices * devices, char * dev) { return 0; } -static void addDevice(struct knownDevices * devices, struct kddevice dev) { +void addDevice(struct knownDevices * devices, struct kddevice dev) { if (devices->numKnown == devices->numKnownAlloced) { devices->numKnownAlloced += 5; devices->known = realloc(devices->known, @@ -135,13 +136,13 @@ int kdFindNetList(struct knownDevices * devices, int code) { *end = '\0'; if (strcmp(start, "lo")) { - if (deviceKnown(devices, start)) continue; - - newDevice.name = strdup(start); - newDevice.model = NULL; - newDevice.class = CLASS_NETWORK; - newDevice.code = code; - addDevice(devices, newDevice); + if (!deviceKnown(devices, start)) { + newDevice.name = strdup(start); + newDevice.model = NULL; + newDevice.class = CLASS_NETWORK; + newDevice.code = code; + addDevice(devices, newDevice); + } } start = strchr(end + 1, '\n'); @@ -174,27 +175,12 @@ int vtoc_read_volume_label (int fd, unsigned long vlabel_start, } int read_vlabel(dasd_information_t *dasd_info, int fd, int blksize, volume_label_t *vlabel) { - volume_label_t tmp; unsigned long pos; - int ret; pos = dasd_info->label_block * blksize; memset(vlabel, 0, sizeof(volume_label_t)); - if ((strncmp(dasd_info->type, "ECKD", 4) == 0) && - (!dasd_info->FBA_layout)) { - /* OS/390 and zOS compatible disk layout */ - return vtoc_read_volume_label(fd, pos, vlabel); - } - else { - /* standard LINUX disk layout */ - ret = vtoc_read_volume_label(fd, pos, &tmp); - if(!ret) { - memcpy(vlabel->vollbl, &tmp, sizeof(tmp)-4); - return 0; - } - return ret; - } + return vtoc_read_volume_label(fd, pos, vlabel); } #endif @@ -204,8 +190,8 @@ int isUsableDasd(char *device) { #else char devname[16]; char label[5], v4_hex[9]; - char v4ebcdic_hex[] = "e5d6d3f1"; /* VOL1 */ char l4ebcdic_hex[] = "d3d5e7f1"; /* LNX1 */ + char cms1_hex[] = "c3d4e2f1"; /* CMS1 */ int f, ret, blksize; dasd_information_t dasd_info; volume_label_t vlabel; @@ -245,14 +231,20 @@ int isUsableDasd(char *device) { memset(v4_hex, 0, 9); strncpy(label, vlabel.volkey, 4); sprintf(v4_hex, "%02x%02x%02x%02x", label[0], label[1], label[2], label[3]); - if(!strncmp(v4_hex, v4ebcdic_hex, 9) || !strncmp(v4_hex, l4ebcdic_hex, 9)) { - /* fprintf(stderr, "Found a usable device: %s\n", devname); */ - return 1; + if(!strncmp(v4_hex, cms1_hex, 9)) { + return 0; } - return 0; + if(!strncmp(v4_hex, l4ebcdic_hex, 9)) { + return 2; + } + return 1; #endif } +int isLdlDasd(char * device) { + return (isUsableDasd(device) == 2); +} + char *getDasdPorts() { #if !defined(__s390__) && !defined(__s390x__) return 0; @@ -414,6 +406,7 @@ int kdFindScsiList(struct knownDevices * devices, int code) { dac960GetDevices(devices); CompaqSmartArrayGetDevices(devices); CompaqSmartArray5300GetDevices(devices); + viodGetDevices(devices); return 0; } @@ -432,6 +425,7 @@ int kdFindScsiList(struct knownDevices * devices, int code) { dac960GetDevices(devices); CompaqSmartArrayGetDevices(devices); CompaqSmartArray5300GetDevices(devices); + viodGetDevices(devices); goto bye; } @@ -563,6 +557,7 @@ int kdFindScsiList(struct knownDevices * devices, int code) { dac960GetDevices(devices); CompaqSmartArrayGetDevices(devices); CompaqSmartArray5300GetDevices(devices); + viodGetDevices(devices); /* we can't really sanely do ataraid devs yet (#82848) */ #if 0 ataraidGetDevices(devices); @@ -896,3 +891,18 @@ static int CompaqSmartArray5300GetDevices(struct knownDevices * devices) { return 0; } + +static int viodGetDevices(struct knownDevices * devices) { + if (access("/proc/iSeries", X_OK)) + return 0; + + vioGetCdDevs(devices); + vioGetDasdDevs(devices); + + return 0; +} + + + + + diff --git a/isys/probe.h b/isys/probe.h index f3886f0d7..7f6f013ac 100644 --- a/isys/probe.h +++ b/isys/probe.h @@ -86,5 +86,12 @@ void kdFree(struct knownDevices * devices); void kdAddDevice(struct knownDevices * devices, enum deviceClass devClass, char * devName, char * devModel); char *getDasdPorts(); +int isLdlDasd(char * dev); +int vioGetDasdDevs(struct knownDevices * devices); +int vioGetCdDevs(struct knownDevices * devices); + +int readFD (int fd, char **buf); +void addDevice(struct knownDevices * devices, struct kddevice dev); +int deviceKnown(struct knownDevices * devices, char * dev); #endif diff --git a/isys/smp.c b/isys/smp.c index a558491c1..5478e14a6 100644 --- a/isys/smp.c +++ b/isys/smp.c @@ -336,7 +336,8 @@ static int groupForSMP(int mode) if (mode == MODE_SUMMIT_CHECK) { if (!strncmp(cth.oem_id, "IBM ENSW", 8) && (!strncmp(cth.product_id, "NF 6000R", 8) || - !strncmp(cth.product_id, "VIGIL SMP", 9))) + !strncmp(cth.product_id, "VIGIL SMP", 9) || + !strncmp(cth.product_id, "RUTHLESS", 8))) return 1; return 0; } diff --git a/isys/stubs.h b/isys/stubs.h index 040a376ce..9e8ee4ce1 100644 --- a/isys/stubs.h +++ b/isys/stubs.h @@ -11,6 +11,7 @@ #include <zlib.h> #define gunzip_open(x) gzopen(x, "r") +#define gunzip_dopen gzdopen(x, "r") #define gunzip_close gzclose #define gunzip_read gzread #define gzip_write gzwrite diff --git a/isys/vio.c b/isys/vio.c new file mode 100644 index 000000000..a39cf13f2 --- /dev/null +++ b/isys/vio.c @@ -0,0 +1,174 @@ +/* + * vio.c - probing for vio devices on the iSeries (viocd and viodasd) + * + * Jeremy Katz <katzj@redhat.com> + * + * Copyright 2003 Red Hat, Inc. + * + */ + +#include <ctype.h> +#include <errno.h> +#include <fcntl.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> + +#include <kudzu/kudzu.h> +#include "probe.h" + +int vioGetCdDevs(struct knownDevices * devices) { +#if !defined(__powerpc__) + return 0; +#else + int fd, i; + char * buf, * start, * end, * chptr, * next, * model, * ptr; + int ctlNum = 0; + char ctl[64]; + struct kddevice newDevice; + + if (access("/proc/iSeries/viocd", R_OK)) + return 0; + + /* Read from /proc/iSeries/viocd */ + fd = open("/proc/iSeries/viocd", O_RDONLY); + if (fd < 0) { + fprintf(stderr, "failed to open /proc/iSeries/viocd!\n"); + return 1; + } + + i = readFD(fd, &buf); + if (i < 1) { + close(fd); + free (buf); + fprintf(stderr, "error reading /proc/iSeries/viocd!\n"); + return 1; + } + close(fd); + buf[i] = '\0'; + + start = buf; + end = start + strlen(start); + while (*start && start < end) { + /* parse till end of line and store the start of next line. */ + chptr = start; + while (*chptr != '\n') chptr++; + *chptr = '\0'; + next = chptr + 1; + + /* get rid of anything which is not alpha */ + while (!(isalpha(*start))) start++; + + model = NULL; + if (!strncmp("viocd", start, 5)) + model = "IBM Virtual CDROM"; + + if (model) { + start += 13; + ptr = strchr(start, ' '); + *ptr++ = '\0'; + + ctlNum = atoi(start); + + chptr = strstr(ptr, "type ") + 5; + ptr = strchr(chptr, ','); + *ptr = '\0'; + + model = alloca((20 + strlen(chptr)) * sizeof(char *)); + sprintf(model, "IBM Virtual CD-ROM Model %s", chptr); + snprintf(ctl, 63, "iseries/vcd%d", ctlNum); + + if (!deviceKnown(devices, ctl)) { + newDevice.name = strdup(ctl); + newDevice.model = strdup(model); + newDevice.class = CLASS_CDROM; + addDevice(devices, newDevice); + } + // printf("model is %s, ctl is %s\n", model, ctl); + } + + start = next; + end = start + strlen(start); + } /* end of while */ + + free (buf); + return 0; +#endif +} + +int vioGetDasdDevs(struct knownDevices * devices) { +#if !defined(__powerpc__) + return 0; +#else + int fd, i; + char * buf, * start, * end, * chptr, * next, * model, * ptr; + int ctlNum = 0; + char ctl[64]; + struct kddevice newDevice; + + if (access("/proc/iSeries/viodasd", R_OK)) + return 0; + + /* Read from /proc/iSeries/viodasd */ + fd = open("/proc/iSeries/viodasd", O_RDONLY); + if (fd < 0) { + fprintf(stderr, "failed to open /proc/iSeries/viodasd!\n"); + return 1; + } + + i = readFD(fd, &buf); + if (i < 1) { + close(fd); + free (buf); + fprintf(stderr, "error reading /proc/iSeries/viodasd!\n"); + return 1; + } + close(fd); + buf[i] = '\0'; + + start = buf; + end = start + strlen(start); + while (*start && start < end) { + /* parse till end of line and store the start of next line. */ + chptr = start; + while (*chptr != '\n') chptr++; + *chptr = '\0'; + next = chptr + 1; + + /* get rid of anything which is not alpha */ + while (!(isalpha(*start))) start++; + + model = NULL; + if (!strncmp("DISK ", start, 5)) + model = "IBM Virtual DASD"; + + if (model) { + chptr = start += 5; + ptr = strchr(chptr, ' '); + *ptr = '\0'; + ctlNum = atoi(chptr); + + if (ctlNum <= 26) { + snprintf(ctl, 63, "iseries/vd%c", 'a' + ctlNum); + } else { + snprintf(ctl, 63, "iseries/vda%c", 'a' + ctlNum - 26); + } + + if (!deviceKnown(devices, ctl)) { + newDevice.name = strdup(ctl); + newDevice.model = strdup(model); + newDevice.class = CLASS_HD; + addDevice(devices, newDevice); + } + // printf("model is %s, ctl is %s\n", model, ctl); + } + + start = next; + end = start + strlen(start); + } /* end of while */ + + free (buf); + return 0; +#endif +} |