Skip to main content

Python binding for kmod

Project description

The libkmod2 is a library that provides an API for insertion, removal, configuration and listing of kernel modules.

kmodpy is a Python ctypes wrapper module for libkmod, exposing common module operations: listing of installed modules, modprobe, modinfo, show_depends and rmmod.

Follows an example executed as root:

>>> import kmodpy
>>> km = kmodpy.Kmod()
>>> [m for m in km.list()]
    [(u'nfs', 407706),
     (u'nfs_acl', 12741)
     ...
     (u'virtio_blk', 17549)]
>>> km.modprobe("loop", extra_options="max_loop=8")
>>> km.rmmod("loop")
>>> list(km.modinfo("loop"))
    [('alias', 'char-major-10-237'), ('alias', 'block-major-7-*'),
     ('license', 'GPL'), ('parm', 'max_part:Maximum number of
     partitions per loop device'), ('parmtype', 'max_part:int'),
     ('parm', 'max_loop:Maximum number of loop
     devices'), ('parmtype', 'max_loop:int'), ('depends', ''),
     ('intree', 'Y'), ('vermagic', '3.12-1-amd64 SMP mod_unload
     modversions '), ('alias', 'devname:loop-control')]
>>> list(km.show_depends("ext4"))
    ['mbcache', 'crc16', 'jbd2']

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kmodpy-0.1.13.tar.gz (20.5 kB view details)

Uploaded Source

File details

Details for the file kmodpy-0.1.13.tar.gz.

File metadata

  • Download URL: kmodpy-0.1.13.tar.gz
  • Upload date:
  • Size: 20.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.8.1 setuptools/20.10.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/2.7.9

File hashes

Hashes for kmodpy-0.1.13.tar.gz
Algorithm Hash digest
SHA256 69b208c4b8120bf1ef800cafc4958bc48c08db72e8208b2fd4696c732529ee73
MD5 e5fb0f74024501b1c10a7323e7b9ee46
BLAKE2b-256 a56a837ff0c8da94dfda3d60323377ed0b597de9c525483c2094b0e3f2240eae

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page