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