aboutsummaryrefslogtreecommitdiffstats
path: root/lib/raid6/unroll.awk
diff options
context:
space:
mode:
authorDavid Woodhouse <David.Woodhouse@intel.com>2010-08-09 05:36:44 -0400
committerDavid Woodhouse <David.Woodhouse@intel.com>2010-08-09 05:36:44 -0400
commit2144381da478cc4aa3a29ee29b0c5e6ddaaced14 (patch)
tree380a29fec86b537ed602d12f4050654b1c66c27c /lib/raid6/unroll.awk
parent45d7f32c7a43cbb9592886d38190e379e2eb2226 (diff)
parente5d84970a554d5c0072043a7b9f0f5b88b5fdfe1 (diff)
Merge branch 'async' of macbook:git/btrfs-unstable
Conflicts: drivers/md/Makefile lib/raid6/unroll.pl
Diffstat (limited to 'lib/raid6/unroll.awk')
-rw-r--r--lib/raid6/unroll.awk20
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/raid6/unroll.awk b/lib/raid6/unroll.awk
new file mode 100644
index 000000000000..c6aa03631df8
--- /dev/null
+++ b/lib/raid6/unroll.awk
@@ -0,0 +1,20 @@
1
2# This filter requires one command line option of form -vN=n
3# where n must be a decimal number.
4#
5# Repeat each input line containing $$ n times, replacing $$ with 0...n-1.
6# Replace each $# with n, and each $* with a single $.
7
8BEGIN {
9 n = N + 0
10}
11{
12 if (/\$\$/) { rep = n } else { rep = 1 }
13 for (i = 0; i < rep; ++i) {
14 tmp = $0
15 gsub(/\$\$/, i, tmp)
16 gsub(/\$\#/, n, tmp)
17 gsub(/\$\*/, "$", tmp)
18 print tmp
19 }
20}