Commit Graph

11 Commits

Author SHA1 Message Date
David Marchand
7d16964c3e modinfo: fix module parsing with kernel >= 2.6.37
display() function returns the length of the value we are displaying + 1.
As a consequence, if we have field=value\0field=value\0field=value in the
binary, then the second occurence will be skipped as ptr will miss the first
character of the following field.

Example trying to list aliases from ixgbe.ko on a 3.2 kernel.

- In the module we have:
alias=pci:v00008086d00001560sv*sd*bc*sc*i*\0
alias=pci:v00008086d0000154Asv*sd*bc*sc*i*\0
alias=pci:v00008086d00001557sv*sd*bc*sc*i*\0
alias=pci:v00008086d0000154Fsv*sd*bc*sc*i*\0
alias=pci:v00008086d0000154Dsv*sd*bc*sc*i*\0
...

- Using modinfo -F alias ixgbe returns:
alias:          pci:v00008086d00001560sv*sd*bc*sc*i*
alias:          pci:v00008086d00001557sv*sd*bc*sc*i*
alias:          pci:v00008086d0000154Dsv*sd*bc*sc*i*
...

This problem appeared with kernel commit "modules: no need to align .modinfo
strings" b6472776816af1ed52848c93d26e3edb3b17adab in 2.6.37.

Fix this by not trusting display() return value but increment ptr by strlen(ptr)
(the same way as depmod.c does).

Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-07-04 16:39:28 +02:00
Tanguy Pruvot
772f17a843 modinfo: match more standard module fields and fix version field
Previously, -F version could match the srcversion= string.

before :
  ~ # modinfo -F version tiwlan_drv
  version:        6.1.2012.05.29
  version:        533BB7E5866E52F63B9ACCB
  version:        0x%x, oui=0x%x, 0x%x, 0x%x
  version:        0x%x

  ~ # modinfo tiwlan_drv
  filename:       tiwlan_drv.ko
  author:         Texas Instruments Inc - Retouched by CyanogenDefy
  license:        GPL
  vermagic:       2.6.32.9 preempt mod_unload ARMv7
  parm:           g_sdio_debug_level:debug level
  depends:

now :
  ~ # modinfo -F version tiwlan_drv
  version:        6.1.2012.05.29

  ~ # modinfo tiwlan_drv
  filename:       tiwlan_drv.ko
  license:        GPL
  author:         Texas Instruments Inc - Retouched by CyanogenDefy
  version:        6.1.2012.05.29
  srcversion:     533BB7E5866E52F63B9ACCB
  depends:
  uts_release:    2.6.32.9-g306944c
  vermagic:       2.6.32.9 preempt mod_unload ARMv7
  parm:           g_sdio_debug_level:debug level

This patch also add support for the old "-n" and some other helpers

Change-Id: Icb4e9ca513cbce46b075a6f038799a7a19fb7e22
Signed-off-by: Tanguy Pruvot <tanguy.pruvot@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-06-12 16:26:03 +02:00
Denys Vlasenko
b076193f74 modinfo: make it select PLATFORM_LINUX. Closes 4411
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-10-30 22:07:36 +01:00
Denys Vlasenko
66426760be *: remove "Options:" string from help texts
function                                             old     new   delta
packed_usage                                       28706   28623     -83

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-06-05 03:58:28 +02:00
Denys Vlasenko
df7f2008c2 modinfo: trivial optimizations
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-02-15 01:45:14 +01:00
Lauri Kasanen
12f44ea183 modinfo: show firmware and depends fields
Signed-off-by: Lauri Kasanen <curaga@operamail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-02-15 01:43:04 +01:00
Denys Vlasenko
b9f2d9f7d9 mass removal of underscores from _BB_DIR_foo and _BB_SUID_foo
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-01-18 13:58:01 +01:00
Denys Vlasenko
0ef64bdb40 *: make GNU licensing statement forms more regular
This change retains "or later" state! No licensing _changes_ here,
only form is adjusted (article, space between "GPL" and "v2" and so on).

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-08-16 20:14:46 +02:00
Lauri Kasanen
1b14cdb27c modinfo: support relative paths in modules.dep
function                                             old     new   delta
modinfo                                              272     329     +57
modinfo_main                                         325     344     +19

Signed-off-by: Lauri Kasanen <curaga@operamail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-27 00:35:49 +02:00
Denys Vlasenko
7fdf5a88b4 modinfo: needs modutils.o
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-09 10:18:35 +02:00
Pascal Bellard
22bdf90334 modinfo: new applet
function                                             old     new   delta
modinfo_main                                           -     307    +307
modinfo                                                -     280    +280
packed_usage                                       27037   27131     +94
display                                                -      74     +74
static.shortcuts                                       -      24     +24
applet_names                                        2254    2262      +8
applet_main                                         1324    1328      +4
applet_nameofs                                       662     664      +2
------------------------------------------------------------------------------
(add/remove: 5/0 grow/shrink: 4/0 up/down: 793/0)             Total: 793 bytes

Signed-off-by: Pascal Bellard <pascal.bellard@ads-lu.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-06 04:55:13 +02:00