From 5c198114640db1191e4b501d828622e6b9bc90d6 Mon Sep 17 00:00:00 2001 From: Matt Wilson Date: Sat, 7 Aug 1999 03:06:33 +0000 Subject: writes changes to disks --- isys/isys.c | 11 +++++++++-- isys/isys.py | 13 ++++++++++++- isys/testprobe | 11 ++++++++--- 3 files changed, 29 insertions(+), 6 deletions(-) (limited to 'isys') diff --git a/isys/isys.c b/isys/isys.c index 89f5e6aa8..e9bdd33cc 100644 --- a/isys/isys.c +++ b/isys/isys.c @@ -56,7 +56,7 @@ static PyObject * probedListNet(probedListObject * s, PyObject * args); static PyObject * probedListScsi(probedListObject * s, PyObject * args); static PyObject * probedListIde(probedListObject * s, PyObject * args); static int probedListLength(PyObject * o); -static PyObject * probedListSubscript(PyObject * o, int item); +static PyObject * probedListSubscript(probedListObject * o, int item); static PyMethodDef probedListObjectMethods[] = { { "updateNet", (PyCFunction) probedListNet, METH_VARARGS, NULL }, @@ -413,11 +413,18 @@ static int probedListLength(PyObject * o) { return ((probedListObject *) o)->list.numKnown; } -static PyObject * probedListSubscript(PyObject * o, int item) { +static PyObject *indexerr; + +static PyObject * probedListSubscript(probedListObject * o, int item) { probedListObject * po = (probedListObject *) o; char * model = ""; char * class; + if (item > o->list.numKnown - 1) { + indexerr = PyString_FromString("list index out of range"); + PyErr_SetObject(PyExc_IndexError, indexerr); + return NULL; + } if (po->list.known[item].model) model = po->list.known[item].model; switch (po->list.known[item].class) { diff --git a/isys/isys.py b/isys/isys.py index ea85d5d84..0387a58df 100644 --- a/isys/isys.py +++ b/isys/isys.py @@ -10,7 +10,7 @@ def umount(what): def smpAvailable(): return _isys.smpavailable() -def probeDevices(): +def probePciDevices(): # probes all probeable buses and returns a list of # ( driver, major, minor, description, args ) tuples, where args is a # list of (argName, argDescrip) tuples @@ -26,6 +26,17 @@ def probeDevices(): return result +def hardDriveList (): + p = _isys.ProbedList() + p.updateIde() + p.updateScsi() + + dict = {} + for (klass, dev, descr) in p: + if (klass == "disk"): + dict[dev] = descr + return dict + def moduleListByType(type): return _isys.modulelist(type) diff --git a/isys/testprobe b/isys/testprobe index 4064d458e..f0b1573a5 100755 --- a/isys/testprobe +++ b/isys/testprobe @@ -9,6 +9,11 @@ p.updateScsi() i = 0 print "found devices:" -while (i < len(p)): - print "\t", p[i] - i = i + 1 +#while (i < len(p)): +# print "\t", p[i] +# i = i + 1 + +print len (p) + +for i in p: + print "\t", i -- cgit