2188 Commits

Author SHA1 Message Date
Tobias Stoeckmann
ca9a7f4c5c build: Fix license specification
The kmod project actually uses LGPL 2.1 or later for libkmod. Clarify
this and use proper SPDX license identifier as done in source files.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
Reviewed-by: Lucas De Marchi <demarchi@kernel.org>
Signed-off-by: Lucas De Marchi <demarchi@kernel.org>
2026-01-16 01:31:55 -06:00
dependabot[bot]
dad351539a ci: bump the all-actions group across 1 directory with 6 updates
Bumps the all-actions group with 6 updates in the / directory:

| Package | From | To |
| --- | --- | --- |
| [actions/checkout](https://github.com/actions/checkout) | `4.2.2` | `6.0.1` |
| [yshui/git-clang-format-lint](https://github.com/yshui/git-clang-format-lint) | `1.17` | `1.18` |
| [github/codeql-action](https://github.com/github/codeql-action) | `3.28.18` | `4.31.9` |
| [codespell-project/actions-codespell](https://github.com/codespell-project/actions-codespell) | `2.1` | `2.2` |
| [codecov/codecov-action](https://github.com/codecov/codecov-action) | `5.4.3` | `5.5.2` |
| [peter-evans/repository-dispatch](https://github.com/peter-evans/repository-dispatch) | `3` | `4` |

Updates `actions/checkout` from 4.2.2 to 6.0.1
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](11bd71901b...8e8c483db8)

Updates `yshui/git-clang-format-lint` from 1.17 to 1.18
- [Release notes](https://github.com/yshui/git-clang-format-lint/releases)
- [Commits](27f3890c66...0758f498e5)

Updates `github/codeql-action` from 3.28.18 to 4.31.9
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](ff0a06e83c...5d4e8d1aca)

Updates `codespell-project/actions-codespell` from 2.1 to 2.2
- [Release notes](https://github.com/codespell-project/actions-codespell/releases)
- [Commits](406322ec52...8f01853be1)

Updates `codecov/codecov-action` from 5.4.3 to 5.5.2
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md)
- [Commits](18283e04ce...671740ac38)

Updates `peter-evans/repository-dispatch` from 3 to 4
- [Release notes](https://github.com/peter-evans/repository-dispatch/releases)
- [Commits](https://github.com/peter-evans/repository-dispatch/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: 6.0.1
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: all-actions
- dependency-name: yshui/git-clang-format-lint
  dependency-version: '1.18'
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: all-actions
- dependency-name: github/codeql-action
  dependency-version: 4.31.9
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: all-actions
- dependency-name: codespell-project/actions-codespell
  dependency-version: '2.2'
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: all-actions
- dependency-name: codecov/codecov-action
  dependency-version: 5.5.2
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: all-actions
- dependency-name: peter-evans/repository-dispatch
  dependency-version: '4'
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: all-actions
...

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Lucas De Marchi <demarchi@kernel.org>
2026-01-16 01:31:35 -06:00
Lucas De Marchi
23bb264d0b ci: Fix alpine setup
linux-edge-dev is failing in alpine:

	ERROR: unable to select packages:
	  linux-edge-dev (no such package):
	    required by: world[linux-edge-dev]
	Error: Process completed with exit code 1.

Use linux-stable instead.

Signed-off-by: Lucas De Marchi <demarchi@kernel.org>
2026-01-16 01:16:53 -06:00
Emil Velikov
a403590f6e ci: swap bullseye for bookworm
The former has been EOL for a bit now and somewhat recently has been
(re)moved from the repos -> our CI was failing.

Swap for bookworm, which gives us the "try a slightly older distro"
coverage, while still being green in CI.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/395
Signed-off-by: Lucas De Marchi <demarchi@kernel.org>
2025-10-26 22:37:54 -05:00
Lucas De Marchi
695fd084a7 testsuite: Fix build with gcc < 15
Variable declaration inside a switch case works with gcc 15, but fails
pretty much everywhere else with a message like below:

	../testsuite/init_module.c: In function ‘syscall’:
	../testsuite/init_module.c:343:3: error: a label can only be part of a statement and a declaration is not a statement
	  343 |   const char *args;
	      |   ^~~~~

Add an empty statement to fix it.

Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/390
2025-07-13 22:18:34 -05:00
Lucas De Marchi
5d845ab29a testsuite: simplify syscall number handling
Use a switch() statement for syscall override handling, making it a
little bit less verbose.

Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/387
2025-07-11 10:31:51 -05:00
Andreas Schwab
84db2f930f testsuite/init_module: Handle __NR_riscv_hwprobe in syscall wrapper
The libcrypto library constructor calls the riscv_hwprobe syscall through
the syscall wrapper.  Return an error with ENOSYS.

Signed-off-by: Andreas Schwab <schwab@suse.de>
Link: https://github.com/kmod-project/kmod/pull/387
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
2025-07-11 10:31:51 -05:00
Emil Velikov
1c304d9b95 testsuite: consolidate final exit() call
Currently we call exit() in a handful of places within test_run_child().
Where the latter is annotated as `noreturn int` and we never check the
return value.

Just move the exit() further up the call stack and remove the noreturn
notation.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/376
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2025-07-08 07:17:14 -05:00
Emil Velikov
dd77977c29 testsuite: fixup argument handling
Currently we can pass any number of tests as arguments - be that in
oneshot mode or not.

At the same time, oneshot requires only one test while normal mode can
have up-to one.

Fix that up and as a bonus we no longer need the exit() in
test_run_spawned() \o/

While in here, add a few comments around our arg/argc handling.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/376
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2025-07-08 07:17:14 -05:00
Emil Velikov
ffc165c44b testsuite: remove struct test alignment
Remove the alignment from the struct declaration. The macro
instantiating it DEFINE_TEST_WITH_FUNC already has (proper) alignment.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/376
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2025-07-08 07:17:14 -05:00
Emil Velikov
bffe1a7800 Remove _always_inline_ attribute
We have a single _always_inline_ instance in-tree, which lives in a
header file. Just make it a "static inline", which will practically do
the same thing and what we already have elsewhere in-tree.

While in there drop the CAPS from ALIGN_POWER2 - it's a function, so we
don't need the shouting.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/376
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2025-07-08 07:17:14 -05:00
Emil Velikov
11553144ca Globally silence all Wattribute warnings
Instead of playing a game of whack-a-mole, disable any -Wattribute
warnings globally. This means, people won't get the warnings when
building with older compilers which lack certain attributes.

Thus we can remove the _Pragma. With that gone, we no longer need the
clang-format off segment.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/376
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2025-07-08 07:17:14 -05:00
Lucas De Marchi
3f8ec4d859 testsuite: Fix build warning on kernel 6.15
The module description is now required, otherwise a warning is emitted
by modpost:

	WARNING: modpost: missing MODULE_DESCRIPTION() in mod-loop-k.o

Fix all of them with:

	sed -i '/MODULE_LICENSE("LGPL");/a MODULE_DESCRIPTION("dummy test module");' testsuite/module-playground/mod-*.c
	sed -i '/MODULE_LICENSE("GPL");/a MODULE_DESCRIPTION("dummy test module");' testsuite/module-playground/mod-simple.c

Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2025-07-07 11:42:41 -05:00
Lucas De Marchi
d449664485 ci: Use KDIR=any
Drop .github/print-kdir.sh and just use KDIR=any to handle the kernel
headers.

Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/384
2025-07-07 11:07:41 -05:00
Lucas De Marchi
ea67bad278 testsuite: Handle KDIR=any
I update my kernel frequently and may not be running a kernel with
headers installed. That always leads me to:

	1) run `meson test -C build`
	2) Oh, crap, it fails: no kernel headers
	3) Find whatever kernel header is installed and point KDIR to it

We can do better and tell KDIR=any to use whatever it finds.

Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/384
2025-07-07 11:07:38 -05:00
Tobias Stoeckmann
9c1a363e3e util: Use local variable in get_backoff_delta_msec
This might make the code easier to read.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
Link: https://github.com/kmod-project/kmod/pull/377
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2025-07-07 10:20:33 -05:00
Tobias Stoeckmann
2537c171bc modprobe: return error on timeout
If module cannot be removed in time, return with a failure, not success:

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
Link: https://github.com/kmod-project/kmod/pull/377
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2025-07-07 10:20:33 -05:00
Emil Velikov
f71f74efa0 testsuite: add test for get_backoff_delta_msec
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
Link: https://github.com/kmod-project/kmod/pull/377
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2025-07-07 10:20:33 -05:00
Tobias Stoeckmann
65afd0f1c6 util: check for overflow in get_backoff_delta_msec
If a large delta is given, the multiplication might overflow.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
Link: https://github.com/kmod-project/kmod/pull/377
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2025-07-07 10:20:33 -05:00
Tobias Stoeckmann
f14f260382 util: fix endless loop in get_backoff_delta_msec
If current time t is already past tend, the while loop in
get_backoff_delta_msec never ends.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
Link: https://github.com/kmod-project/kmod/pull/377
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2025-07-07 10:20:33 -05:00
Emil Velikov
ec0f261ac3 ci: move compression variants further down
Move the variants into their own section, similar to the moduledir and
co. This bears no functional change in the CI run.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/383
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2025-06-27 15:22:56 -05:00
Emil Velikov
75a1e9348d ci: remove default options from Debian/bullseye build
Both -Dopenssl=enabled and -Dtools=true are the default. Omit them from
the meson_setup.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/383
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2025-06-27 15:22:56 -05:00
Emil Velikov
12f1b539ff ci: 'temporary' disable sanitizers for 32bit builds
Currently running 32bit tests alongside sanitizers, segfaults due to our
syscall wrapper. Just disable the sanitizers, which means we get at
least some 32bit test coverage.

On a couple of attempts, I wasn't able to get a proper/robust solution,
as outlined in init_module.c - we need vsyscall() which does not exist.

Considering some distributions are dropping 32bit/i686 support, it may
be that we'll nuke these builds from CI sooner than later.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/383
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2025-06-27 15:22:56 -05:00
Emil Velikov
982e7054d3 CONTRIBUTING.md: make it common markdown compatible
Adjust the markdown variant, so it renders correctly in both GitHub and
cgit (... vim also seems happier fwiw). AFAICT the latter is using
CommonMarkdown as handled by python-markdown.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/380
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2025-06-27 15:19:14 -05:00
Emil Velikov
3ae40a62a1 README.md: make it common markdown compatible
Adjust the markdown variant, so it renders correctly in both GitHub and
cgit (... vim also seems happier fwiw). AFAICT the latter is using
CommonMarkdown as handled by python-markdown.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/380
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2025-06-27 15:19:14 -05:00
Emil Velikov
b3a4f0e560 testsuite/test-modprobe: reinstate chdir error path
Earlier commit used a global sed to remove the no-longer needed
exit(EXIT_FAILURE) calls. In the process it also removed one instance
in the error path, which should remain.

Fixes: e09acf2e ("testsuite: remove exit from EXEC_TOOL tests")
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/379
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2025-06-27 11:02:55 -05:00
Tobias Stoeckmann
049c55df47 libkmod/README: fix grammar
Co-authored-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
Link: https://github.com/kmod-project/kmod/pull/378
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2025-06-27 10:58:35 -05:00
Emil Velikov
41b1798768 testsuite: remove exit() calls from main()
There is no particular reason for us to use exit(), so just avoid it.

As result, the only instances using of exit() are within the child
process and our cleanup is complete :-)

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/371
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2025-06-16 07:37:42 -05:00
Emil Velikov
ac4a65b029 testsuite: always exit() from the child process
Update the existing code-paths to always exit() for the child process.
We already handle that in a few places, but the error-paths are
(understandably) off.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/371
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2025-06-16 07:37:42 -05:00
Emil Velikov
6d0d80ac0b testsuite: remove remaining exit/noreturn instances
Purge the remaining exit/noreturn instances, which means we now get a
consistent return path on all tests and across both success and failure
paths.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/371
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2025-06-16 07:37:42 -05:00
Emil Velikov
e09acf2e24 testsuite: remove exit from EXEC_TOOL tests
The EXEC_TOOL macros calls test_spawn_prog() which returns EXIT_FAILURE
in the unlikely case of a return from execv().

Thus the explicit exit() is dead code that we can remove and alongside
it the noreturn notation of the respective tests.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/371
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2025-06-16 07:37:42 -05:00
Emil Velikov
d59268554b testsuite: introduce and use EXEC_TOOL() macro
Swap the currect EXEC_DEPMOD and EXEC_MODPROBE with a slightly more
generic macro - EXEC_TOOL based off them.

Update all in-tree instances of test_spawn_prog() to use it.

This will make follow-up work (removing the noreturn/exit) a bit easier
and more consistent.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/371
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2025-06-16 07:37:42 -05:00
Emil Velikov
bcdf71a1ef testsuite/test-remove: plug memory leaks in success path
With the upcoming patches, removing exit() usage, ASan started reporting
that our test leaks kmod_module handles.

Resolve those leaks - we shouldn't be doing that in the normal (success)
path.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/371
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2025-06-16 07:37:42 -05:00
Emil Velikov
5611bf6eb2 testsuite/test-init: plug memory leaks in success path
With the upcoming patches, removing exit() usage, ASan started reporting
that our test leaks kmod_module handles.

Resolve those leaks - we shouldn't be doing that in the normal (success)
path.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/371
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2025-06-16 07:37:42 -05:00
Emil Velikov
5cecea47dc testsuite: use ARRAY_SIZE() for iteration
Currently we use a mix of ARRAY_SIZE() and iterator pointer, where the
latter needs an extra instance for the NULL sentinel. Plus as evidenced
by the EXIT_SUCCESS -> EXIT_FAILURE changes in test-new-module - is
error prone.

Consistently use ARRAY_SIZE(), fixing the logical error in the test
which was flagged by ASan as memory leak :-)

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/371
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2025-06-16 07:37:42 -05:00
Emil Velikov
db92629b4f testsuite: static const annotate the remaining test data
A while ago we annotated a bunch of of the tests although I missed some
during grepping. Update the final instances, taking the chance to move
the strdup instances into the test loop and failing the test should the
duplication fails.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/371
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2025-06-16 07:37:42 -05:00
Lucas De Marchi
5eac1d728c tools/modprobe: --dry-run shouldn't need -v
Make sure it shows something when running in dry-run mode.

Before:
	kmod $ lsmod | grep i915
	kmod $ ./build/modprobe --dry-run i915
	kmod $ ./build/modprobe -v --dry-run i915
	insmod /lib/modules/6.14.11-1-MANJARO/kernel/drivers/char/agp/intel-gtt.ko.zst
	insmod /lib/modules/6.14.11-1-MANJARO/kernel/drivers/gpu/drm/i915/i915.ko.zst

After:
	kmod $ lsmod | grep i915
	kmod $ ./build/modprobe --dry-run i915
	insmod /lib/modules/6.14.11-1-MANJARO/kernel/drivers/char/agp/intel-gtt.ko.zst
	insmod /lib/modules/6.14.11-1-MANJARO/kernel/drivers/gpu/drm/i915/i915.ko.zst

Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/372
2025-06-16 07:36:44 -05:00
Lucas De Marchi
15edeed386 tools/modprobe: Fix odd --remove-holders behavior
--remove-holders was not implying --remove, which means that if the user
called `modprobe --remove-holders xe` it would actually try to insert
the xe module. Fix it and spell it out in the man page about one option
implying the other.

Considering i915 is not currently loaded:

Before:
	kmod $ ./build/modprobe -v --dry-run --remove-holders i915
	insmod /lib/modules/6.14.11-1-MANJARO/kernel/drivers/char/agp/intel-gtt.ko.zst
	insmod /lib/modules/6.14.11-1-MANJARO/kernel/drivers/gpu/drm/i915/i915.ko.zst
	kmod $

After:
	kmod $ ./build/modprobe -v --dry-run --remove-holders i915
	kmod $

Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/372
2025-06-16 07:36:44 -05:00
Lucas De Marchi
67e677d340 man/modprobe.8: Remove needless **
There are 2 too many * to document the `-r` option.

Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/372
2025-06-16 07:36:44 -05:00
Emil Velikov
e097873146 ci: remove Alpine -Ddocs=false WA
A while ago the Alpine gtk-doc tool chain was having issues building our
docs. That got resolved at some point over the past months, so we can
drop this local workaround.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/373
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2025-06-16 07:36:10 -05:00
Emil Velikov
fc0edb4ac1 tools/modprobe: accept module name with --show-modversions
Use the newly introduced helper module_new_from_any(), so we accept both
files as well as modules. This means you can now do:
 - modprobe --show-modversions drm-vram-helper, alongside the existing
 - modprobe --show-modversions /full/path/to/the/module/drm_vram_helper.ko

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/353
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2025-06-13 13:52:41 -05:00
Emil Velikov
07f1abb965 testsuite/modprobe: add modprobe --show-exports modulename
Add test for the newly introduced --show-exports code path.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/353
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2025-06-13 13:52:41 -05:00
Emil Velikov
7816017f6e testsuite/modprobe: remove --quiet from --show-{depends,exports}
Even though we don't give the user any feedback, the --quiet option is
only applicable with --remove. Remove it from any modprobe --show*
invocations.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/353
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2025-06-13 13:52:41 -05:00
Emil Velikov
5dfa7c9a9b tools/modprobe: accept module name with --show-exports
Use the newly introduced helper module_new_from_any(), so we accept both
files as well as modules. This means you can now do:
 - modprobe --show-exports drm-vram-helper, alongside the existing
 - modprobe --show-exports /full/path/to/the/module/drm_vram_helper.ko

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/353
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2025-06-13 13:52:41 -05:00
Emil Velikov
5753d25231 tools/modprobe: factor out module_new_from_any()
Split the functionality into a helper function, which will be used with
later commits.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/353
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2025-06-13 13:52:41 -05:00
Emil Velikov
de2a26d347 man/modprobe.8: document --show-exports
The option was introduced a few years ago, yet the manual page went
without an update. Add some basic documentation.

Cc: Yauheni Kaliuta <yauheni.kaliuta@redhat.com>
Fixes: 3ada8df8 ("modprobe: add --show-exports")
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/353
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2025-06-13 13:52:41 -05:00
Emil Velikov
200c7b32f3 tools/modprobe: standardize on --show-foo, deprecate the rest
Currently we have a range of options which show specific details,
although they vary in prefix or spelling:
 - prefix: dump vs resolve vs show
 - with and without dash after show

Converge on --show-foo and deprecate the rest. The old options are still
accepted but will throw a warning. Only the (new) consistent names are
listed in --help, while the manual page lists both but spells out that
the old ones will be removed.

To avoid any confusion with --show (aka --dry-run) the option is also
soft-deprecated.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/353
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2025-06-13 13:52:41 -05:00
Emil Velikov
f9ecaf7e1f tools/modprobe: properly deprecate --remove-dependencies
The option was annotated as deprecated a while ago, although we never
flagged a warning when it is in use.

Do that, remove it from the --help screen and add an explicit "will be
removed" notice in the manual page.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/353
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2025-06-13 13:52:41 -05:00
Emil Velikov
d9778a6d9c man/modprobe.8: document --remove-holders
The option was introduced a few years ago, yet the manual page went
without an update. Add some basic documentation.

Cc: Lucas De Marchi <lucas.demarchi@intel.com>
Fixes: 42b32d30 ("modprobe: Fix holders removal")
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/353
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2025-06-13 12:45:25 -05:00
Emil Velikov
077323d034 tools/static-nodes: don't use %m on mkdir_parents() failure
The function returns the error code itself, so we should be using
strerror(-err) instead.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/368
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
2025-06-11 08:03:26 -05:00