zsh-workers
 help / color / mirror / code / Atom feed
* [PATCH 1/3] modinfo: remove invalid option -f
@ 2009-01-26 21:10 Jörg Sommer
  2009-01-26 21:10 ` [PATCH 2/3] Replace obsolate modprobe -l by file search Jörg Sommer
  2009-01-27  4:06 ` [PATCH 1/3] modinfo: remove invalid option -f Andrey Borzenkov
  0 siblings, 2 replies; 5+ messages in thread
From: Jörg Sommer @ 2009-01-26 21:10 UTC (permalink / raw)
  To: zsh-workers; +Cc: Jörg Sommer

Current versions of modinfo do not support this option:

% modinfo -f
modinfo: invalid option -- f
% modinfo --version
module-init-tools version 3.4
---
 Completion/Linux/Command/_modutils |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/Completion/Linux/Command/_modutils b/Completion/Linux/Command/_modutils
index 40399ab..db419ac 100644
--- a/Completion/Linux/Command/_modutils
+++ b/Completion/Linux/Command/_modutils
@@ -14,7 +14,6 @@ case "$service" in
     _arguments -s -C "$args[@]" \
       '(-)'{-a,--author}"[display the module's author]" \
       '(-)'{-d,--description}"[display the module's description]" \
-      '(-)'{-f+,--format}'[display module info in specified format]' \
       '(-)'{-l,--license}"[display the module's license]" \
       '(-)'{-n,--filename}"[display the module's filename]" \
       '(-)'{-p,--parameters}'[display the typed parameters that a module may support]' \
-- 
1.6.0.6


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 2/3] Replace obsolate modprobe -l by file search
  2009-01-26 21:10 [PATCH 1/3] modinfo: remove invalid option -f Jörg Sommer
@ 2009-01-26 21:10 ` Jörg Sommer
  2009-01-26 21:10   ` [PATCH 3/3] modinfo: Add option -k for different kernel version Jörg Sommer
  2009-01-27  4:06 ` [PATCH 1/3] modinfo: remove invalid option -f Andrey Borzenkov
  1 sibling, 1 reply; 5+ messages in thread
From: Jörg Sommer @ 2009-01-26 21:10 UTC (permalink / raw)
  To: zsh-workers; +Cc: Jörg Sommer

In the manual page of the current modprobe (version 3.4) the option -l is
marked as obsolate; “This option is provided for backwards
compatibility.” So use Zsh tools to get the name of the modules. The base
directory is takes from the manual page that says: “modprobe looks in
the module directory /lib/modules/‘uname -r‘ for all the modules […].”
---
 Completion/Linux/Command/_modutils |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/Completion/Linux/Command/_modutils b/Completion/Linux/Command/_modutils
index db419ac..fe1b58e 100644
--- a/Completion/Linux/Command/_modutils
+++ b/Completion/Linux/Command/_modutils
@@ -77,7 +77,7 @@ case "$state" in
   ;&
 
   all_modules)
-    modules=( ${${${${(f)"$(_call_program modules ${(M)words[1]##*/}modprobe -l 2>/dev/null)"}:#}##*/}%%.*} )
+    modules=( /lib/modules/$(uname -r)/(*~source)/**/*(.:t:r) )
 
     if [[ $state = loadable_modules ]]; then
         modules=( ${modules:#(${(j:|:)~${=loaded_modules//_/-}})} )
-- 
1.6.0.6


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 3/3] modinfo: Add option -k for different kernel version
  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
  0 siblings, 0 replies; 5+ messages in thread
From: Jörg Sommer @ 2009-01-26 21:10 UTC (permalink / raw)
  To: zsh-workers; +Cc: Jörg Sommer

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/3] modinfo: remove invalid option -f
  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-27  4:06 ` Andrey Borzenkov
  2009-01-29 17:56   ` Jörg Sommer
  1 sibling, 1 reply; 5+ messages in thread
From: Andrey Borzenkov @ 2009-01-27  4:06 UTC (permalink / raw)
  To: zsh-workers

On 27 января 2009 00:10:46 Jörg Sommer wrote:
> Current versions of modinfo do not support this option:
>
> % modinfo -f
> modinfo: invalid option -- f
> % modinfo --version
> module-init-tools version 3.4

Any chance there are still users of old modutils with kernel 2.4? How 
hard would it be to support both?


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/3] modinfo: remove invalid option -f
  2009-01-27  4:06 ` [PATCH 1/3] modinfo: remove invalid option -f Andrey Borzenkov
@ 2009-01-29 17:56   ` Jörg Sommer
  0 siblings, 0 replies; 5+ messages in thread
From: Jörg Sommer @ 2009-01-29 17:56 UTC (permalink / raw)
  To: zsh-workers

Hi Andrey,

Andrey Borzenkov <arvidjaar@gmail.com> wrote:
> On 27 января 2009 00:10:46 Jörg Sommer wrote:
>> Current versions of modinfo do not support this option:
>>
>> % modinfo -f
>> modinfo: invalid option -- f
>> % modinfo --version
>> module-init-tools version 3.4
>
> Any chance there are still users of old modutils with kernel 2.4?

Yes, this probabillity will never be zero. I know if users of 2.0 kernel.

> How hard would it be to support both?

w.r.t. this option simply not remove the line. But the question is, if
you really want to support every version that was ever there. I wouldn't
do this.

Bye, Jörg.
-- 
Der Mensch hat die Atombombe erfunden.
Keine Maus der Welt käme auf die Idee, eine Mausefalle zu konstruieren.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-01-29 21:24 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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   ` [PATCH 3/3] modinfo: Add option -k for different kernel version Jörg Sommer
2009-01-27  4:06 ` [PATCH 1/3] modinfo: remove invalid option -f Andrey Borzenkov
2009-01-29 17:56   ` Jörg Sommer

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).