diff options
Diffstat (limited to 'kernel/lib/raid6/unroll.awk')
-rw-r--r-- | kernel/lib/raid6/unroll.awk | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/kernel/lib/raid6/unroll.awk b/kernel/lib/raid6/unroll.awk new file mode 100644 index 000000000..c6aa03631 --- /dev/null +++ b/kernel/lib/raid6/unroll.awk @@ -0,0 +1,20 @@ + +# This filter requires one command line option of form -vN=n +# where n must be a decimal number. +# +# Repeat each input line containing $$ n times, replacing $$ with 0...n-1. +# Replace each $# with n, and each $* with a single $. + +BEGIN { + n = N + 0 +} +{ + if (/\$\$/) { rep = n } else { rep = 1 } + for (i = 0; i < rep; ++i) { + tmp = $0 + gsub(/\$\$/, i, tmp) + gsub(/\$\#/, n, tmp) + gsub(/\$\*/, "$", tmp) + print tmp + } +} |