summaryrefslogtreecommitdiffstats
path: root/isys
diff options
context:
space:
mode:
authorMatt Wilson <msw@redhat.com>1999-08-07 03:06:33 +0000
committerMatt Wilson <msw@redhat.com>1999-08-07 03:06:33 +0000
commit5c198114640db1191e4b501d828622e6b9bc90d6 (patch)
tree88626098eca1f9ba5e0fb942c252b90c8d2ccbf1 /isys
parent1c98f99db5dd38e8be6812f3c927bc8c28f46414 (diff)
downloadanaconda-5c198114640db1191e4b501d828622e6b9bc90d6.tar.gz
anaconda-5c198114640db1191e4b501d828622e6b9bc90d6.tar.xz
anaconda-5c198114640db1191e4b501d828622e6b9bc90d6.zip
writes changes to disks
Diffstat (limited to 'isys')
-rw-r--r--isys/isys.c11
-rw-r--r--isys/isys.py13
-rwxr-xr-xisys/testprobe11
3 files changed, 29 insertions, 6 deletions
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