diff options
author | Matt Domsch <Matt_Domsch@dell.com> | 2005-06-24 01:05:15 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-06-24 03:06:40 -0400 |
commit | c988d2b2845495373f666a381d354a7f80981d62 (patch) | |
tree | aece734adc28728437c9c87ba53428e79ac4c25f /include | |
parent | f5bec39639d386e1893dc440dd536761136ab36b (diff) |
[PATCH] modules: add version and srcversion to sysfs
This patch adds version and srcversion files to
/sys/module/${modulename} containing the version and srcversion fields
of the module's modinfo section (if present).
/sys/module/e1000
|-- srcversion
`-- version
This patch differs slightly from the version posted in January, as it
now uses the new kstrdup() call in -mm.
Why put this in sysfs?
a) Tools like DKMS, which deal with changing out individual kernel
modules without replacing the whole kernel, can behave smarter if they
can tell the version of a given module. The autoinstaller feature, for
example, which determines if your system has a "good" version of a
driver (i.e. if the one provided by DKMS has a newer verson than that
provided by the kernel package installed), and to automatically compile
and install a newer version if DKMS has it but your kernel doesn't yet
have that version.
b) Because sysadmins manually, or with tools like DKMS, can switch out
modules on the file system, you can't count on 'modinfo foo.ko', which
looks at /lib/modules/${kernelver}/... actually matching what is loaded
into the kernel already. Hence asking sysfs for this.
c) as the unbind-driver-from-device work takes shape, it will be
possible to rebind a driver that's built-in (no .ko to modinfo for the
version) to a newly loaded module. sysfs will have the
currently-built-in version info, for comparison.
d) tech support scripts can then easily grab the version info for what's
running presently - a question I get often.
There has been renewed interest in this patch on linux-scsi by driver
authors.
As the idea originated from GregKH, I leave his Signed-off-by: intact,
though the implementation is nearly completely new. Compiled and run on
x86 and x86_64.
From: Matthew Dobson <colpatch@us.ibm.com>
build fix
From: Thierry Vignaud <tvignaud@mandriva.com>
build fix
From: Matthew Dobson <colpatch@us.ibm.com>
warning fix
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
Signed-off-by: Matt Domsch <Matt_Domsch@dell.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/module.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/include/linux/module.h b/include/linux/module.h index 0e432a0f4aee..f05372b7fe77 100644 --- a/include/linux/module.h +++ b/include/linux/module.h | |||
@@ -51,6 +51,9 @@ struct module_attribute { | |||
51 | ssize_t (*show)(struct module_attribute *, struct module *, char *); | 51 | ssize_t (*show)(struct module_attribute *, struct module *, char *); |
52 | ssize_t (*store)(struct module_attribute *, struct module *, | 52 | ssize_t (*store)(struct module_attribute *, struct module *, |
53 | const char *, size_t count); | 53 | const char *, size_t count); |
54 | void (*setup)(struct module *, const char *); | ||
55 | int (*test)(struct module *); | ||
56 | void (*free)(struct module *); | ||
54 | }; | 57 | }; |
55 | 58 | ||
56 | struct module_kobject | 59 | struct module_kobject |
@@ -239,6 +242,8 @@ struct module | |||
239 | /* Sysfs stuff. */ | 242 | /* Sysfs stuff. */ |
240 | struct module_kobject mkobj; | 243 | struct module_kobject mkobj; |
241 | struct module_param_attrs *param_attrs; | 244 | struct module_param_attrs *param_attrs; |
245 | const char *version; | ||
246 | const char *srcversion; | ||
242 | 247 | ||
243 | /* Exported symbols */ | 248 | /* Exported symbols */ |
244 | const struct kernel_symbol *syms; | 249 | const struct kernel_symbol *syms; |