summaryrefslogtreecommitdiffstats
path: root/isys
diff options
context:
space:
mode:
authorJeremy Katz <katzj@redhat.com>2004-02-10 19:43:04 +0000
committerJeremy Katz <katzj@redhat.com>2004-02-10 19:43:04 +0000
commit9cdef8bf8a2493388a30c8658328cb974bfc42ad (patch)
treee2c78dd97dab9a3446351740e187aa279c4de878 /isys
parent38d25bf61909bdad951117a929f1252783198c42 (diff)
downloadanaconda-9cdef8bf8a2493388a30c8658328cb974bfc42ad.tar.gz
anaconda-9cdef8bf8a2493388a30c8658328cb974bfc42ad.tar.xz
anaconda-9cdef8bf8a2493388a30c8658328cb974bfc42ad.zip
keep a cache of the drives so that we don't probe over and over and over
again (since the floppy probe is slow). also, limit to the classes we care about to speed it up a little more
Diffstat (limited to 'isys')
-rw-r--r--isys/isys.py16
1 files changed, 14 insertions, 2 deletions
diff --git a/isys/isys.py b/isys/isys.py
index 505590b64..9cdd587d2 100644
--- a/isys/isys.py
+++ b/isys/isys.py
@@ -242,15 +242,27 @@ classMap = { "disk": kudzu.CLASS_HD,
"cdrom": kudzu.CLASS_CDROM,
"floppy": kudzu.CLASS_FLOPPY }
+cachedDrives = None
+
+def flushDriveDict():
+ global cachedDrives
+ cachedDrives = None
+
def driveDict(klassArg):
- ret = {}
+ global cachedDrives
+ if cachedDrives is not None:
+ return cachedDrives
+ ret = {}
+
# FIXME: need to add dasd probing to kudzu
- devs = kudzu.probe(kudzu.CLASS_UNSPEC, kudzu.BUS_UNSPEC, 0)
+ devs = kudzu.probe(kudzu.CLASS_HD | kudzu.CLASS_CDROM | kudzu.CLASS_FLOPPY,
+ kudzu.BUS_UNSPEC, kudzu.PROBE_SAFE)
for dev in devs:
if dev.deviceclass == classMap[klassArg]:
ret[dev.device] = dev.desc
+ cachedDrives = ret
return ret
def hardDriveDict():