From: "Jörg Sommer" <joerg@alea.gnuu.de>
To: zsh-workers@sunsite.dk
Cc: "Jörg Sommer" <joerg@alea.gnuu.de>
Subject: [PATCH 3/3] modinfo: Add option -k for different kernel version
Date: Mon, 26 Jan 2009 22:10:48 +0100 [thread overview]
Message-ID: <1233004248-24000-3-git-send-email-joerg@alea.gnuu.de> (raw)
In-Reply-To: <1233004248-24000-2-git-send-email-joerg@alea.gnuu.de>
The option -k makes modinfo looks in a different master directory below
/lib/modules for the module. This way informations about a module for a
different kernel version can get extracted.
---
Completion/Linux/Command/_modutils | 12 +++++++++++-
1 files changed, 11 insertions(+), 1 deletions(-)
diff --git a/Completion/Linux/Command/_modutils b/Completion/Linux/Command/_modutils
index fe1b58e..c0ac8eb 100644
--- a/Completion/Linux/Command/_modutils
+++ b/Completion/Linux/Command/_modutils
@@ -1,6 +1,7 @@
#compdef lsmod modinfo modprobe rmmod insmod
local curcontext="$curcontext" expl state line modules ign args ret=1
+local -r modules_dir=/lib/modules
args=(
'(-)'{-V,--version}'[print version]'
@@ -19,6 +20,8 @@ case "$service" in
'(-)'{-p,--parameters}'[display the typed parameters that a module may support]' \
'(-)'{-F,--field}"[display only selected module's information]:module_field:(
alias author depends description filename license parm)" \
+ '(-)-k[use modules from a different kernel version]:kernel_version:(
+ $(echo $modules_dir/*(/\:t)))' \
'1:module file:->all_modules' && ret=0
;;
@@ -77,7 +80,14 @@ case "$state" in
;&
all_modules)
- modules=( /lib/modules/$(uname -r)/(*~source)/**/*(.:t:r) )
+ local kver
+ integer kver_idx
+ if (( kver_idx=${words[(I)-k]} )); then
+ kver=${words[kver_idx+1]}
+ else
+ kver=$(uname -r)
+ fi
+ modules=( $modules_dir/$kver/(*~source)/**/*(.:t:r) )
if [[ $state = loadable_modules ]]; then
modules=( ${modules:#(${(j:|:)~${=loaded_modules//_/-}})} )
--
1.6.0.6
next prev parent reply other threads:[~2009-01-26 21:17 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-26 21:10 [PATCH 1/3] modinfo: remove invalid option -f Jörg Sommer
2009-01-26 21:10 ` [PATCH 2/3] Replace obsolate modprobe -l by file search Jörg Sommer
2009-01-26 21:10 ` Jörg Sommer [this message]
2009-01-27 4:06 ` [PATCH 1/3] modinfo: remove invalid option -f Andrey Borzenkov
2009-01-29 17:56 ` Jörg Sommer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1233004248-24000-3-git-send-email-joerg@alea.gnuu.de \
--to=joerg@alea.gnuu.de \
--cc=zsh-workers@sunsite.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).