[RFC PATCH 1/4] scripts: add modinfo-to-rst script to extract module parameters

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Add a simple script to extract module param info from .ko using
modinfo(8), and convert the results to rst. There's no filtering of rst
special characters or anything.

Signed-off-by: Jani Nikula <jani.nikula@xxxxxxxxx>
---
 scripts/modinfo-to-rst | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
 create mode 100755 scripts/modinfo-to-rst

diff --git a/scripts/modinfo-to-rst b/scripts/modinfo-to-rst
new file mode 100755
index 000000000000..e415c68db72e
--- /dev/null
+++ b/scripts/modinfo-to-rst
@@ -0,0 +1,24 @@
+#!/bin/bash
+# usage: modinfo-to-rst /path/to/module.ko
+
+SELF=modinfo-to-rst
+MODINFO=/sbin/modinfo
+
+if [[ "$#" != "1" ]]; then
+	echo "$SELF: usage: $SELF (modulename|filename)" >&2
+	exit 1
+fi
+
+MODULE="$1"
+MODULENAME="$(basename -s .ko $MODULE)"
+
+cat <<EOF
+.. Autogenerated from ${MODULENAME}.ko using modinfo(8) and $SELF
+
+$MODULENAME
+${MODULENAME//?/\=}
+
+EOF
+
+$MODINFO --parameters --null $MODULE | sort -z |\
+	sed --null-data 's/^\([a-zA-Z0-9_]\+\):\(.*\) (\([a-z]\+\))$/\1 (\3)\n  \2\n\n/' | tr -d "\0"
-- 
2.11.0

--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux