Andy Grover | 3aa27ba | 2012-03-13 15:00:37 -0700 | [diff] [blame^] | 1 | python-kmod |
| 2 | =========== |
| 3 | |
| 4 | Python bindings for libkmod |
| 5 | |
| 6 | libkmod is a C library to make inserting, removing, and listing |
| 7 | Linux kernel modules easier. It can be found at: |
| 8 | |
| 9 | http://git.kernel.org/?p=utils/kernel/kmod/kmod.git;a=summary |
| 10 | |
| 11 | python-kmod is a Python wrapper module for libkmod, exposing common |
| 12 | module operations: listing installed modules, modprobe, and rmmod. |
| 13 | It is at: |
| 14 | |
| 15 | https://github.com/agrover/python-kmod |
| 16 | |
| 17 | Example (python invoked as root) |
| 18 | -------------------------------- |
| 19 | |
| 20 | >>>import kmod |
| 21 | |
| 22 | >>>km = kmod.Kmod() |
| 23 | |
| 24 | >>>km.loaded_modules() |
| 25 | |
| 26 | [('nfs', 407706), |
| 27 | ('nfs_acl', 12741) |
| 28 | |
| 29 | ... |
| 30 | |
| 31 | ('virtio_blk', 17549)] |
| 32 | |
| 33 | >>>km.modprobe("btrfs") |
| 34 | |
| 35 | >>>km.rmmod("btrfs") |
| 36 | |
| 37 | Building |
| 38 | -------- |
| 39 | |
| 40 | Ensure Python and kmod headers are installed and run: |
| 41 | |
| 42 | python setup.py build |
| 43 | |
| 44 | |