login
Login
/
Register
Search
Search this site:
Forums
News
Blogs
Features
Site
Home
»
Mailing list archives
»
linux-kernel
»
2010
»
December
»
22
Re: [PATCH] Show version information for built-in modules in sysfs
view
thread
Previous message: [
thread
] [
date
] [
author
]
Next message: [
thread
] [
date
] [
author
]
[view in full thread]
From: Rusty Russell
Subject:
Re: [PATCH] Show version information for built-in modules in sysfs
Date: Tuesday, December 21, 2010 - 6:48 pm
On Wed, 22 Dec 2010 11:47:12 am Dmitry Torokhov wrote:
quoted text
> On Tue, Dec 21, 2010 at 05:02:40PM -0800, Rusty Russell wrote: > > On Thu, 16 Dec 2010 08:30:19 am Dmitry Torokhov wrote: > > > Currently only drivers that are built as modules have their versions > > > shown in /sys/module/<module_name>/version, but this information might > > > also be useful for built-in drivers as well. This especially important > > > for drivers that do not define any parameters - such drivers, if > > > built-in, are completely invisible from userspace. > > > > > > This patch changes MODULE_VERSION() macro so that in case when we are > > > compiling built-in module, version information is stored in a separate > > > section. Kernel then uses this data to create 'version' sysfs attribute > > > in the same fashion it creates attributes for module parameters. > > > > > > Signed-off-by: Dmitry Torokhov <dtor@vmware.com> > > > --- > > > > > > This change is driven by our desire to detect whether vmw_balloon driver > > > is built-in into the kernel when we installing our tool package in the > > > guest and avoid installing our own version of the driver. > > > > > > Since vmw_balloon does not have any module parameter nor registers any > > > driver core devices, without this patch it is completely invisible from > > > userspace when built into the kernel. > > > > > > Thanks, > > > Dmitry > > > > > > include/asm-generic/vmlinux.lds.h | 7 ++++ > > > include/linux/module.h | 27 +++++++++++++++ > > > kernel/params.c | 65 ++++++++++++++++++++++++++++++------ > > > 3 files changed, 88 insertions(+), 11 deletions(-) > > > > > > diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h > > > index bd69d79..0d83dd1 100644 > > > --- a/include/asm-generic/vmlinux.lds.h > > > +++ b/include/asm-generic/vmlinux.lds.h > > > @@ -355,6 +355,13 @@ > > > VMLINUX_SYMBOL(__start___param) = .; \ > > > *(__param) \ > > > VMLINUX_SYMBOL(__stop___param) = .; \ > > > + } \ > > > + \ > > > + /* Built-in module versions. */ \ > > > + __modver : AT(ADDR(__modver) - LOAD_OFFSET) { \ > > > + VMLINUX_SYMBOL(__start___modver) = .; \ > > > + *(__modver) \ > > > + VMLINUX_SYMBOL(__stop___modver) = .; \ > > > . = ALIGN((align)); \ > > > VMLINUX_SYMBOL(__end_rodata) = .; \ > > > } \ > > > diff --git a/include/linux/module.h b/include/linux/module.h > > > index 7575bbb..f74ddda 100644 > > > --- a/include/linux/module.h > > > +++ b/include/linux/module.h > > > @@ -58,6 +58,12 @@ struct module_attribute { > > > void (*free)(struct module *); > > > }; > > > > > > +struct module_version_attribute { > > > + struct module_attribute mattr; > > > + const char *module_name; > > > + const char *version; > > > +}; > > > + > > > struct module_kobject > > > { > > > struct kobject kobj; > > > @@ -161,7 +167,28 @@ extern struct module __this_module; > > > Using this automatically adds a checksum of the .c files and the > > > local headers in "srcversion". > > > */ > > > + > > > +#ifdef MODULE > > > #define MODULE_VERSION(_version) MODULE_INFO(version, _version) > > > +#else > > > +#define MODULE_VERSION(_version) \ > > > + extern ssize_t __modver_version_show(struct module_attribute *, \ > > > + struct module *, char *); \ > > > + static struct module_version_attribute __modver_version_attr \ > > > + __used \ > > > + __attribute__ ((unused,__section__ ("__modver"),aligned(sizeof(void *)))) \ > > > > __used and unused seems overkill, and confused. > > > > Must admit that I copied used/unused verbatim from linux/moduleparam.h: > > /* This is the fundamental function for registering boot/module > parameters. */ > #define __module_param_call(prefix, name, ops, arg, isbool, perm) \ > /* Default value instead of permissions? */ \ > static int __param_perm_check_##name __attribute__((unused)) = \ > BUILD_BUG_ON_ZERO((perm) < 0 || (perm) > 0777 || ((perm) & 2)) \ > + BUILD_BUG_ON_ZERO(sizeof(""prefix) > MAX_PARAM_PREFIX_LEN); \ > static const char __param_str_##name[] = prefix #name; \ > static struct kernel_param __moduleparam_const __param_##name \ > __used \ > __attribute__ ((unused,__section__ ("__param"),aligned(sizeof(void *)))) \ > = { __param_str_##name, ops, perm, isbool ? KPARAM_ISBOOL : 0, \ > { arg } } > > > So should it be removed from here as well?
I think so, but (as always!) check git blame. Patch welcome! Rusty. --
unsubscribe notice
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to
majordomo@vger.kernel.org
More majordomo info at
http://vger.kernel.org/majordomo-info.html
Please read the FAQ at
http://www.tux.org/lkml/
Previous message: [
thread
] [
date
] [
author
]
Next message: [
thread
] [
date
] [
author
]
Messages in current thread:
[PATCH] Show version information for built-in modules in sysfs
, Dmitry Torokhov
, (Wed Dec 15, 3:00 pm)
Re: [PATCH] Show version information for built-in modules ...
, Alexey Dobriyan
, (Wed Dec 15, 3:06 pm)
Re: [PATCH] Show version information for built-in modules ...
, Dmitry Torokhov
, (Wed Dec 15, 3:14 pm)
Re: [PATCH] Show version information for built-in modules ...
, Alexey Dobriyan
, (Wed Dec 15, 4:25 pm)
Re: [PATCH] Show version information for built-in modules ...
, Dmitry Torokhov
, (Wed Dec 15, 4:53 pm)
Re: [PATCH] Show version information for built-in modules ...
, Dmitry Torokhov
, (Wed Dec 15, 5:30 pm)
Re: [PATCH] Show version information for built-in modules ...
, Alexey Dobriyan
, (Thu Dec 16, 5:58 am)
Re: [PATCH] Show version information for built-in modules ...
, Rusty Russell
, (Tue Dec 21, 6:02 pm)
Re: [PATCH] Show version information for built-in modules ...
, Dmitry Torokhov
, (Tue Dec 21, 6:17 pm)
Re: [PATCH] Show version information for built-in modules ...
, Rusty Russell
, (Tue Dec 21, 6:45 pm)
Re: [PATCH] Show version information for built-in modules ...
, Rusty Russell
, (Tue Dec 21, 6:48 pm)
Re: [PATCH] Show version information for built-in modules ...
, Dmitry Torokhov
, (Wed Dec 22, 5:38 pm)
Re: [PATCH] Show version information for built-in modules ...
, Rusty Russell
, (Wed Dec 22, 7:27 pm)
Navigation
Create content
Mailing list archives
Recent posts
Popular discussions
linux-kernel
:
Paul Turner
[tg_shares_up rewrite v4 11/11] sched: update tg->shares after cpu.shares write
Mr. James W. Laferriere
Re: Linux 2.6.25-rc1 , syntax error near unexpected token `;'
Chuck Ebbert
Re: PCI: Unable to reserve mem region problem
Linus Torvalds
Linux 2.6.34-rc4
Mingming Cao
Re: [RFC 1/4] Large Blocksize support for Ext2/3/4
git
:
Ralf Wildenhues
[PATCH] Fix typos in the documentation
Len Brown
Re: fatal: unable to create '.git/index': File exists
Adeodato
Bazaar's patience diff as GIT_EXTERNAL_DIFF
Denis Bueno
Git clone error
Johannes Schindelin
Re: [PATCH 2/4] Add functions get_relative_cwd() and is_inside_dir()
git-commits-head
:
Linux Kernel Mailing List
ASoC: fix registration of the SoC card in the Freescale MPC8610 drivers
Linux Kernel Mailing List
drivers/acpi: use kasprintf
Linux Kernel Mailing List
nfsd41: sanity check client drc maxreqs
Linux Kernel Mailing List
bnx2x: Moving includes
Linux Kernel Mailing List
V4L/DVB: gspca - sonixj: Adjust minor values of sensor ov7630. - set the color ga...
openbsd-misc
:
Sevan / Venture37
Re: This is what Linus Torvalds calls openBSD crowd
Netmaffia.hu
Tini Lányok AKCIÓBAN OTTHON
Sam Fourman Jr.
Re: Help with Altell PC6700
Siju George
This is what Linus Torvalds calls openBSD crowd
Darrin Chandler
Re: OT: Python (was Re: vi in /bin)
linux-netdev
:
Kurt Van Dijck
Re: [PATCH net-next-2.6 1/2] can: add driver for Softing card
Eric Dumazet
Re: [PATCH net-next-2.6] net: Introduce skb_orphan_try()
Jamie Lokier
Re: POHMELFS high performance network filesystem. Transactions, failover, performa...
Jarek Poplawski
Re: socket api problem: can't bind an ipv6 socket to ::ffff:0.0.0.0
David Miller
Re: [PATCH v2] net: typos in comments in include/linux/igmp.h
Colocation donated by:
Syndicate