From: Rusty Russell <rusty@rustcorp.com.au>
To: "Wang, Stanley" <stanley.wang@intel.com>
Cc: "Zhuang, Louis" <louis.zhuang@intel.com>,
"'linux-kernel@vger.kernel.org'" <linux-kernel@vger.kernel.org>,
Kai Germaschewski <kai@tp1.ruhr-uni-bochum.de>
Subject: Re: Kernel module version support.
Date: Sat, 04 Jan 2003 16:06:18 +1100 [thread overview]
Message-ID: <20030104060424.712BE2C39C@lists.samba.org> (raw)
In-Reply-To: Your message of "Fri, 03 Jan 2003 16:36:29 +0800." <957BD1C2BF3CD411B6C500A0C944CA2601F11712@pdsmsx32.pd.intel.com>
In message <957BD1C2BF3CD411B6C500A0C944CA2601F11712@pdsmsx32.pd.intel.com> you
> I agree with you. It's a more elegant way:)
> But we couldn't get the module's base address from /proc/modules.=20
> And could you print "mod->core" in /proc/modules?(Just like the =
> following
> patch)
You need to following patch first: the current /proc/modules is not
extensible, so adding a field breaks things. This changes the
/proc/modules format, and then your patch is as I planned.
Cheers!
Rusty.
--
Anyone who quotes me in their sig is an idiot. -- Rusty Russell.
Name: /proc/modules rework
Author: Rusty Russell
Status: Tested on 2.5.52
D: This changes the dependency list in /proc/modules to be one field,
D: rather than a space-separated set of dependencies, and makes sure
D: the contents are there even if CONFIG_MODULE_UNLOAD is off.
D:
D: This allows us to append fields (eg. the module address for
D: oprofile, and the module status) without breaking userspace.
D: module-init-tools already handles this format (which you can detect
D: by the presence of "-" or "," in the fourth field).
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .17749-linux-2.5-bk/kernel/module.c .17749-linux-2.5-bk.updated/kernel/module.c
--- .17749-linux-2.5-bk/kernel/module.c 2003-01-02 14:48:01.000000000 +1100
+++ .17749-linux-2.5-bk.updated/kernel/module.c 2003-01-03 19:12:01.000000000 +1100
@@ -481,19 +481,29 @@ sys_delete_module(const char *name_user,
static void print_unload_info(struct seq_file *m, struct module *mod)
{
struct module_use *use;
+ int printed_something = 0;
- seq_printf(m, " %u", module_refcount(mod));
+ seq_printf(m, " %u ", module_refcount(mod));
- list_for_each_entry(use, &mod->modules_which_use_me, list)
- seq_printf(m, " %s", use->module_which_uses->name);
+ /* Always include a trailing , so userspace can differentiate
+ between this and the old multi-field proc format. */
+ list_for_each_entry(use, &mod->modules_which_use_me, list) {
+ printed_something = 1;
+ seq_printf(m, "%s,", use->module_which_uses->name);
+ }
- if (mod->unsafe)
- seq_printf(m, " [unsafe]");
+ if (mod->unsafe) {
+ printed_something = 1;
+ seq_printf(m, "[unsafe],");
+ }
if (mod->init != init_module && mod->exit == cleanup_module)
- seq_printf(m, " [permanent]");
+ printed_something = 1;
+ seq_printf(m, "[permanent],");
+ }
- seq_printf(m, "\n");
+ if (!printed_something)
+ seq_printf(m, "-");
}
void __symbol_put(const char *symbol)
@@ -534,7 +544,8 @@ EXPORT_SYMBOL_GPL(symbol_put_addr);
#else /* !CONFIG_MODULE_UNLOAD */
static void print_unload_info(struct seq_file *m, struct module *mod)
{
- seq_printf(m, "\n");
+ /* We don't know the usage count, or what modules are using. */
+ seq_printf(m, " - -");
}
static inline void module_unload_free(struct module *mod)
@@ -1370,6 +1381,7 @@ static int m_show(struct seq_file *m, vo
seq_printf(m, "%s %lu",
mod->name, mod->init_size + mod->core_size);
print_unload_info(m, mod);
+ seq_printf(m, "\n");
return 0;
}
struct seq_operations modules_op = {
next parent reply other threads:[~2003-01-04 5:55 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <957BD1C2BF3CD411B6C500A0C944CA2601F11712@pdsmsx32.pd.intel.com>
2003-01-04 5:06 ` Rusty Russell [this message]
[not found] <957BD1C2BF3CD411B6C500A0C944CA2601F11711@pdsmsx32.pd.intel.com>
2003-01-03 8:14 ` Kernel module version support Rusty Russell
2003-01-03 5:36 Wang, Stanley
2003-01-03 5:54 ` Rusty Russell
-- strict thread matches above, loose matches on Subject: below --
2003-01-02 14:25 Wang, Stanley
2003-01-03 0:00 ` Rusty Russell
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=20030104060424.712BE2C39C@lists.samba.org \
--to=rusty@rustcorp.com.au \
--cc=kai@tp1.ruhr-uni-bochum.de \
--cc=linux-kernel@vger.kernel.org \
--cc=louis.zhuang@intel.com \
--cc=stanley.wang@intel.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox