# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+cimport libc.stdint as _stdint
+
+
cdef extern from *:
ctypedef char* const_char_ptr 'const char *'
ctypedef char* const_char_const_ptr 'const char const *'
ctypedef void* const_void_ptr 'const void *'
+
cdef extern from 'errno.h':
enum: EEXIST
+
cdef extern from 'stdbool.h':
ctypedef struct bool:
pass
# returned by kernel
int kmod_module_get_refcnt(const_kmod_module_ptr mod)
long kmod_module_get_size(const_kmod_module_ptr mod)
+
+ # Information retrieved from ELF headers and section
+ int kmod_module_get_versions(const_kmod_module_ptr mod, kmod_list **list)
+ const_char_ptr kmod_module_version_get_symbol(const_kmod_list_ptr entry)
+ _stdint.uint64_t kmod_module_version_get_crc(const_kmod_list_ptr entry)
+ void kmod_module_versions_free_list(kmod_list *list)
return _libkmod_h.kmod_module_get_size(self.module)
size = property(fget=_size_get)
+ def _versions_get(self):
+ cdef _list.ModList ml = _list.ModList()
+ cdef _list.ModListItem mli
+ err = _libkmod_h.kmod_module_get_versions(self.module, &ml.list)
+ if err < 0:
+ raise _KmodError('Could not get versions')
+ try:
+ for item in ml:
+ mli = <_list.ModListItem> item
+ symbol = _util.char_ptr_to_str(
+ _libkmod_h.kmod_module_version_get_symbol(mli.list))
+ crc = _libkmod_h.kmod_module_version_get_crc(mli.list)
+ yield {'symbol': symbol, 'crc': crc}
+ finally:
+ _libkmod_h.kmod_module_versions_free_list(ml.list)
+ ml.list = NULL
+ versions = property(fget=_versions_get)
+
def insert(self, flags=0, extra_options=None, install_callback=None,
data=None, print_action_callback=None):
cdef char *opt = NULL