Mike Frysinger | 8 Dec 10:15 2010
Picon

[PATCH] depmod: new --symbol-prefix option

Some ports (like the Blackfin architecture) prefix all their symbols with
an underscore.  So add a new --symbol-prefix option to support this.

In the past, I've always used depmod.pl from busybox, so the limitation
in m-i-t's depmod wasn't a blocker for me.

Signed-off-by: Mike Frysinger <vapier@...>
---
 depmod.c |   28 +++++++++++++++++++++++-----
 1 files changed, 23 insertions(+), 5 deletions(-)

diff --git a/depmod.c b/depmod.c
index 83e7cee..5005a21 100644
--- a/depmod.c
+++ b/depmod.c
 <at>  <at>  -61,6 +61,7  <at>  <at>  struct module_search
 	size_t len;
 };

+static char sym_prefix;
 static unsigned int skipchars;
 static unsigned int make_map_files = 1; /* default to on */
 static unsigned int force_map_files = 0; /* default to on */
 <at>  <at>  -89,6 +90,11  <at>  <at>  static inline unsigned int tdb_hash(const char *name)
 	return (1103515243 * value + 12345);
 }

+static const char *skip_symprefix(const char *symname)
+{
+	return symname + (symname[0] == sym_prefix ? 1 : 0);
(Continue reading)

Mike Frysinger | 8 Dec 10:25 2010
Picon

[PATCH 1/2] depmod/modprobe: localize functions/variables

No reason for these guys to be exported, so mark them all static.

Signed-off-by: Mike Frysinger <vapier@...>
---
 depmod.c   |   14 +++++++-------
 modprobe.c |   12 ++++++------
 2 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/depmod.c b/depmod.c
index 5005a21..34aa67e 100644
--- a/depmod.c
+++ b/depmod.c
 <at>  <at>  -95,7 +95,7  <at>  <at>  static const char *skip_symprefix(const char *symname)
 	return symname + (symname[0] == sym_prefix ? 1 : 0);
 }

-void add_symbol(const char *name, uint64_t ver, struct module *owner)
+static void add_symbol(const char *name, uint64_t ver, struct module *owner)
 {
 	unsigned int hash;
 	struct symbol *new = NOFAIL(malloc(sizeof *new + strlen(name) + 1));
 <at>  <at>  -111,7 +111,7  <at>  <at>  void add_symbol(const char *name, uint64_t ver, struct module *owner)

 static int print_unknown, check_symvers;

-struct module *find_symbol(const char *name, uint64_t ver,
+static struct module *find_symbol(const char *name, uint64_t ver,
 		const char *modname, int weak)
 {
 	struct symbol *s;
(Continue reading)

Mike Frysinger | 8 Dec 10:25 2010
Picon

[PATCH 2/2] m-i-t: constify

Constify a bunch of data structures that need not be writable.

Signed-off-by: Mike Frysinger <vapier@...>
---
 depmod.c      |   10 +++++-----
 elfops.h      |    4 ++--
 elfops_core.c |    2 +-
 modindex.c    |    2 +-
 modinfo.c     |    2 +-
 modprobe.c    |    2 +-
 rmmod.c       |    2 +-
 7 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/depmod.c b/depmod.c
index 34aa67e..52fc241 100644
--- a/depmod.c
+++ b/depmod.c
 <at>  <at>  -222,7 +222,7  <at>  <at>  static void load_module_symvers(const char *filename)
 	add_fake_syms();
 }

-static struct option options[] = { { "all", 0, NULL, 'a' },
+static const struct option options[] = { { "all", 0, NULL, 'a' },
 				   { "quick", 0, NULL, 'A' },
 				   { "basedir", 1, NULL, 'b' },
 				   { "config", 1, NULL, 'C' },
 <at>  <at>  -1030,12 +1030,12  <at>  <at>  static int output_devname(struct module *modules, FILE *out, char *dirname)
 }

 struct depfile {
(Continue reading)

Keegan McAllister | 16 Dec 17:52 2010

[PATCH 0/5] testsuite bugs

I've found a bug in the testsuite, which was silently preventing some tests
from running.  The first commit fixes the bug in tests/runtests, and the rest
fix various bugs in the tests that weren't running.

With these patches applied, all tests pass on my system.  I didn't have to
modify the code under test.

Keegan McAllister (5):
  testsuite: export TEST_ENDIAN and TEST_BITS
  testsuite: mock unlink()
  testsuite: pass -F to depmod when passing -e
  testsuite: remove modprobe module renaming test
  testsuite: check size against the right file

 testing.h                               |   11 ++++
 tests/runtests                          |    2 +
 tests/test-depmod/02simple.sh           |   16 +++--
 tests/test-depmod/04maps.sh             |    8 ++-
 tests/test-depmod/06undefined.sh        |    2 +-
 tests/test-depmod/07complex.sh          |    8 ++-
 tests/test-depmod/08basedir.sh          |   12 ++--
 tests/test-depmod/12compressed.sh       |   16 +++--
 tests/test-depmod/13compressed-maps.sh  |    8 ++-
 tests/test-depmod/14updates.sh          |   16 +++--
 tests/test-depmod/15symlink.sh          |   16 +++--
 tests/test-depmod/16specific-modules.sh |   12 ++--
 tests/test-modprobe/06rename.sh         |  100 -------------------------------
 tests/test-modprobe/17compressed.sh     |    2 +-
 14 files changed, 80 insertions(+), 149 deletions(-)
 delete mode 100755 tests/test-modprobe/06rename.sh
(Continue reading)

Keegan McAllister | 16 Dec 17:52 2010

[PATCH 1/5] testsuite: export TEST_ENDIAN and TEST_BITS

These environment variables were introduced in f2668710 but were not exported
by tests/runtests.  As a result, a lot of tests were silently failing to run.

Signed-off-by: Keegan McAllister <keegan@...>
---
 tests/runtests |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/tests/runtests b/tests/runtests
index e5c8184..f1bf983 100755
--- a/tests/runtests
+++ b/tests/runtests
 <at>  <at>  -101,6 +101,7  <at>  <at>  for e in $TEST_ENDIAN; do
 	esac
 done
 TEST_ENDIAN="$_tmp"
+export TEST_ENDIAN

 : ${TEST_BITS:=32 64}
 for b in $TEST_BITS; do
 <at>  <at>  -112,6 +113,7  <at>  <at>  for b in $TEST_BITS; do
 		exit 1
 	esac
 done
+export TEST_BITS

 for config in --enable-zlib --disable-zlib; do
     echo Building with $config...
--

-- 
1.7.2.3
(Continue reading)

Keegan McAllister | 16 Dec 17:53 2010

[PATCH 2/5] testsuite: mock unlink()

Needed by depmod.

Signed-off-by: Keegan McAllister <keegan@...>
---
 testing.h |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/testing.h b/testing.h
index 1fe234a..9d6090a 100644
--- a/testing.h
+++ b/testing.h
 <at>  <at>  -41,6 +41,8  <at>  <at>  __attribute__((unused));

 static int modtest_readlink(const char *path, char *buf, size_t bufsiz)
 __attribute__((unused));
+static int modtest_unlink(const char *path)
+__attribute__((unused));

 static int modtest_uname(struct utsname *buf)
 {
 <at>  <at>  -215,6 +217,14  <at>  <at>  static int modtest_readlink(const char *path, char *buf, size_t bufsiz)
 	return readlink(path, buf, bufsiz);
 }

+static int modtest_unlink(const char *path)
+{
+	char path_buf[PATH_MAX];
+
+	path = modtest_mapname(path, path_buf, sizeof(path_buf));
+	return unlink(path);
(Continue reading)

Keegan McAllister | 16 Dec 17:53 2010

[PATCH 4/5] testsuite: remove modprobe module renaming test

Support for this feature was removed in 30df3f6e.

Signed-off-by: Keegan McAllister <keegan@...>
---
 tests/test-modprobe/06rename.sh |  100 ---------------------------------------
 1 files changed, 0 insertions(+), 100 deletions(-)
 delete mode 100755 tests/test-modprobe/06rename.sh

diff --git a/tests/test-modprobe/06rename.sh b/tests/test-modprobe/06rename.sh
deleted file mode 100755
index 59b5f13..0000000
--- a/tests/test-modprobe/06rename.sh
+++ /dev/null
 <at>  <at>  -1,100 +0,0  <at>  <at> 
-#! /bin/sh
-# Test the module renaming code.
-
-for ENDIAN in $TEST_ENDIAN; do
-for BITNESS in $TEST_BITS; do
-
-rm -rf tests/tmp/*
-
-# We need to dump the module to make sure the name has changed.
-MODTEST_DUMP_INIT=1
-export MODTEST_DUMP_INIT
-
-# Create inputs
-MODULE_DIR=tests/tmp/lib/modules/$MODTEST_UNAME
-mkdir -p $MODULE_DIR
-ln tests/data/$BITNESS$ENDIAN/rename/rename-new-$BITNESS.ko \
(Continue reading)

Keegan McAllister | 16 Dec 17:53 2010

[PATCH 3/5] testsuite: pass -F to depmod when passing -e

depmod -e without -E or -F will print a warning and have no effect.

Signed-off-by: Keegan McAllister <keegan@...>
---
 tests/test-depmod/02simple.sh           |   16 +++++++++-------
 tests/test-depmod/04maps.sh             |    8 +++++---
 tests/test-depmod/06undefined.sh        |    2 +-
 tests/test-depmod/07complex.sh          |    8 +++++---
 tests/test-depmod/08basedir.sh          |   12 +++++++-----
 tests/test-depmod/12compressed.sh       |   16 +++++++++-------
 tests/test-depmod/13compressed-maps.sh  |    8 +++++---
 tests/test-depmod/14updates.sh          |   16 +++++++++-------
 tests/test-depmod/15symlink.sh          |   16 +++++++++-------
 tests/test-depmod/16specific-modules.sh |   12 +++++++-----
 10 files changed, 66 insertions(+), 48 deletions(-)

diff --git a/tests/test-depmod/02simple.sh b/tests/test-depmod/02simple.sh
index 718e058..e73511b 100755
--- a/tests/test-depmod/02simple.sh
+++ b/tests/test-depmod/02simple.sh
 <at>  <at>  -38,6 +38,8  <at>  <at>  ln tests/data/$BITNESS$ENDIAN/normal/export_dep-$BITNESS.ko \
 mv $MODULE_DIR/modules.dep $MODULE_DIR/modules.dep.old
 mv $MODULE_DIR/modules.symbols $MODULE_DIR/modules.symbols.old

+touch tests/tmp/empty
+
 # Synonyms
 [ "`depmod $MODTEST_UNAME`" = "" ]
 diff -u $MODULE_DIR/modules.dep.old $MODULE_DIR/modules.dep >/dev/null
 <at>  <at>  -69,13 +71,13  <at>  <at>  mv $MODULE_DIR/modules.dep $MODULE_DIR/modules.dep.old
(Continue reading)

Keegan McAllister | 16 Dec 17:53 2010

[PATCH 5/5] testsuite: check size against the right file

Signed-off-by: Keegan McAllister <keegan@...>
---
 tests/test-modprobe/17compressed.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/tests/test-modprobe/17compressed.sh b/tests/test-modprobe/17compressed.sh
index da92036..ee249bf 100755
--- a/tests/test-modprobe/17compressed.sh
+++ b/tests/test-modprobe/17compressed.sh
 <at>  <at>  -20,7 +20,7  <at>  <at>  gzip $MODULE_DIR/noexport_nodep-$BITNESS.ko
 echo "# A comment" > $MODULE_DIR/modules.dep
 echo "/lib/modules/$MODTEST_UNAME/noexport_nodep-$BITNESS.ko.gz:" >> $MODULE_DIR/modules.dep

-SIZE=`wc -c < tests/data/$BITNESS/normal/noexport_nodep-$BITNESS.ko`
+SIZE=`wc -c < tests/data/$BITNESS$ENDIAN/normal/noexport_nodep-$BITNESS.ko`

 # No args
 [ "`modprobe noexport_nodep-$BITNESS 2>&1`" = "INIT_MODULE: $SIZE " ]
--

-- 
1.7.2.3

Keegan McAllister | 19 Dec 09:51 2010

[PATCH 00/14] new modprobe, depmod features for alternative module dirs

This patch series implements several new features for modprobe and depmod.

modprobe gains a 'moduledir' config option, which can be used to override the
default path /lib/modules.

depmod gains the ability to maintain dependency information for several
independent kernel module trees, with a separate config file for each.

Automated tests are included.  The new features are documented in the
respective manpages.

These features will be useful in simplifying the installation and packaging of
Ksplice Uptrack.  They may also be of more general interest.

Feel free to contact me if you have any questions about this patch series.

Keegan McAllister (14):
  modprobe: defer the use of MODULE_DIR
  modprobe: add 'moduledir' config option
  modprobe: ignore broken symlink config files
  tests: test new modprobe features
  depmod: move code using MODULE_DIR out of main()
  depmod: clear the symbol hash for each module tree
  depmod: process a list of config_alternatives
  depmod: factor out reading a config dir
  depmod: read config alternatives from a directory
  depmod: store module_dir without trailing slash
  tests: test depmod 'alternatives' feature
  doc: fix the description of modprobe -d
  doc: document new modprobe features
(Continue reading)


Gmane