kmod/tools
Lucas De Marchi 94f7683c5a modinfo: Allow to force arg as module name
If the Linux kernel or userspace sets an alias with the same name as a
module, they force the tools to use that. However in some situations it
may be desired to query the module itself. Getting the module
information through modinfo is one such situation. So, add a option to
modinfo to explicitly instruct it to handle the argument as a module
name.

Example, when trying to output information about the crc32 module that
is builtin:

	$ modinfo crc32
	filename:       /lib/modules/5.15.19-1-MANJARO/kernel/arch/x86/crypto/crc32-pclmul.ko.zst
	alias:          crypto-crc32-pclmul
	alias:          crc32-pclmul
	alias:          crypto-crc32
	alias:          crc32
	license:        GPL
	author:         Alexander Boyko <alexander_boyko@xyratex.com>
	srcversion:     B6B2FF9236731E69418A2E5
	alias:          cpu:type:x86,ven*fam*mod*:feature:*0081*
	depends:
	retpoline:      Y
	intree:         Y
	name:           crc32_pclmul
	vermagic:       5.15.19-1-MANJARO SMP preempt mod_unload
	sig_id:         PKCS#7
	signer:         Build time autogenerated kernel key
	sig_key:        77:FB:AA:BD:48:78:A4:C6:56:18:9A:7E:A6:F3:29:3E:C5:6B:E9:37
	sig_hashalgo:   sha512
	signature:      30:65:02:31:00:B0:D4:49:9D:1D:F1:71:4C:3C:BB:70:B2:3E:46:5D:
			38:5A:F1:00:95:FD:7A:96:C4:2C:24:35:A2:1B:0B:A8:1C:29:6F:02:
			7A:68:EE:BA:A4:1C:01:4B:86:39:15:3E:66:02:30:7F:7A:66:5E:F2:
			2F:98:73:3D:AD:96:66:81:8B:94:6E:F3:3F:44:0F:85:E1:73:3A:9E:
			F9:C4:BE:9B:88:02:BD:83:04:B9:2E:72:0B:93:BC:82:B6:A1:1B:6A:
			C2:ED:8C
	filename:       /lib/modules/5.15.19-1-MANJARO/kernel/crypto/crc32_generic.ko.zst
	alias:          crypto-crc32-generic
	alias:          crc32-generic
	alias:          crypto-crc32
	alias:          crc32
	license:        GPL
	description:    CRC32 calculations wrapper for lib/crc32
	author:         Alexander Boyko <alexander_boyko@xyratex.com>
	srcversion:     F08036C38DDB06BCD1E6091
	depends:
	retpoline:      Y
	intree:         Y
	name:           crc32_generic
	vermagic:       5.15.19-1-MANJARO SMP preempt mod_unload
	sig_id:         PKCS#7
	signer:         Build time autogenerated kernel key
	sig_key:        77:FB:AA:BD:48:78:A4:C6:56:18:9A:7E:A6:F3:29:3E:C5:6B:E9:37
	sig_hashalgo:   sha512
	signature:      30:65:02:31:00:E3:9E:C8:80:15:0E:D7:74:96:B5:25:EA:32:F7:DF:
			E9:FC:3C:82:D9:B9:B9:37:C5:20:8D:06:31:02:62:B3:54:E8:DF:F2:
			7E:E2:7C:A4:CF:49:17:CB:75:DF:2C:7A:2F:02:30:25:DE:7C:2A:2C:
			97:3F:65:16:76:B3:71:FB:62:DB:8F:F3:33:65:77:98:F3:57:ED:D7:
			87:78:FF:C2:04:55:70:00:10:63:1E:B2:FE:22:D8:E5:6D:5F:95:4E:
			7D:2C:6B

That is because the Linux kernel exports "crc32" as an alias to those modules,
besides being a module itself:

	$ grep crc32 /lib/modules/$(uname -r)/modules.builtin
	kernel/lib/crc32.ko
	$ $ grep "alias crc32 " /lib/modules/$(uname -r)/modules.alias
	alias crc32 crc32_pclmul
	alias crc32 crc32_generic

With the new -m|--modname option it's possible to query the information about this (builtin)
module explicitly:

	$ modinfo --modname crc32
	name:           crc32
	filename:       (builtin)
	license:        GPL
	file:           lib/crc32
	description:    Various CRC32 calculations
	author:         Matt Domsch <Matt_Domsch@dell.com>

Reviewed-by: Luis Chamberlain <mcgrof@kernel.org>
2022-02-20 20:58:25 -08:00
..
.gitignore tools: Use test/kmod instead of kmod-nolib 2013-07-02 21:15:54 -03:00
COPYING Clarify what licences apply where 2014-10-09 01:26:34 -03:00
Makefile build-sys: add small redirecting Makefiles 2014-03-06 01:59:58 -03:00
depmod.c depmod: Stop opening modules.modinfo once per module 2022-02-11 22:06:34 -08:00
insert.c tools: add basic versions of insert and remove 2015-03-07 12:09:51 -03:00
insmod.c insmod: fix wron fallthrough of -f 2015-11-20 19:26:33 -02:00
kmod.c tools: display features in --version 2015-06-08 22:38:02 -03:00
kmod.h tools: add basic versions of insert and remove 2015-03-07 12:09:51 -03:00
log.c Change default log level 2015-09-30 15:17:01 -03:00
log.h Add format attribute and fix issues 2013-04-21 16:17:12 -03:00
lsmod.c Fix spurious spaces in lsmod output 2015-04-16 08:46:43 -03:00
modinfo.c modinfo: Allow to force arg as module name 2022-02-20 20:58:25 -08:00
modprobe.c modprobe: use flags rather than bool args 2019-11-07 09:46:51 -08:00
remove.c tools: Print a message if refcnt attribute is missing 2019-03-08 13:06:52 -08:00
rmmod.c tools: Print a message if refcnt attribute is missing 2019-03-08 13:06:52 -08:00
static-nodes.c static-nodes: indicate that creation of static nodes should only happen at boot 2014-10-28 16:49:46 -02:00