summaryrefslogtreecommitdiffstats
path: root/lib/raid6/unroll.awk
diff options
context:
space:
mode:
authorDavid Woodhouse <David.Woodhouse@intel.com>2010-08-09 10:36:44 +0100
committerDavid Woodhouse <David.Woodhouse@intel.com>2010-08-09 10:36:44 +0100
commit2144381da478cc4aa3a29ee29b0c5e6ddaaced14 (patch)
tree380a29fec86b537ed602d12f4050654b1c66c27c /lib/raid6/unroll.awk
parent45d7f32c7a43cbb9592886d38190e379e2eb2226 (diff)
parente5d84970a554d5c0072043a7b9f0f5b88b5fdfe1 (diff)
downloadlinux-2144381da478cc4aa3a29ee29b0c5e6ddaaced14.tar.bz2
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 @@
+
+# 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
+ }
+}