[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[PATCH 4/7] Add a method, which returns list of paths to loaded kmods



---
 isys/isys.py |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/isys/isys.py b/isys/isys.py
index 338ca26..94ce039 100755
--- a/isys/isys.py
+++ b/isys/isys.py
@@ -393,6 +393,17 @@ def ext2HasJournal(device):
     hasjournal = _isys.e2hasjournal(device);
     return hasjournal
 
+def modulesWithPaths():
+    mods = []
+    for modline in open("/proc/modules", "r"):
+        modName, _ = modline.split(" ", 1)
+        modInfo = os.popen("modinfo '%s'" % (modName,)).readlines()
+        modPaths = [ line[9:].strip()
+            for line in modInfo
+            if line.startswith("filename:") ]
+        mods.extend(modPaths)
+    return mods
+
 def driveUsesModule(device, modules):
     """Returns true if a drive is using a prticular module.  Only works
        for SCSI devices right now."""
-- 
1.6.4.4


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]