From: Daniel Hilst SellI <danielhilst@gmail.com>
To: linux-modules@vger.kernel.org
Cc: Daniel Hilst SellI <danielhilst@gmail.com>
Subject: [PATCH] depmod: New option for m-i-t prior 3.6 compatibility
Date: Mon, 21 Jul 2014 16:33:52 -0300 [thread overview]
Message-ID: <1405971232-1187-1-git-send-email-danielhilst@gmail.com> (raw)
New option (-N, --no-relative) create databases with absolute paths.
This option is made to create databases compatible with
module-init-tools prior 3.6 version.
---
man/depmod.xml | 16 ++++++++++++++++
tools/depmod.c | 21 +++++++++++++++++----
2 files changed, 33 insertions(+), 4 deletions(-)
diff --git a/man/depmod.xml b/man/depmod.xml
index 380ee7d..ddcad32 100644
--- a/man/depmod.xml
+++ b/man/depmod.xml
@@ -49,6 +49,7 @@
<arg><option>-E <replaceable>Module.symvers</replaceable></option></arg>
<arg><option>-F <replaceable>System.map</replaceable></option></arg>
<arg><option>-n</option></arg>
+ <arg><option>-N</option></arg>
<arg><option>-v</option></arg>
<arg><option>-A</option></arg>
<arg><option>-P <replaceable>prefix</replaceable></option></arg>
@@ -63,6 +64,7 @@
<arg><option>-F <replaceable>System.map</replaceable></option></arg>
<arg><option>-m</option></arg>
<arg><option>-n</option></arg>
+ <arg><option>-N</option></arg>
<arg><option>-v</option></arg>
<arg><option>-P <replaceable>prefix</replaceable></option></arg>
<arg><option>-w</option></arg>
@@ -247,6 +249,20 @@
</varlistentry>
<varlistentry>
<term>
+ <option>-N</option>
+ </term>
+ <term>
+ <option>--no-relative</option>
+ </term>
+ <listitem>
+ <para>
+ Don't use relative names on databases. Use this option if
+ your database is being used by module-init-tools prior 3.6.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
<option>-P</option>
</term>
<listitem>
diff --git a/tools/depmod.c b/tools/depmod.c
index e90ff83..137b541 100644
--- a/tools/depmod.c
+++ b/tools/depmod.c
@@ -48,7 +48,7 @@ static const char *default_cfg_paths[] = {
NULL
};
-static const char cmdopts_s[] = "aAb:C:E:F:euqrvnP:wmVh";
+static const char cmdopts_s[] = "aAb:C:E:F:euqrvnNP:wmVh";
static const struct option cmdopts[] = {
{ "all", no_argument, 0, 'a' },
{ "quick", no_argument, 0, 'A' },
@@ -63,6 +63,7 @@ static const struct option cmdopts[] = {
{ "verbose", no_argument, 0, 'v' },
{ "show", no_argument, 0, 'n' },
{ "dry-run", no_argument, 0, 'n' },
+ { "--no-relative", no_argument, 0, 'N' },
{ "symbol-prefix", required_argument, 0, 'P' },
{ "warn", no_argument, 0, 'w' },
{ "map", no_argument, 0, 'm' }, /* deprecated */
@@ -85,6 +86,7 @@ static void help(void)
"\t-A, --quick Only does the work if there's a new module\n"
"\t-e, --errsyms Report not supplied symbols\n"
"\t-n, --show Write the dependency file on stdout only\n"
+ "\t-N, --no-relative Dont use relative paths on databases"
"\t-P, --symbol-prefix Architecture symbol prefix\n"
"\t-C, --config=PATH Read configuration from PATH\n"
"\t-v, --verbose Enable verbose mode\n"
@@ -572,10 +574,12 @@ struct cfg {
const char *kversion;
char dirname[PATH_MAX];
size_t dirnamelen;
+ size_t basedirnamelen;
char sym_prefix;
uint8_t check_symvers;
uint8_t print_unknown;
uint8_t warn_dups;
+ uint8_t no_relative;
struct cfg_override *overrides;
struct cfg_search *searches;
};
@@ -1067,9 +1071,12 @@ static int depmod_module_add(struct depmod *depmod, struct kmod_module *kmod)
lastslash = strrchr(mod->path, '/');
mod->baselen = lastslash - mod->path;
if (strncmp(mod->path, cfg->dirname, cfg->dirnamelen) == 0 &&
- mod->path[cfg->dirnamelen] == '/')
- mod->relpath = mod->path + cfg->dirnamelen + 1;
- else
+ mod->path[cfg->dirnamelen] == '/') {
+ if (cfg->no_relative)
+ mod->relpath = mod->path + cfg->basedirnamelen;
+ else
+ mod->relpath = mod->path + cfg->dirnamelen + 1;
+ } else
mod->relpath = NULL;
err = hash_add_unique(depmod->modules_by_name, mod->modname, mod);
@@ -2565,6 +2572,9 @@ static int do_depmod(int argc, char *argv[])
case 'n':
out = stdout;
break;
+ case 'N':
+ cfg.no_relative = 1;
+ break;
case 'P':
if (optarg[1] != '\0') {
CRIT("-P only takes a single char\n");
@@ -2617,6 +2627,9 @@ static int do_depmod(int argc, char *argv[])
"%s/lib/modules/%s",
root == NULL ? "" : root, cfg.kversion);
+ if (cfg.no_relative && root)
+ cfg.basedirnamelen = strlen(root);
+
if (optind == argc)
all = 1;
--
2.0.2
next reply other threads:[~2014-07-21 19:34 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-21 19:33 Daniel Hilst SellI [this message]
2014-07-22 21:27 ` [PATCH] depmod: New option for m-i-t prior 3.6 compatibility Lucas De Marchi
[not found] <53CFB7FC.5020906@gmail.com>
2014-07-23 13:27 ` Daniel Hilst Selli
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1405971232-1187-1-git-send-email-danielhilst@gmail.com \
--to=danielhilst@gmail.com \
--cc=linux-modules@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.