Hello community,
here is the log from the commit of package kmod for openSUSE:Factory checked in at 2013-07-16 15:33:45
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/kmod (Old)
and /work/SRC/openSUSE:Factory/.kmod.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "kmod"
Changes:
--------
--- /work/SRC/openSUSE:Factory/kmod/kmod.changes 2013-04-17 18:22:47.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.kmod.new/kmod.changes 2013-07-16 15:33:47.000000000 +0200
@@ -1,0 +2,7 @@
+Wed Jul 3 22:18:38 UTC 2013 - jengelh@inai.de
+
+- Update to new upstream release 14
+* Some bug fixes and a new "static-nodes" command to parse
+ modules.devname.
+
+-------------------------------------------------------------------
Old:
----
kmod-13.tar.sign
kmod-13.tar.xz
New:
----
kmod-14.tar.sign
kmod-14.tar.xz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ kmod.spec ++++++
--- /var/tmp/diff_new_pack.F7u9xb/_old 2013-07-16 15:33:48.000000000 +0200
+++ /var/tmp/diff_new_pack.F7u9xb/_new 2013-07-16 15:33:48.000000000 +0200
@@ -21,7 +21,7 @@
Summary: Utilities to load modules into the kernel
License: LGPL-2.1+ and GPL-2.0+
Group: System/Kernel
-Version: 13
+Version: 14
Release: 0
Url: http://www.jonmasters.org/blog/2011/12/20/libkmod-replaces-module-init-tools...
#Announce: https://lwn.net/Articles/502622/
@@ -94,6 +94,7 @@
in %lname.
%prep
+%{?gpg_verify: xz -dk "%{S:0}"; %gpg_verify %{S:2}}
%setup -q
%build
@@ -143,7 +144,7 @@
ln -s "%_bindir/kmod" "$b/bin/";
%if "%_libdir" != "/%_lib"
ln -s "%_libdir/libkmod.so.2" "$b/%_lib/";
-ln -s "%_libdir/libkmod.so.2.2.3" "$b/%_lib/";
+ln -s "%_libdir/libkmod.so.2.2.4" "$b/%_lib/";
%endif
%check
++++++ kmod-13.tar.xz -> kmod-14.tar.xz ++++++
++++ 3735 lines of diff (skipped)
++++ retrying with extended exclude list
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/kmod-13/Makefile.am new/kmod-14/Makefile.am
--- old/kmod-13/Makefile.am 2013-04-10 00:33:53.000000000 +0200
+++ new/kmod-14/Makefile.am 2013-07-03 16:26:44.000000000 +0200
@@ -37,7 +37,7 @@
$(SED_PROCESS)
LIBKMOD_CURRENT=4
-LIBKMOD_REVISION=3
+LIBKMOD_REVISION=4
LIBKMOD_AGE=2
noinst_LTLIBRARIES = libkmod/libkmod-util.la
@@ -104,22 +104,23 @@
if BUILD_TOOLS
bin_PROGRAMS = tools/kmod
-noinst_SCRIPTS = tools/insmod tools/rmmod tools/lsmod \
- tools/modprobe tools/modinfo tools/depmod
+noinst_SCRIPTS = tools/test/insmod tools/test/rmmod tools/test/lsmod \
+ tools/test/modprobe tools/test/modinfo tools/test/depmod
tools_kmod_SOURCES = tools/kmod.c tools/kmod.h tools/lsmod.c \
tools/rmmod.c tools/insmod.c \
tools/modinfo.c tools/modprobe.c \
- tools/depmod.c tools/log.h tools/log.c
+ tools/depmod.c tools/log.h tools/log.c \
+ tools/static-nodes.c
tools_kmod_LDADD = libkmod/libkmod-util.la \
libkmod/libkmod.la
-noinst_PROGRAMS = tools/kmod-nolib
-tools_kmod_nolib_SOURCES = $(tools_kmod_SOURCES)
-tools_kmod_nolib_LDADD = libkmod/libkmod-util.la \
+noinst_PROGRAMS = tools/test/kmod
+tools_test_kmod_SOURCES = $(tools_kmod_SOURCES)
+tools_test_kmod_LDADD = libkmod/libkmod-util.la \
libkmod/libkmod-private.la
-${noinst_SCRIPTS}: tools/kmod-nolib
+${noinst_SCRIPTS}: tools/test/kmod
$(AM_V_GEN) ($(RM) $@; \
$(LN_S) $(notdir $<) $@)
endif
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/kmod-13/NEWS new/kmod-14/NEWS
--- old/kmod-13/NEWS 2013-04-10 00:31:55.000000000 +0200
+++ new/kmod-14/NEWS 2013-07-03 17:06:56.000000000 +0200
@@ -1,3 +1,22 @@
+kmod 14
+=======
+
+- Bug fixes:
+ - Fix some format strings
+ - Protect against NULL being passed around to index
+ - Avoid calling syscall() with -1 when finit_module() is not available,
+ since this doesn't always work
+ - Fix not being able to remove alias due to checking the module's
+ refcount
+ - Minor fixes and refactors
+
+- New features:
+ - Improve libkmod documentation, particularly on how flags are dealt
+ with.
+ - Remove ability to build a static libkmod
+ - Add static-nodes command to kmod that parses modules.devname
+ generating output in useful formats
+
kmod 13
=======
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/kmod-13/TODO new/kmod-14/TODO
--- old/kmod-13/TODO 2012-11-08 05:01:52.000000000 +0100
+++ new/kmod-14/TODO 2013-04-30 17:37:43.000000000 +0200
@@ -1,9 +1,25 @@
Features:
=========
+* Add command for signing modules
+ - There is a script to sign modules in kernel tree, but we should be able to
+ sign modules by ourselves
+
+* Stop using NOFAIL() and fatal()
+
+* Protect index against OOM
+
+* Implement actions in kmod tool like 'insert', 'remove', 'info', etc
+
* testsuite:
- when fake delete_module() succeeds, remove its entry from /sys/module
+* Stop using system() inside the library and use fork + exec instead
+
+* config: configs that do not need to be matched by fnmatch() could be using a
+ vector instead of a list. This way we could search in it by calling
+ bsearch().
+
* review API, maybe unify all of these getters:
- kmod_module_version_get_symbol()
- kmod_module_version_get_crc()
@@ -15,17 +31,9 @@
- kmod_module_symbols_free_list()
- kmod_module_dependency_symbols_free_list()
-* Stop using system() inside the library and use fork + exec instead
-
-* config: configs that do not need to be matched by fnmatch() could be using a
- vector instead of a list. This way we could search in it by calling
- bsearch().
-
* index: drop the "open(), seek(), read()" implementation and use another one
with mmap(). When lookup() is called and the file is not mmaped, mmap it.
-* Implement actions in kmod tool like 'insert', 'remove', 'info', etc
-
* Finish removal of "rmmod -w" when it's gone from kernel.
* Deprecate not using KMOD_REMOVE_NOWAIT on libkmod.
@@ -37,12 +45,11 @@
- readdir() in /sys/modules: dir without a 'initstate' file means the
module is builtin.
-* module's size should be available under /sys
- - DONE in 3.3: http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=commit;h=cca3...
-
* kill /proc/modules ?
- Unlikely, given other tools might depend on it
+
+
Things that are different from module-init-tools on purpose (!TODO)
===================================================================
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/kmod-13/config.h.in new/kmod-14/config.h.in
--- old/kmod-13/config.h.in 2013-04-10 00:37:54.000000000 +0200
+++ new/kmod-14/config.h.in 2013-07-03 17:41:56.000000000 +0200
@@ -70,9 +70,6 @@
*/
#undef LT_OBJDIR
-/* Define to 1 if your C compiler doesn't accept -c and -o together. */
-#undef NO_MINUS_C_MINUS_O
-
/* Name of package */
#undef PACKAGE
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/kmod-13/configure.ac new/kmod-14/configure.ac
--- old/kmod-13/configure.ac 2013-04-10 00:34:05.000000000 +0200
+++ new/kmod-14/configure.ac 2013-07-03 16:49:47.000000000 +0200
@@ -1,6 +1,6 @@
AC_PREREQ(2.60)
AC_INIT([kmod],
- [13],
+ [14],
[linux-modules@vger.kernel.org],
[kmod],
[http://git.kernel.org/?p=utils/kernel/kmod/kmod.git])
@@ -18,6 +18,10 @@
LT_INIT([disable-static pic-only])
AC_PREFIX_DEFAULT([/usr])
+AS_IF([test "x$enable_static" = "xyes"],
+ [AC_MSG_ERROR([--enable-static is not supported by kmod])])
+
+
#####################################################################
# Program checks and configurations
#####################################################################
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/kmod-13/libkmod/docs/gtk-doc.make new/kmod-14/libkmod/docs/gtk-doc.make
--- old/kmod-13/libkmod/docs/gtk-doc.make 2011-09-18 12:47:37.000000000 +0200
+++ new/kmod-14/libkmod/docs/gtk-doc.make 2013-06-05 23:26:37.000000000 +0200
@@ -74,31 +74,40 @@
#### setup ####
+GTK_DOC_V_SETUP=$(GTK_DOC_V_SETUP_$(V))
+GTK_DOC_V_SETUP_=$(GTK_DOC_V_SETUP_$(AM_DEFAULT_VERBOSITY))
+GTK_DOC_V_SETUP_0=@echo " DOC Preparing build";
+
setup-build.stamp:
- -@if test "$(abs_srcdir)" != "$(abs_builddir)" ; then \
- echo ' DOC Preparing build'; \
+ -$(GTK_DOC_V_SETUP)if test "$(abs_srcdir)" != "$(abs_builddir)" ; then \
files=`echo $(SETUP_FILES) $(expand_content_files) $(DOC_MODULE).types`; \
if test "x$$files" != "x" ; then \
for file in $$files ; do \
test -f $(abs_srcdir)/$$file && \
- cp -pu $(abs_srcdir)/$$file $(abs_builddir)/ || true; \
+ cp -pu $(abs_srcdir)/$$file $(abs_builddir)/$$file || true; \
done; \
fi; \
fi
- @touch setup-build.stamp
+ $(AM_V_at)touch setup-build.stamp
#### scan ####
+GTK_DOC_V_SCAN=$(GTK_DOC_V_SCAN_$(V))
+GTK_DOC_V_SCAN_=$(GTK_DOC_V_SCAN_$(AM_DEFAULT_VERBOSITY))
+GTK_DOC_V_SCAN_0=@echo " DOC Scanning header files";
+
+GTK_DOC_V_INTROSPECT=$(GTK_DOC_V_INTROSPECT_$(V))
+GTK_DOC_V_INTROSPECT_=$(GTK_DOC_V_INTROSPECT_$(AM_DEFAULT_VERBOSITY))
+GTK_DOC_V_INTROSPECT_0=@echo " DOC Introspecting gobjects";
+
scan-build.stamp: $(HFILE_GLOB) $(CFILE_GLOB)
- @echo ' DOC Scanning header files'
- @_source_dir='' ; \
+ $(GTK_DOC_V_SCAN)_source_dir='' ; \
for i in $(DOC_SOURCE_DIR) ; do \
_source_dir="$${_source_dir} --source-dir=$$i" ; \
done ; \
gtkdoc-scan --module=$(DOC_MODULE) --ignore-headers="$(IGNORE_HFILES)" $${_source_dir} $(SCAN_OPTIONS) $(EXTRA_HFILES)
- @if grep -l '^..*$$' $(DOC_MODULE).types > /dev/null 2>&1 ; then \
- echo " DOC Introspecting gobjects"; \
+ $(GTK_DOC_V_INTROSPECT)if grep -l '^..*$$' $(DOC_MODULE).types > /dev/null 2>&1 ; then \
scanobj_options=""; \
gtkdoc-scangobj 2>&1 --help | grep >/dev/null "\-\-verbose"; \
if test "$(?)" = "0"; then \
@@ -113,32 +122,41 @@
test -f $$i || touch $$i ; \
done \
fi
- @touch scan-build.stamp
+ $(AM_V_at)touch scan-build.stamp
$(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt: scan-build.stamp
@true
#### xml ####
+GTK_DOC_V_XML=$(GTK_DOC_V_XML_$(V))
+GTK_DOC_V_XML_=$(GTK_DOC_V_XML_$(AM_DEFAULT_VERBOSITY))
+GTK_DOC_V_XML_0=@echo " DOC Building XML";
+
sgml-build.stamp: setup-build.stamp $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt $(expand_content_files)
- @echo ' DOC Building XML'
- @_source_dir='' ; \
+ $(GTK_DOC_V_XML)_source_dir='' ; \
for i in $(DOC_SOURCE_DIR) ; do \
_source_dir="$${_source_dir} --source-dir=$$i" ; \
done ; \
gtkdoc-mkdb --module=$(DOC_MODULE) --output-format=xml --expand-content-files="$(expand_content_files)" --main-sgml-file=$(DOC_MAIN_SGML_FILE) $${_source_dir} $(MKDB_OPTIONS)
- @touch sgml-build.stamp
+ $(AM_V_at)touch sgml-build.stamp
sgml.stamp: sgml-build.stamp
@true
#### html ####
+GTK_DOC_V_HTML=$(GTK_DOC_V_HTML_$(V))
+GTK_DOC_V_HTML_=$(GTK_DOC_V_HTML_$(AM_DEFAULT_VERBOSITY))
+GTK_DOC_V_HTML_0=@echo " DOC Building HTML";
+
+GTK_DOC_V_XREF=$(GTK_DOC_V_XREF_$(V))
+GTK_DOC_V_XREF_=$(GTK_DOC_V_XREF_$(AM_DEFAULT_VERBOSITY))
+GTK_DOC_V_XREF_0=@echo " DOC Fixing cross-references";
+
html-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files)
- @echo ' DOC Building HTML'
- @rm -rf html
- @mkdir html
- @mkhtml_options=""; \
+ $(GTK_DOC_V_HTML)rm -rf html && mkdir html && \
+ mkhtml_options=""; \
gtkdoc-mkhtml 2>&1 --help | grep >/dev/null "\-\-verbose"; \
if test "$(?)" = "0"; then \
if test "x$(V)" = "x1"; then \
@@ -159,16 +177,18 @@
cp $(abs_builddir)/$$file $(abs_builddir)/html; \
fi; \
done;
- @echo ' DOC Fixing cross-references'
- @gtkdoc-fixxref --module=$(DOC_MODULE) --module-dir=html --html-dir=$(HTML_DIR) $(FIXXREF_OPTIONS)
- @touch html-build.stamp
+ $(GTK_DOC_V_XREF)gtkdoc-fixxref --module=$(DOC_MODULE) --module-dir=html --html-dir=$(HTML_DIR) $(FIXXREF_OPTIONS)
+ $(AM_V_at)touch html-build.stamp
#### pdf ####
+GTK_DOC_V_PDF=$(GTK_DOC_V_PDF_$(V))
+GTK_DOC_V_PDF_=$(GTK_DOC_V_PDF_$(AM_DEFAULT_VERBOSITY))
+GTK_DOC_V_PDF_0=@echo " DOC Building PDF";
+
pdf-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files)
- @echo ' DOC Building PDF'
- @rm -f $(DOC_MODULE).pdf
- @mkpdf_options=""; \
+ $(GTK_DOC_V_PDF)rm -f $(DOC_MODULE).pdf && \
+ mkpdf_options=""; \
gtkdoc-mkpdf 2>&1 --help | grep >/dev/null "\-\-verbose"; \
if test "$(?)" = "0"; then \
if test "x$(V)" = "x1"; then \
@@ -185,7 +205,7 @@
done; \
fi; \
gtkdoc-mkpdf --path="$(abs_srcdir)" $$mkpdf_options $(DOC_MODULE) $(DOC_MAIN_SGML_FILE) $(MKPDF_OPTIONS)
- @touch pdf-build.stamp
+ $(AM_V_at)touch pdf-build.stamp
##############
@@ -200,7 +220,7 @@
rm -f $(SETUP_FILES) $(expand_content_files) $(DOC_MODULE).types; \
fi
-maintainer-clean-local: clean
+maintainer-clean-local:
@rm -rf xml html
install-data-local:
@@ -237,7 +257,7 @@
# Require gtk-doc when making dist
#
if ENABLE_GTK_DOC
-dist-check-gtkdoc:
+dist-check-gtkdoc: docs
else
dist-check-gtkdoc:
@echo "*** gtk-doc must be installed and enabled in order to make dist"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/kmod-13/libkmod/libkmod-elf.c new/kmod-14/libkmod/libkmod-elf.c
--- old/kmod-13/libkmod/libkmod-elf.c 2013-04-09 08:36:53.000000000 +0200
+++ new/kmod-14/libkmod/libkmod-elf.c 2013-04-24 22:02:37.000000000 +0200
@@ -280,10 +280,10 @@
size_t hdr_size, shdr_size, min_size;
int class;
- assert(sizeof(uint16_t) == sizeof(Elf32_Half));
- assert(sizeof(uint16_t) == sizeof(Elf64_Half));
- assert(sizeof(uint32_t) == sizeof(Elf32_Word));
- assert(sizeof(uint32_t) == sizeof(Elf64_Word));
+ assert_cc(sizeof(uint16_t) == sizeof(Elf32_Half));
+ assert_cc(sizeof(uint16_t) == sizeof(Elf64_Half));
+ assert_cc(sizeof(uint32_t) == sizeof(Elf32_Word));
+ assert_cc(sizeof(uint32_t) == sizeof(Elf64_Word));
class = elf_identify(memory, size);
if (class < 0) {
@@ -513,7 +513,7 @@
int i, count, err;
#define MODVERSION_SEC_SIZE (sizeof(struct kmod_modversion64))
- assert(sizeof(struct kmod_modversion64) ==
+ assert_cc(sizeof(struct kmod_modversion64) ==
sizeof(struct kmod_modversion32));
if (elf->class == KMOD_ELF_32)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/kmod-13/libkmod/libkmod-index.c new/kmod-14/libkmod/libkmod-index.c
--- old/kmod-13/libkmod/libkmod-index.c 2013-04-09 09:05:04.000000000 +0200
+++ new/kmod-14/libkmod/libkmod-index.c 2013-06-09 20:46:25.000000000 +0200
@@ -432,9 +432,12 @@
struct index_node_f *root;
struct buffer buf;
+ root = index_readroot(in);
+ if (root == NULL)
+ return;
+
buf_init(&buf);
buf_pushchars(&buf, prefix);
- root = index_readroot(in);
index_dump_node(root, &buf, fd);
buf_release(&buf);
}
@@ -902,9 +905,12 @@
struct index_mm_node *root;
struct buffer buf;
+ root = index_mm_readroot(idx);
+ if (root == NULL)
+ return;
+
buf_init(&buf);
buf_pushchars(&buf, prefix);
- root = index_mm_readroot(idx);
index_mm_dump_node(root, &buf, fd);
buf_release(&buf);
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/kmod-13/libkmod/libkmod-module.c new/kmod-14/libkmod/libkmod-module.c
--- old/kmod-13/libkmod/libkmod-module.c 2013-04-09 09:16:44.000000000 +0200
+++ new/kmod-14/libkmod/libkmod-module.c 2013-05-04 23:56:59.000000000 +0200
@@ -570,8 +570,7 @@
* Drop a reference of each kmod module in @list and releases the resources
* taken by the list itself.
*
- * Returns: NULL if @mod is NULL or if the module was released. Otherwise it
- * returns the passed @mod with its refcount decremented.
+ * Returns: 0
*/
KMOD_EXPORT int kmod_module_unref_list(struct kmod_list *list)
{
@@ -629,9 +628,8 @@
* The result is cached in @mod, so subsequent calls to this function will
* return the already searched list of modules.
*
- * Returns: NULL on failure or if there are any dependencies. Otherwise it
- * returns a list of kmod modules that can be released by calling
- * kmod_module_unref_list().
+ * Returns: NULL on failure. Otherwise it returns a list of kmod modules
+ * that can be released by calling kmod_module_unref_list().
*/
KMOD_EXPORT struct kmod_list *kmod_module_get_dependencies(const struct kmod_module *mod)
{
@@ -740,7 +738,15 @@
/**
* kmod_module_remove_module:
* @mod: kmod module
- * @flags: flags to pass to Linux kernel when removing the module
+ * @flags: flags to pass to Linux kernel when removing the module, valid flags are
+ * KMOD_REMOVE_FORCE: force remove module regardless if it's still in
+ * use by a kernel subsystem or other process;
+ * KMOD_REMOVE_NOWAIT: return immediately. It will fail if the module
+ * is in using and KMOD_REMOVE_FORCE is not specified.
+ * If this module is in use by any kernel subsystem or process, not using
+ * this flag will cause the call to block indefinitely, until the module
+ * is not in use anymore. Always use this flag, it's deprecated not using
+ * it and the default behavior might change in future to always set it.
*
* Remove a module from Linux kernel.
*
@@ -772,7 +778,9 @@
* kmod_module_insert_module:
* @mod: kmod module
* @flags: flags are not passed to Linux Kernel, but instead they dictate the
- * behavior of this function.
+ * behavior of this function, valid flags are
+ * KMOD_INSERT_FORCE_VERMAGIC: ignore kernel version magic;
+ * KMOD_INSERT_FORCE_MODVERSION: ignore symbol version hashes.
* @options: module's options to pass to Linux Kernel.
*
* Insert a module in Linux kernel. It opens the file pointed by @mod,
@@ -881,7 +889,9 @@
/**
* kmod_module_apply_filter
* @ctx: kmod library context
- * @filter_type: bitmask to filter modules on
+ * @filter_type: bitmask to filter modules out, valid types are
+ * KMOD_FILTER_BLACKLIST: filter modules in blacklist out;
+ * KMOD_FILTER_BUILTIN: filter builtin modules out.
* @input: list of kmod_module to be filtered
* @output: where to save the new list
*
@@ -1152,7 +1162,25 @@
* kmod_module_probe_insert_module:
* @mod: kmod module
* @flags: flags are not passed to Linux Kernel, but instead they dictate the
- * behavior of this function.
+ * behavior of this function, valid flags are
+ * KMOD_PROBE_FORCE_VERMAGIC: ignore kernel version magic;
+ * KMOD_PROBE_FORCE_MODVERSION: ignore symbol version hashes;
+ * KMOD_PROBE_IGNORE_COMMAND: whether the probe should ignore install
+ * commands and softdeps configured in the system;
+ * KMOD_PROBE_IGNORE_LOADED: do not check whether the module is already
+ * live in kernel or not;
+ * KMOD_PROBE_DRY_RUN: dry run, do not insert module, just call the
+ * associated callback function;
+ * KMOD_PROBE_FAIL_ON_LOADED: if KMOD_PROBE_IGNORE_LOADED is not specified
+ * and the module is already live in kernel, the function will fail if this
+ * flag is specified;
+ * KMOD_PROBE_APPLY_BLACKLIST_ALL: probe will apply KMOD_FILTER_BLACKLIST
+ * filter to this module and its dependencies. If any of the dependencies (or
+ * the module) is blacklisted, the probe will fail, unless the blacklisted
+ * module is already live in kernel;
+ * KMOD_PROBE_APPLY_BLACKLIST: probe will fail if the module is blacklisted;
+ * KMOD_PROBE_APPLY_BLACKLIST_ALIAS_ONLY: probe will fail if the module is an
+ * alias and is blacklisted.
* @extra_options: module's options to pass to Linux Kernel. It applies only
* to @mod, not to its dependencies.
* @run_install: function to run when @mod is backed by an install command.
@@ -1564,7 +1592,7 @@
* Create a new list of kmod modules with all modules currently loaded in
* kernel. It uses /proc/modules to get the names of loaded modules and to
* create kmod modules by calling kmod_module_new_from_name() in each of them.
- * They are put are put in @list in no particular order.
+ * They are put in @list in no particular order.
*
* The initial refcount is 1, and needs to be decremented to release the
* resources of the kmod_module. The returned @list must be released by
@@ -1652,7 +1680,11 @@
* Get the initstate of this @mod, as returned by Linux Kernel, by reading
* /sys filesystem.
*
- * Returns: < 0 on error or enum kmod_initstate if module is found in kernel.
+ * Returns: < 0 on error or module state if module is found in kernel, valid states are
+ * KMOD_MODULE_BUILTIN: module is builtin;
+ * KMOD_MODULE_LIVE: module is live in kernel;
+ * KMOD_MODULE_COMING: module is being loaded;
+ * KMOD_MODULE_GOING: module is being unloaded.
*/
KMOD_EXPORT int kmod_module_get_initstate(const struct kmod_module *mod)
{
@@ -1839,7 +1871,7 @@
struct kmod_list *list = NULL;
DIR *d;
- if (mod == NULL)
+ if (mod == NULL || mod->ctx == NULL)
return NULL;
snprintf(dname, sizeof(dname), "/sys/module/%s/holders", mod->name);
@@ -2100,7 +2132,7 @@
return NULL;
info->key = (char *)info + sizeof(struct kmod_module_info)
- + valuelen + 1;
+ + valuelen + 1;
memcpy(info->key, key, keylen);
info->key[keylen] = '\0';
memcpy(info->value, value, valuelen);
@@ -2177,6 +2209,7 @@
if (value == NULL) {
keylen = strlen(key);
valuelen = 0;
+ value = key;
} else {
keylen = value - key;
value++;
@@ -2380,7 +2413,7 @@
}
/**
- * kmod_module_versions_get_symbol:
+ * kmod_module_version_get_symbol:
* @entry: a list entry representing a kmod module versions
*
* Get the symbol of a kmod module versions.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/kmod-13/libkmod/libkmod-private.h new/kmod-14/libkmod/libkmod-private.h
--- old/kmod-13/libkmod/libkmod-private.h 2013-04-09 09:05:09.000000000 +0200
+++ new/kmod-14/libkmod/libkmod-private.h 2013-04-30 17:37:43.000000000 +0200
@@ -97,8 +97,8 @@
char *kmod_search_moddep(struct kmod_ctx *ctx, const char *name) __attribute__((nonnull(1,2)));
struct kmod_module *kmod_pool_get_module(struct kmod_ctx *ctx, const char *key) __attribute__((nonnull(1,2)));
-void kmod_pool_add_module(struct kmod_ctx *ctx, struct kmod_module *mod, const char *key) __attribute__((nonnull(1,2, 3)));
-void kmod_pool_del_module(struct kmod_ctx *ctx, struct kmod_module *mod, const char *key) __attribute__((nonnull(1,2, 3)));
+void kmod_pool_add_module(struct kmod_ctx *ctx, struct kmod_module *mod, const char *key) __attribute__((nonnull(1, 2, 3)));
+void kmod_pool_del_module(struct kmod_ctx *ctx, struct kmod_module *mod, const char *key) __attribute__((nonnull(1, 2, 3)));
const struct kmod_config *kmod_get_config(const struct kmod_ctx *ctx) __attribute__((nonnull(1)));
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/kmod-13/libkmod/libkmod.c new/kmod-14/libkmod/libkmod.c
--- old/kmod-13/libkmod/libkmod.c 2013-04-09 09:05:04.000000000 +0200
+++ new/kmod-14/libkmod/libkmod.c 2013-05-04 23:48:37.000000000 +0200
@@ -99,6 +99,7 @@
va_end(args);
}
+_printf_format_(6, 0)
static void log_filep(void *data,
int priority, const char *file, int line,
const char *fn, const char *format, va_list args)
@@ -218,8 +219,8 @@
* kmod_new:
* @dirname: what to consider as linux module's directory, if NULL
* defaults to /lib/modules/`uname -r`. If it's relative,
- * it's treated as relative to current the current working
- * directory. Otherwise, give an absolute dirname.
+ * it's treated as relative to the current working directory.
+ * Otherwise, give an absolute dirname.
* @config_paths: ordered array of paths (directories or files) where
* to load from user-defined configuration parameters such as
* alias, blacklists, commands (install, remove). If
@@ -306,6 +307,8 @@
*
* Drop a reference of the kmod library context. If the refcount
* reaches zero, the resources of the context will be released.
+ *
+ * Returns: the passed kmod library context or NULL if it's freed
*/
KMOD_EXPORT struct kmod_ctx *kmod_unref(struct kmod_ctx *ctx)
{
@@ -853,7 +856,11 @@
/**
* kmod_dump_index:
* @ctx: kmod library context
- * @type: index to dump
+ * @type: index to dump, valid indexes are
+ * KMOD_INDEX_MODULES_DEP: index of module dependencies;
+ * KMOD_INDEX_MODULES_ALIAS: index of module aliases;
+ * KMOD_INDEX_MODULES_SYMBOL: index of symbol aliases;
+ * KMOD_INDEX_MODULES_BUILTIN: index of builtin module.
* @fd: file descriptor to dump index to
*
* Dump index to file descriptor. Note that this function doesn't use stdio.h
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/kmod-13/libkmod/macro.h new/kmod-14/libkmod/macro.h
--- old/kmod-13/libkmod/macro.h 2013-04-09 08:36:53.000000000 +0200
+++ new/kmod-14/libkmod/macro.h 2013-05-02 21:59:37.000000000 +0200
@@ -21,25 +21,16 @@
#include
-#define BUILD_ASSERT(cond) \
- do { (void) sizeof(char [1 - 2*!(cond)]); } while(0)
-
-#define EXPR_BUILD_ASSERT(cond) \
- (sizeof(char [1 - 2*!(cond)]) - 1)
+#define assert_cc(expr) \
+ _Static_assert((expr), #expr)
#if HAVE_TYPEOF
-#define check_type(expr, type) \
- ((typeof(expr) *)0 != (type *)0)
-
#define check_types_match(expr1, expr2) \
((typeof(expr1) *)0 != (typeof(expr2) *)0)
#else
/* Without typeof, we can only test the sizes. */
-#define check_type(expr, type) \
- EXPR_BUILD_ASSERT(sizeof(expr) == sizeof(type))
-
#define check_types_match(expr1, expr2) \
- EXPR_BUILD_ASSERT(sizeof(expr1) == sizeof(expr2))
+ assert_cc(sizeof(expr1) == sizeof(expr2))
#endif /* HAVE_TYPEOF */
#define container_of(member_ptr, containing_type, member) \
@@ -47,26 +38,13 @@
((char *)(member_ptr) - offsetof(containing_type, member)) \
- check_types_match(*(member_ptr), ((containing_type *)0)->member))
-/*
- * BUILD_ASSERT_OR_ZERO - assert a build-time dependency, as an expression.
- * @cond: the compile-time condition which must be true.
- *
- * Your compile will fail if the condition isn't true, or can't be evaluated
- * by the compiler. This can be used in an expression: its value is "0".
- *
- * Example:
- * #define foo_to_char(foo) \
- * ((char *)(foo) \
- * + BUILD_ASSERT_OR_ZERO(offsetof(struct foo, string) == 0))
- */
-#define BUILD_ASSERT_OR_ZERO(cond) \
- (sizeof(char [1 - 2*!(cond)]) - 1)
/* Two gcc extensions.
* &a[0] degrades to a pointer: a different type from an array */
-#define _array_size_chk(arr) \
- BUILD_ASSERT_OR_ZERO(!__builtin_types_compatible_p(typeof(arr), \
- typeof(&(arr)[0])))
+#define _array_size_chk(arr) ({ \
+ assert_cc(!__builtin_types_compatible_p(typeof(arr), typeof(&(arr)[0]))); \
+ 0; \
+ })
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + _array_size_chk(arr))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/kmod-13/libkmod/missing.h new/kmod-14/libkmod/missing.h
--- old/kmod-13/libkmod/missing.h 2013-04-09 09:36:25.000000000 +0200
+++ new/kmod-14/libkmod/missing.h 2013-05-11 05:53:50.000000000 +0200
@@ -20,8 +20,15 @@
#endif
#ifndef HAVE_FINIT_MODULE
+#include
+
static inline int finit_module(int fd, const char *uargs, int flags)
{
+ if (__NR_finit_module == -1) {
+ errno = ENOSYS;
+ return -1;
+ }
+
return syscall(__NR_finit_module, fd, uargs, flags);
}
#endif
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/kmod-13/m4/gtk-doc.m4 new/kmod-14/m4/gtk-doc.m4
--- old/kmod-13/m4/gtk-doc.m4 2011-09-18 12:47:37.000000000 +0200
+++ new/kmod-14/m4/gtk-doc.m4 2013-06-05 23:26:37.000000000 +0200
@@ -37,7 +37,7 @@
dnl don't check for glib if we build glib
if test "x$PACKAGE_NAME" != "xglib"; then
dnl don't fail if someone does not have glib
- PKG_CHECK_MODULES(GTKDOC_DEPS, glib-2.0 >= 2.10.0 gobject-2.0 >= 2.10.0,,)
+ PKG_CHECK_MODULES(GTKDOC_DEPS, glib-2.0 >= 2.10.0 gobject-2.0 >= 2.10.0,,[:])
fi
fi
@@ -58,6 +58,10 @@
enable_gtk_doc_pdf=no
fi
+ if test -z "$AM_DEFAULT_VERBOSITY"; then
+ AM_DEFAULT_VERBOSITY=1
+ fi
+ AC_SUBST([AM_DEFAULT_VERBOSITY])
AM_CONDITIONAL([ENABLE_GTK_DOC], [test x$enable_gtk_doc = xyes])
AM_CONDITIONAL([GTK_DOC_BUILD_HTML], [test x$enable_gtk_doc_html = xyes])
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/kmod-13/man/Makefile.am new/kmod-14/man/Makefile.am
--- old/kmod-13/man/Makefile.am 2012-04-15 23:10:10.000000000 +0200
+++ new/kmod-14/man/Makefile.am 2013-04-24 22:03:05.000000000 +0200
@@ -2,6 +2,10 @@
MAN8 = depmod.8 insmod.8 lsmod.8 rmmod.8 modprobe.8 modinfo.8
MAN_STUB = modules.dep.bin.5
+AM_V_XSLT = $(AM_V_XSLT_$(V))
+AM_V_XSLT_ = $(AM_V_XSLT_$(AM_DEFAULT_VERBOSITY))
+AM_V_XSLT_0 = @echo " XSLT " $@;
+
if BUILD_TOOLS
dist_man_MANS = $(MAN5) $(MAN8) $(MAN_STUB)
modules.dep.bin.5: modules.dep.5
@@ -17,5 +21,5 @@
CLEANFILES = $(dist_man_MANS)
%.5 %.8: %.xml
- $(AM_V_GEN)$(XSLTPROC) $(XSLTPROC_FLAGS) \
+ $(AM_V_XSLT)$(XSLTPROC) $(XSLTPROC_FLAGS) \
http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $<
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/kmod-13/man/depmod.8 new/kmod-14/man/depmod.8
--- old/kmod-13/man/depmod.8 2013-04-09 09:32:47.000000000 +0200
+++ new/kmod-14/man/depmod.8 2013-07-03 02:15:35.000000000 +0200
@@ -1,13 +1,13 @@
'\" t
.\" Title: depmod
.\" Author: Jon Masters
-.\" Generator: DocBook XSL Stylesheets v1.78.0 http://docbook.sf.net/
-.\" Date: 04/09/2013
+.\" Generator: DocBook XSL Stylesheets v1.78.1 http://docbook.sf.net/
+.\" Date: 07/02/2013
.\" Manual: depmod
.\" Source: kmod
.\" Language: English
.\"
-.TH "DEPMOD" "8" "04/09/2013" "kmod" "depmod"
+.TH "DEPMOD" "8" "07/02/2013" "kmod" "depmod"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
@@ -38,7 +38,6 @@
.PP
Linux kernel modules can provide services (called "symbols") for other modules to use (using one of the EXPORT_SYMBOL variants in the code)\&. If a second module uses this symbol, that second module clearly depends on the first module\&. These dependencies can get quite complex\&.
.PP
-
\fBdepmod\fR
creates a list of module dependencies by reading each module under
/lib/modules/\fIversion\fR
@@ -153,7 +152,6 @@
This manual page originally Copyright 2002, Rusty Russell, IBM Corporation\&. Portions Copyright Jon Masters, and others\&.
.SH "SEE ALSO"
.PP
-
\fBdepmod.d\fR(5),
\fBmodprobe\fR(8),
\fBmodules.dep\fR(5)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/kmod-13/man/depmod.d.5 new/kmod-14/man/depmod.d.5
--- old/kmod-13/man/depmod.d.5 2013-04-09 09:32:47.000000000 +0200
+++ new/kmod-14/man/depmod.d.5 2013-07-03 02:15:35.000000000 +0200
@@ -1,13 +1,13 @@
'\" t
.\" Title: depmod.d
.\" Author: Jon Masters
-.\" Generator: DocBook XSL Stylesheets v1.78.0 http://docbook.sf.net/
-.\" Date: 04/09/2013
+.\" Generator: DocBook XSL Stylesheets v1.78.1 http://docbook.sf.net/
+.\" Date: 07/02/2013
.\" Manual: depmod.d
.\" Source: kmod
.\" Language: English
.\"
-.TH "DEPMOD\&.D" "5" "04/09/2013" "kmod" "depmod.d"
+.TH "DEPMOD\&.D" "5" "07/02/2013" "kmod" "depmod.d"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
@@ -78,7 +78,6 @@
This manual page Copyright 2006\-2010, Jon Masters, Red Hat, Inc\&.
.SH "SEE ALSO"
.PP
-
\fBdepmod\fR(8)
.SH "AUTHORS"
.PP
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/kmod-13/man/insmod.8 new/kmod-14/man/insmod.8
--- old/kmod-13/man/insmod.8 2013-04-09 09:32:48.000000000 +0200
+++ new/kmod-14/man/insmod.8 2013-07-03 02:15:35.000000000 +0200
@@ -1,13 +1,13 @@
'\" t
.\" Title: insmod
.\" Author: Jon Masters
-.\" Generator: DocBook XSL Stylesheets v1.78.0 http://docbook.sf.net/
-.\" Date: 04/09/2013
+.\" Generator: DocBook XSL Stylesheets v1.78.1 http://docbook.sf.net/
+.\" Date: 07/02/2013
.\" Manual: insmod
.\" Source: kmod
.\" Language: English
.\"
-.TH "INSMOD" "8" "04/09/2013" "kmod" "insmod"
+.TH "INSMOD" "8" "07/02/2013" "kmod" "insmod"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
@@ -34,7 +34,6 @@
\fBinsmod\fR [\fIfilename\fR] [\fImodule\ options\fR...]
.SH "DESCRIPTION"
.PP
-
\fBinsmod\fR
is a trivial program to insert a module into the kernel\&. Most users will want to use
\fBmodprobe\fR(8)
@@ -48,11 +47,9 @@
This manual page originally Copyright 2002, Rusty Russell, IBM Corporation\&. Maintained by Jon Masters and others\&.
.SH "SEE ALSO"
.PP
-
\fBmodprobe\fR(8),
\fBrmmod\fR(8),
-\fBlsmod\fR(8)
-\fBmodinfo\fR(8)
+\fBlsmod\fR(8)\fBmodinfo\fR(8)
.SH "AUTHORS"
.PP
\fBJon Masters\fR <\&jcm@jonmasters\&.org\&>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/kmod-13/man/lsmod.8 new/kmod-14/man/lsmod.8
--- old/kmod-13/man/lsmod.8 2013-04-09 09:32:48.000000000 +0200
+++ new/kmod-14/man/lsmod.8 2013-07-03 02:15:35.000000000 +0200
@@ -1,13 +1,13 @@
'\" t
.\" Title: lsmod
.\" Author: Jon Masters
-.\" Generator: DocBook XSL Stylesheets v1.78.0 http://docbook.sf.net/
-.\" Date: 04/09/2013
+.\" Generator: DocBook XSL Stylesheets v1.78.1 http://docbook.sf.net/
+.\" Date: 07/02/2013
.\" Manual: lsmod
.\" Source: kmod
.\" Language: English
.\"
-.TH "LSMOD" "8" "04/09/2013" "kmod" "lsmod"
+.TH "LSMOD" "8" "07/02/2013" "kmod" "lsmod"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
@@ -34,7 +34,6 @@
\fBlsmod\fR
.SH "DESCRIPTION"
.PP
-
\fBlsmod\fR
is a trivial program which nicely formats the contents of the
/proc/modules, showing what kernel modules are currently loaded\&.
@@ -43,7 +42,6 @@
This manual page originally Copyright 2002, Rusty Russell, IBM Corporation\&. Maintained by Jon Masters and others\&.
.SH "SEE ALSO"
.PP
-
\fBinsmod\fR(8),
\fBmodprobe\fR(8),
\fBmodinfo\fR(8)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/kmod-13/man/modinfo.8 new/kmod-14/man/modinfo.8
--- old/kmod-13/man/modinfo.8 2013-04-09 09:32:48.000000000 +0200
+++ new/kmod-14/man/modinfo.8 2013-07-03 02:15:35.000000000 +0200
@@ -1,13 +1,13 @@
'\" t
.\" Title: modinfo
.\" Author: Jon Masters
-.\" Generator: DocBook XSL Stylesheets v1.78.0 http://docbook.sf.net/
-.\" Date: 04/09/2013
+.\" Generator: DocBook XSL Stylesheets v1.78.1 http://docbook.sf.net/
+.\" Date: 07/02/2013
.\" Manual: modinfo
.\" Source: kmod
.\" Language: English
.\"
-.TH "MODINFO" "8" "04/09/2013" "kmod" "modinfo"
+.TH "MODINFO" "8" "07/02/2013" "kmod" "modinfo"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
@@ -38,7 +38,6 @@
\fBmodinfo \-h\fR
.SH "DESCRIPTION"
.PP
-
\fBmodinfo\fR
extracts information from the Linux Kernel modules given on the command line\&. If the module name is not a filename, then the
/lib/modules/\fIversion\fR
@@ -46,7 +45,6 @@
\fBmodprobe\fR(8)
when loading kernel modules\&.
.PP
-
\fBmodinfo\fR
by default lists each attribute of the module in form
\fIfieldname\fR
@@ -117,7 +115,6 @@
This manual page originally Copyright 2003, Rusty Russell, IBM Corporation\&. Maintained by Jon Masters and others\&.
.SH "SEE ALSO"
.PP
-
\fBmodprobe\fR(8)
.SH "AUTHORS"
.PP
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/kmod-13/man/modprobe.8 new/kmod-14/man/modprobe.8
--- old/kmod-13/man/modprobe.8 2013-04-09 09:32:48.000000000 +0200
+++ new/kmod-14/man/modprobe.8 2013-07-03 02:15:35.000000000 +0200
@@ -1,13 +1,13 @@
'\" t
.\" Title: modprobe
.\" Author: Jon Masters
-.\" Generator: DocBook XSL Stylesheets v1.78.0 http://docbook.sf.net/
-.\" Date: 04/09/2013
+.\" Generator: DocBook XSL Stylesheets v1.78.1 http://docbook.sf.net/
+.\" Date: 07/02/2013
.\" Manual: modprobe
.\" Source: kmod
.\" Language: English
.\"
-.TH "MODPROBE" "8" "04/09/2013" "kmod" "modprobe"
+.TH "MODPROBE" "8" "07/02/2013" "kmod" "modprobe"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
@@ -40,7 +40,6 @@
\fBmodprobe\fR [\-\-dump\-modversions] [\fIfilename\fR]
.SH "DESCRIPTION"
.PP
-
\fBmodprobe\fR
intelligently adds or removes a module from the Linux kernel: note that for convenience, there is no difference between _ and \- in module names (automatic underscore conversion is performed)\&.
\fBmodprobe\fR
@@ -58,7 +57,6 @@
does not do anything to the module itself: the work of resolving symbols and understanding parameters is done inside the kernel\&. So module failure is sometimes accompanied by a kernel message: see
\fBdmesg\fR(8)\&.
.PP
-
\fBmodprobe\fR
expects an up\-to\-date
modules\&.dep\&.bin
@@ -266,7 +264,6 @@
This manual page originally Copyright 2002, Rusty Russell, IBM Corporation\&. Maintained by Jon Masters and others\&.
.SH "SEE ALSO"
.PP
-
\fBmodprobe.d\fR(5),
\fBinsmod\fR(8),
\fBrmmod\fR(8),
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/kmod-13/man/modprobe.d.5 new/kmod-14/man/modprobe.d.5
--- old/kmod-13/man/modprobe.d.5 2013-04-09 09:32:47.000000000 +0200
+++ new/kmod-14/man/modprobe.d.5 2013-07-03 02:15:35.000000000 +0200
@@ -1,13 +1,13 @@
'\" t
.\" Title: modprobe.d
.\" Author: Jon Masters
-.\" Generator: DocBook XSL Stylesheets v1.78.0 http://docbook.sf.net/
-.\" Date: 04/09/2013
+.\" Generator: DocBook XSL Stylesheets v1.78.1 http://docbook.sf.net/
+.\" Date: 07/02/2013
.\" Manual: modprobe.d
.\" Source: kmod
.\" Language: English
.\"
-.TH "MODPROBE\&.D" "5" "04/09/2013" "kmod" "modprobe.d"
+.TH "MODPROBE\&.D" "5" "07/02/2013" "kmod" "modprobe.d"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
@@ -101,8 +101,7 @@
This command allows you to add options to the module
\fImodulename\fR
(which might be an alias) every time it is inserted into the kernel: whether directly (using
-\fBmodprobe\fR
-\fImodulename\fR
+\fBmodprobe\fR\fImodulename\fR
or because the module being inserted depends on this module\&.
.sp
All options are added together: they can come from an
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/kmod-13/man/modules.dep.5 new/kmod-14/man/modules.dep.5
--- old/kmod-13/man/modules.dep.5 2013-04-09 09:32:47.000000000 +0200
+++ new/kmod-14/man/modules.dep.5 2013-07-03 02:15:35.000000000 +0200
@@ -1,13 +1,13 @@
'\" t
.\" Title: modules.dep
.\" Author: Jon Masters
-.\" Generator: DocBook XSL Stylesheets v1.78.0 http://docbook.sf.net/
-.\" Date: 04/09/2013
+.\" Generator: DocBook XSL Stylesheets v1.78.1 http://docbook.sf.net/
+.\" Date: 07/02/2013
.\" Manual: modules.dep
.\" Source: kmod
.\" Language: English
.\"
-.TH "MODULES\&.DEP" "5" "04/09/2013" "kmod" "modules.dep"
+.TH "MODULES\&.DEP" "5" "07/02/2013" "kmod" "modules.dep"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
@@ -56,7 +56,6 @@
This manual page originally Copyright 2002, Rusty Russell, IBM Corporation\&. Maintained by Jon Masters and others\&.
.SH "SEE ALSO"
.PP
-
\fBdepmod\fR(8),
\fBmodprobe\fR(8)
.SH "AUTHORS"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/kmod-13/man/rmmod.8 new/kmod-14/man/rmmod.8
--- old/kmod-13/man/rmmod.8 2013-04-09 09:32:48.000000000 +0200
+++ new/kmod-14/man/rmmod.8 2013-07-03 02:15:35.000000000 +0200
@@ -1,13 +1,13 @@
'\" t
.\" Title: rmmod
.\" Author: Jon Masters
-.\" Generator: DocBook XSL Stylesheets v1.78.0 http://docbook.sf.net/
-.\" Date: 04/09/2013
+.\" Generator: DocBook XSL Stylesheets v1.78.1 http://docbook.sf.net/
+.\" Date: 07/02/2013
.\" Manual: rmmod
.\" Source: kmod
.\" Language: English
.\"
-.TH "RMMOD" "8" "04/09/2013" "kmod" "rmmod"
+.TH "RMMOD" "8" "07/02/2013" "kmod" "rmmod"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
@@ -34,7 +34,6 @@
\fBrmmod\fR [\fB\-f\fR] [\fB\-w\fR] [\fB\-s\fR] [\fB\-v\fR] [\fImodulename\fR]
.SH "DESCRIPTION"
.PP
-
\fBrmmod\fR
is a trivial program to remove a module (when module unloading support is provided) from the kernel\&. Most users will want to use
\fBmodprobe\fR(8)
@@ -80,11 +79,9 @@
This manual page originally Copyright 2002, Rusty Russell, IBM Corporation\&. Maintained by Jon Masters and others\&.
.SH "SEE ALSO"
.PP
-
\fBmodprobe\fR(8),
\fBinsmod\fR(8),
-\fBlsmod\fR(8)
-\fBmodinfo\fR(8)
+\fBlsmod\fR(8)\fBmodinfo\fR(8)
.SH "AUTHORS"
.PP
\fBJon Masters\fR <\&jcm@jonmasters\&.org\&>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/kmod-13/testsuite/test-depmod.c new/kmod-14/testsuite/test-depmod.c
--- old/kmod-13/testsuite/test-depmod.c 2013-04-09 08:36:54.000000000 +0200
+++ new/kmod-14/testsuite/test-depmod.c 2013-07-03 02:13:51.000000000 +0200
@@ -31,7 +31,7 @@
#define MODULES_ORDER_LIB_MODULES MODULES_ORDER_ROOTFS "/lib/modules/" MODULES_ORDER_UNAME
static __noreturn int depmod_modules_order_for_compressed(const struct test *t)
{
- const char *progname = ABS_TOP_BUILDDIR "/tools/depmod";
+ const char *progname = ABS_TOP_BUILDDIR "/tools/test/depmod";
const char *const args[] = {
progname,
NULL,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/kmod-13/testsuite/test-modinfo.c new/kmod-14/testsuite/test-modinfo.c
--- old/kmod-13/testsuite/test-modinfo.c 2013-04-09 08:36:54.000000000 +0200
+++ new/kmod-14/testsuite/test-modinfo.c 2013-07-03 02:14:37.000000000 +0200
@@ -28,7 +28,7 @@
static __noreturn int modinfo_jonsmodules(const struct test *t)
{
- const char *progname = ABS_TOP_BUILDDIR "/tools/modinfo";
+ const char *progname = ABS_TOP_BUILDDIR "/tools/test/modinfo";
const char *const args[] = {
progname,
"/ext4-i686.ko", "/ext4-ppc64.ko", "/ext4-s390x.ko",
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/kmod-13/testsuite/test-modprobe.c new/kmod-14/testsuite/test-modprobe.c
--- old/kmod-13/testsuite/test-modprobe.c 2013-04-09 09:05:04.000000000 +0200
+++ new/kmod-14/testsuite/test-modprobe.c 2013-07-03 02:14:47.000000000 +0200
@@ -28,7 +28,7 @@
static __noreturn int modprobe_show_depends(const struct test *t)
{
- const char *progname = ABS_TOP_BUILDDIR "/tools/modprobe";
+ const char *progname = ABS_TOP_BUILDDIR "/tools/test/modprobe";
const char *const args[] = {
progname,
"--show-depends", "btusb",
@@ -50,7 +50,7 @@
static __noreturn int modprobe_show_depends2(const struct test *t)
{
- const char *progname = ABS_TOP_BUILDDIR "/tools/modprobe";
+ const char *progname = ABS_TOP_BUILDDIR "/tools/test/modprobe";
const char *const args[] = {
progname,
"--show-depends", "psmouse",
@@ -73,7 +73,7 @@
static __noreturn int modprobe_show_alias_to_none(const struct test *t)
{
- const char *progname = ABS_TOP_BUILDDIR "/tools/modprobe";
+ const char *progname = ABS_TOP_BUILDDIR "/tools/test/modprobe";
const char *const args[] = {
progname,
"--show-depends", "--ignore-install", "--quiet", "psmouse",
@@ -96,7 +96,7 @@
static __noreturn int modprobe_builtin(const struct test *t)
{
- const char *progname = ABS_TOP_BUILDDIR "/tools/modprobe";
+ const char *progname = ABS_TOP_BUILDDIR "/tools/test/modprobe";
const char *const args[] = {
progname,
"unix",
@@ -115,7 +115,7 @@
static __noreturn int modprobe_softdep_loop(const struct test *t)
{
- const char *progname = ABS_TOP_BUILDDIR "/tools/modprobe";
+ const char *progname = ABS_TOP_BUILDDIR "/tools/test/modprobe";
const char *const args[] = {
progname,
"bluetooth",
@@ -135,7 +135,7 @@
static __noreturn int modprobe_install_cmd_loop(const struct test *t)
{
- const char *progname = ABS_TOP_BUILDDIR "/tools/modprobe";
+ const char *progname = ABS_TOP_BUILDDIR "/tools/test/modprobe";
const char *const args[] = {
progname,
"snd-pcm",
@@ -153,7 +153,7 @@
[TC_INIT_MODULE_RETCODES] = "",
},
.env_vars = (const struct keyval[]) {
- { "MODPROBE", ABS_TOP_BUILDDIR "/tools/modprobe" },
+ { "MODPROBE", ABS_TOP_BUILDDIR "/tools/test/modprobe" },
{ }
},
);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/kmod-13/testsuite/testsuite.c new/kmod-14/testsuite/testsuite.c
--- old/kmod-13/testsuite/testsuite.c 2013-04-09 09:05:04.000000000 +0200
+++ new/kmod-14/testsuite/testsuite.c 2013-04-24 22:02:37.000000000 +0200
@@ -440,7 +440,7 @@
while (1) {
r = read(fd, buf, count);
- if (r == -1 && errno == -EINTR)
+ if (r == -1 && errno == EINTR)
continue;
break;
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/kmod-13/tools/depmod.c new/kmod-14/tools/depmod.c
--- old/kmod-13/tools/depmod.c 2013-04-09 08:36:54.000000000 +0200
+++ new/kmod-14/tools/depmod.c 2013-04-24 22:02:51.000000000 +0200
@@ -101,6 +101,7 @@
program_invocation_short_name);
}
+_printf_format_(1, 2)
static inline void _show(const char *fmt, ...)
{
va_list args;
@@ -1256,7 +1257,7 @@
namelen = strlen(name);
if (baselen + namelen + 2 >= PATH_MAX) {
path[baselen] = '\0';
- ERR("path is too long %s%s %zd\n", path, name);
+ ERR("path is too long %s%s\n", path, name);
continue;
}
memcpy(path + baselen, name, namelen + 1);
@@ -1504,7 +1505,7 @@
mod->kmod = NULL;
}
- DBG("loaded symbols (%zd modules, %zd symbols)\n",
+ DBG("loaded symbols (%zd modules, %u symbols)\n",
depmod->modules.count, hash_get_count(depmod->symbols));
return 0;
@@ -1550,7 +1551,7 @@
{
struct mod **itr, **itr_end;
- DBG("load dependencies (%zd modules, %zd symbols)\n",
+ DBG("load dependencies (%zd modules, %u symbols)\n",
depmod->modules.count, hash_get_count(depmod->symbols));
itr = (struct mod **)depmod->modules.array;
@@ -1566,7 +1567,7 @@
depmod_load_module_dependencies(depmod, mod);
}
- DBG("loaded dependencies (%zd modules, %zd symbols)\n",
+ DBG("loaded dependencies (%zd modules, %u symbols)\n",
depmod->modules.count, hash_get_count(depmod->symbols));
return 0;
@@ -1609,7 +1610,7 @@
roots = users + n_mods;
sorted = roots + n_mods;
- DBG("calculate dependencies and ordering (%zd modules)\n", n_mods);
+ DBG("calculate dependencies and ordering (%hu modules)\n", n_mods);
assert(depmod->modules.count < UINT16_MAX);
@@ -1650,7 +1651,7 @@
}
if (n_sorted < n_mods) {
- WRN("found %hu modules in dependency cycles!\n",
+ WRN("found %u modules in dependency cycles!\n",
n_mods - n_sorted);
for (i = 0; i < n_mods; i++) {
struct mod *m;
@@ -1666,7 +1667,7 @@
depmod_sort_dependencies(depmod);
- DBG("calculated dependencies and ordering (%u loops, %zd modules)\n",
+ DBG("calculated dependencies and ordering (%u loops, %hu modules)\n",
depmod->dep_loops, n_mods);
free(users);
@@ -2356,7 +2357,7 @@
namelen = strlen(name);
if (baselen + namelen + 2 >= PATH_MAX) {
path[baselen] = '\0';
- ERR("path is too long %s%s %zd\n", path, name);
+ ERR("path is too long %s%s\n", path, name);
continue;
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/kmod-13/tools/kmod.c new/kmod-14/tools/kmod.c
--- old/kmod-13/tools/kmod.c 2013-04-09 08:36:54.000000000 +0200
+++ new/kmod-14/tools/kmod.c 2013-04-24 22:02:50.000000000 +0200
@@ -37,6 +37,7 @@
static const struct kmod_cmd *kmod_cmds[] = {
&kmod_cmd_help,
&kmod_cmd_list,
+ &kmod_cmd_static_nodes,
};
static const struct kmod_cmd *kmod_compat_cmds[] = {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/kmod-13/tools/kmod.h new/kmod-14/tools/kmod.h
--- old/kmod-13/tools/kmod.h 2013-04-09 08:36:54.000000000 +0200
+++ new/kmod-14/tools/kmod.h 2013-04-24 22:02:50.000000000 +0200
@@ -35,5 +35,6 @@
extern const struct kmod_cmd kmod_cmd_compat_depmod;
extern const struct kmod_cmd kmod_cmd_list;
+extern const struct kmod_cmd kmod_cmd_static_nodes;
#include "log.h"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/kmod-13/tools/log.c new/kmod-14/tools/log.c
--- old/kmod-13/tools/log.c 2013-04-09 08:36:54.000000000 +0200
+++ new/kmod-14/tools/log.c 2013-04-24 22:02:50.000000000 +0200
@@ -60,6 +60,7 @@
return prioname;
}
+_printf_format_(6, 0)
static void log_kmod(void *data, int priority, const char *file, int line,
const char *fn, const char *format, va_list args)
{
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/kmod-13/tools/log.h new/kmod-14/tools/log.h
--- old/kmod-13/tools/log.h 2013-04-09 08:36:54.000000000 +0200
+++ new/kmod-14/tools/log.h 2013-04-24 22:02:50.000000000 +0200
@@ -26,7 +26,7 @@
void log_open(bool use_syslog);
void log_close(void);
-void log_printf(int prio, const char *fmt, ...);
+void log_printf(int prio, const char *fmt, ...) _printf_format_(2, 3);
#define CRIT(...) log_printf(LOG_CRIT, __VA_ARGS__)
#define ERR(...) log_printf(LOG_ERR, __VA_ARGS__)
#define WRN(...) log_printf(LOG_WARNING, __VA_ARGS__)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/kmod-13/tools/modprobe.c new/kmod-14/tools/modprobe.c
--- old/kmod-13/tools/modprobe.c 2013-04-09 09:05:04.000000000 +0200
+++ new/kmod-14/tools/modprobe.c 2013-06-28 16:58:16.000000000 +0200
@@ -142,6 +142,7 @@
program_invocation_short_name, program_invocation_short_name);
}
+_printf_format_(1, 2)
static inline void _show(const char *fmt, ...)
{
va_list args;
@@ -385,7 +386,7 @@
goto error;
}
- if (!ignore_loaded) {
+ if (!ignore_loaded && !cmd) {
int usage = kmod_module_get_refcnt(mod);
if (usage > 0) {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/kmod-13/tools/static-nodes.c new/kmod-14/tools/static-nodes.c
--- old/kmod-13/tools/static-nodes.c 1970-01-01 01:00:00.000000000 +0100
+++ new/kmod-14/tools/static-nodes.c 2013-07-02 04:02:03.000000000 +0200
@@ -0,0 +1,263 @@
+/*
+ * kmod-static-nodes - manage modules.devname
+ *
+ * Copyright (C) 2004-2012 Kay Sievers
+ * Copyright (C) 2011-2013 ProFUSION embedded systems
+ * Copyright (C) 2013 Tom Gundersen
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see http://www.gnu.org/licenses/.
+ */
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include "libkmod-util.h"
+
+#include "kmod.h"
+
+struct static_nodes_format {
+ const char *name;
+ int (*write)(FILE *, char[], char[], char, unsigned int, unsigned int);
+ const char *description;
+};
+
+static const struct static_nodes_format static_nodes_format_human;
+static const struct static_nodes_format static_nodes_format_tmpfiles;
+static const struct static_nodes_format static_nodes_format_devname;
+
+static const struct static_nodes_format *static_nodes_formats[] = {
+ &static_nodes_format_human,
+ &static_nodes_format_tmpfiles,
+ &static_nodes_format_devname,
+};
+
+static const char cmdopts_s[] = "o:f:h";
+static const struct option cmdopts[] = {
+ { "output", required_argument, 0, 'o'},
+ { "format", required_argument, 0, 'f'},
+ { "help", no_argument, 0, 'h'},
+ { },
+};
+
+static int write_human(FILE *out, char modname[], char devname[], char type, unsigned int maj, unsigned int min)
+{
+ int ret;
+
+ ret = fprintf(out,
+ "Module: %s\n"
+ "\tDevice node: /dev/%s\n"
+ "\t\tType: %s device\n"
+ "\t\tMajor: %u\n"
+ "\t\tMinor: %u\n",
+ modname, devname,
+ (type == 'c') ? "character" : "block", maj, min);
+ if (ret >= 0)
+ return EXIT_SUCCESS;
+ else
+ return EXIT_FAILURE;
+}
+
+static const struct static_nodes_format static_nodes_format_human = {
+ .name = "human",
+ .write = write_human,
+ .description = "(default) a human readable format. Do not parse.",
+};
+
+static int write_tmpfiles(FILE *out, char modname[], char devname[], char type, unsigned int maj, unsigned int min)
+{
+ const char *dir;
+ int ret;
+
+ dir = strrchr(devname, '/');
+ if (dir) {
+ ret = fprintf(out, "d /dev/%.*s 0755 - - -\n",
+ (int)(dir - devname), devname);
+ if (ret < 0)
+ return EXIT_FAILURE;
+ }
+
+ ret = fprintf(out, "%c /dev/%s 0600 - - - %u:%u\n",
+ type, devname, maj, min);
+ if (ret < 0)
+ return EXIT_FAILURE;
+
+ return EXIT_SUCCESS;
+}
+
+static const struct static_nodes_format static_nodes_format_tmpfiles = {
+ .name = "tmpfiles",
+ .write = write_tmpfiles,
+ .description = "the tmpfiles.d(5) format used by systemd-tmpfiles.",
+};
+
+static int write_devname(FILE *out, char modname[], char devname[], char type, unsigned int maj, unsigned int min)
+{
+ int ret;
+
+ ret = fprintf(out, "%s %s %c%u:%u\n", modname, devname, type, maj, min);
+ if (ret >= 0)
+ return EXIT_SUCCESS;
+ else
+ return EXIT_FAILURE;
+}
+
+static const struct static_nodes_format static_nodes_format_devname = {
+ .name = "devname",
+ .write = write_devname,
+ .description = "the modules.devname format.",
+};
+
+static void help(void)
+{
+ size_t i;
+
+ printf("Usage:\n"
+ "\t%s static-nodes [options]\n"
+ "\n"
+ "kmod static-nodes outputs the static-node information of the currently running kernel.\n"
+ "\n"
+ "Options:\n"
+ "\t-f, --format=FORMAT choose format to use: see \"Formats\"\n"
+ "\t-o, --output=FILE write output to file\n"
+ "\t-h, --help show this help\n"
+ "\n"
+ "Formats:\n",
+ program_invocation_short_name);
+
+ for (i = 0; i < ARRAY_SIZE(static_nodes_formats); i++) {
+ if (static_nodes_formats[i]->description != NULL) {
+ printf("\t%-12s %s\n", static_nodes_formats[i]->name,
+ static_nodes_formats[i]->description);
+ }
+ }
+}
+
+static int do_static_nodes(int argc, char *argv[])
+{
+ struct utsname kernel;
+ char modules[PATH_MAX];
+ FILE *in = NULL, *out = stdout;
+ const struct static_nodes_format *format = &static_nodes_format_human;
+ char buf[4096];
+ int ret = EXIT_SUCCESS;
+
+ for (;;) {
+ int c, idx = 0, valid;
+ size_t i;
+
+ c = getopt_long(argc, argv, cmdopts_s, cmdopts, &idx);
+ if (c == -1) {
+ break;
+ }
+ switch (c) {
+ case 'o':
+ out = fopen(optarg, "we");
+ if (out == NULL) {
+ fprintf(stderr, "Error: could not create %s!\n",
+ optarg);
+ ret = EXIT_FAILURE;
+ goto finish;
+ }
+ break;
+ case 'f':
+ valid = 0;
+
+ for (i = 0; i < ARRAY_SIZE(static_nodes_formats); i++) {
+ if (streq(static_nodes_formats[i]->name, optarg)) {
+ format = static_nodes_formats[i];
+ valid = 1;
+ }
+ }
+
+ if (!valid) {
+ fprintf(stderr, "Unknown format: '%s'.\n",
+ optarg);
+ help();
+ ret = EXIT_FAILURE;
+ goto finish;
+ }
+ break;
+ case 'h':
+ help();
+ goto finish;
+ case '?':
+ ret = EXIT_FAILURE;
+ goto finish;
+ default:
+ fprintf(stderr, "Unexpected commandline option '%c'.\n",
+ c);
+ help();
+ ret = EXIT_FAILURE;
+ goto finish;
+ }
+ }
+
+ if (uname(&kernel) < 0) {
+ fputs("Error: uname failed!\n", stderr);
+ ret = EXIT_FAILURE;
+ goto finish;
+ }
+
+ snprintf(modules, sizeof(modules), "/lib/modules/%s/modules.devname",
+ kernel.release);
+ in = fopen(modules, "re");
+ if (in == NULL) {
+ fprintf(stderr, "Error: could not open /lib/modules/%s/modules.devname - %m\n",
+ kernel.release);
+ ret = EXIT_FAILURE;
+ goto finish;
+ }
+
+ while (fgets(buf, sizeof(buf), in) != NULL) {
+ char modname[PATH_MAX];
+ char devname[PATH_MAX];
+ char type;
+ unsigned int maj, min;
+ int matches;
+
+ if (buf[0] == '#')
+ continue;
+
+ matches = sscanf(buf, "%s %s %c%u:%u", modname, devname,
+ &type, &maj, &min);
+ if (matches != 5 || (type != 'c' && type != 'b')) {
+ fprintf(stderr, "Error: invalid devname entry: %s", buf);
+ ret = EXIT_FAILURE;
+ continue;
+ }
+
+ format->write(out, modname, devname, type, maj, min);
+ }
+
+finish:
+ if (in)
+ fclose(in);
+ if (out)
+ fclose(out);
+ return ret;
+}
+
+const struct kmod_cmd kmod_cmd_static_nodes = {
+ .name = "static-nodes",
+ .cmd = do_static_nodes,
+ .help = "outputs the static-node information installed with the currently running kernel",
+};
--
To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-commit+help@opensuse.org