Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[PATCH 3/3] modinfo: Add option -k for different kernel version
- X-seq: zsh-workers 26453
- From: JÃrg Sommer <joerg@xxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxx
- Subject: [PATCH 3/3] modinfo: Add option -k for different kernel version
- Date: Mon, 26 Jan 2009 22:10:48 +0100
- Cc: JÃrg Sommer <joerg@xxxxxxxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=simple/simple; d=gnuu.de; s=banki; t=1233004623; i=@xxxxxxxxxxxx; bh=kLbCtaQzWJb7B3obTgQnzKKaTv8pIQNHX PTbPMX9uw8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To: References; b=EHz2hPthjrNoy5rbm9bMB77VhQqoZ+B4nafF4VAcRar0pHw2BM27 Dn0XeKwQugRLRW9wuf4chUn9Zw+nlDNI+o44cd0LOJ0uHWoPtqMYHXjC/Dtow8L2One 3in3faEvyZ/lL5S+xr0BhEBdwAexqutXJdg/UICVHuDnHm8WozLY=
- In-reply-to: <1233004248-24000-2-git-send-email-joerg@xxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <1233004248-24000-1-git-send-email-joerg@xxxxxxxxxxxx> <1233004248-24000-2-git-send-email-joerg@xxxxxxxxxxxx>
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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author