diff options
author | H. Peter Anvin <hpa@zytor.com> | 2008-02-06 04:39:48 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-02-06 13:41:18 -0500 |
commit | 98ec302be52cc8a9cc0f3072126367273dbaf865 (patch) | |
tree | 4c2ab03299ffd64802d92ab1da8b2c3bde7b18a8 | |
parent | 54212cf4054e7cf44f3ca97c3c5fb942dbfe7013 (diff) |
md: raid6: Fix mktable.c
Make both mktables.c and its output CodingStyle compliant. Update the
copyright notice.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Signed-off-by: Neil Brown <neilb@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | drivers/md/mktables.c | 43 |
1 files changed, 17 insertions, 26 deletions
diff --git a/drivers/md/mktables.c b/drivers/md/mktables.c index 339afd0e1b15..b61d5767aae7 100644 --- a/drivers/md/mktables.c +++ b/drivers/md/mktables.c | |||
@@ -1,13 +1,10 @@ | |||
1 | #ident "$Id: mktables.c,v 1.2 2002/12/12 22:41:27 hpa Exp $" | 1 | /* -*- linux-c -*- ------------------------------------------------------- * |
2 | /* ----------------------------------------------------------------------- * | ||
3 | * | 2 | * |
4 | * Copyright 2002 H. Peter Anvin - All Rights Reserved | 3 | * Copyright 2002-2007 H. Peter Anvin - All Rights Reserved |
5 | * | 4 | * |
6 | * This program is free software; you can redistribute it and/or modify | 5 | * This file is part of the Linux kernel, and is made available under |
7 | * it under the terms of the GNU General Public License as published by | 6 | * the terms of the GNU General Public License version 2 or (at your |
8 | * the Free Software Foundation, Inc., 53 Temple Place Ste 330, | 7 | * option) any later version; incorporated herein by reference. |
9 | * Bostom MA 02111-1307, USA; either version 2 of the License, or | ||
10 | * (at your option) any later version; incorporated herein by reference. | ||
11 | * | 8 | * |
12 | * ----------------------------------------------------------------------- */ | 9 | * ----------------------------------------------------------------------- */ |
13 | 10 | ||
@@ -73,8 +70,8 @@ int main(int argc, char *argv[]) | |||
73 | for (j = 0; j < 256; j += 8) { | 70 | for (j = 0; j < 256; j += 8) { |
74 | printf("\t\t"); | 71 | printf("\t\t"); |
75 | for (k = 0; k < 8; k++) | 72 | for (k = 0; k < 8; k++) |
76 | printf("0x%02x, ", gfmul(i, j+k)); | 73 | printf("0x%02x,%c", gfmul(i, j + k), |
77 | printf("\n"); | 74 | (k == 7) ? '\n' : ' '); |
78 | } | 75 | } |
79 | printf("\t},\n"); | 76 | printf("\t},\n"); |
80 | } | 77 | } |
@@ -83,47 +80,41 @@ int main(int argc, char *argv[]) | |||
83 | /* Compute power-of-2 table (exponent) */ | 80 | /* Compute power-of-2 table (exponent) */ |
84 | v = 1; | 81 | v = 1; |
85 | printf("\nconst u8 __attribute__((aligned(256)))\n" | 82 | printf("\nconst u8 __attribute__((aligned(256)))\n" |
86 | "raid6_gfexp[256] =\n" | 83 | "raid6_gfexp[256] =\n" "{\n"); |
87 | "{\n"); | ||
88 | for (i = 0; i < 256; i += 8) { | 84 | for (i = 0; i < 256; i += 8) { |
89 | printf("\t"); | 85 | printf("\t"); |
90 | for (j = 0; j < 8; j++) { | 86 | for (j = 0; j < 8; j++) { |
91 | exptbl[i+j] = v; | 87 | exptbl[i + j] = v; |
92 | printf("0x%02x, ", v); | 88 | printf("0x%02x,%c", v, (j == 7) ? '\n' : ' '); |
93 | v = gfmul(v, 2); | 89 | v = gfmul(v, 2); |
94 | if (v == 1) | 90 | if (v == 1) |
95 | v = 0; /* For entry 255, not a real entry */ | 91 | v = 0; /* For entry 255, not a real entry */ |
96 | } | 92 | } |
97 | printf("\n"); | ||
98 | } | 93 | } |
99 | printf("};\n"); | 94 | printf("};\n"); |
100 | 95 | ||
101 | /* Compute inverse table x^-1 == x^254 */ | 96 | /* Compute inverse table x^-1 == x^254 */ |
102 | printf("\nconst u8 __attribute__((aligned(256)))\n" | 97 | printf("\nconst u8 __attribute__((aligned(256)))\n" |
103 | "raid6_gfinv[256] =\n" | 98 | "raid6_gfinv[256] =\n" "{\n"); |
104 | "{\n"); | ||
105 | for (i = 0; i < 256; i += 8) { | 99 | for (i = 0; i < 256; i += 8) { |
106 | printf("\t"); | 100 | printf("\t"); |
107 | for (j = 0; j < 8; j++) { | 101 | for (j = 0; j < 8; j++) { |
108 | v = gfpow(i+j, 254); | 102 | invtbl[i + j] = v = gfpow(i + j, 254); |
109 | invtbl[i+j] = v; | 103 | printf("0x%02x,%c", v, (j == 7) ? '\n' : ' '); |
110 | printf("0x%02x, ", v); | ||
111 | } | 104 | } |
112 | printf("\n"); | ||
113 | } | 105 | } |
114 | printf("};\n"); | 106 | printf("};\n"); |
115 | 107 | ||
116 | /* Compute inv(2^x + 1) (exponent-xor-inverse) table */ | 108 | /* Compute inv(2^x + 1) (exponent-xor-inverse) table */ |
117 | printf("\nconst u8 __attribute__((aligned(256)))\n" | 109 | printf("\nconst u8 __attribute__((aligned(256)))\n" |
118 | "raid6_gfexi[256] =\n" | 110 | "raid6_gfexi[256] =\n" "{\n"); |
119 | "{\n"); | ||
120 | for (i = 0; i < 256; i += 8) { | 111 | for (i = 0; i < 256; i += 8) { |
121 | printf("\t"); | 112 | printf("\t"); |
122 | for (j = 0; j < 8; j++) | 113 | for (j = 0; j < 8; j++) |
123 | printf("0x%02x, ", invtbl[exptbl[i+j]^1]); | 114 | printf("0x%02x,%c", invtbl[exptbl[i + j] ^ 1], |
124 | printf("\n"); | 115 | (j == 7) ? '\n' : ' '); |
125 | } | 116 | } |
126 | printf("};\n\n"); | 117 | printf("};\n"); |
127 | 118 | ||
128 | return 0; | 119 | return 0; |
129 | } | 120 | } |