* [patch] raid6: generate raid6tables.c with proper style
@ 2007-10-26 8:17 Ingo Molnar
2007-10-26 11:26 ` Simon Holm Thøgersen
0 siblings, 1 reply; 4+ messages in thread
From: Ingo Molnar @ 2007-10-26 8:17 UTC (permalink / raw)
To: H. Peter Anvin; +Cc: linux-kernel
Subject: raid6: generate raid6tables.c with proper style
From: Ingo Molnar <mingo@elte.hu>
nitpicking from the coding style police: generate a raid6tables.c that
does not show up in my editor all red ;-)
this also improves the code quality metric of drivers/md/ by
a factor of 10:
errors lines of code errors/KLOC
drivers/md/ [old] 9349 45543 205.2
drivers/md/ [new] 1062 45551 23.3
while humans are not likely to read that file, lets just do this to make
life easier for automated quality checking ...
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
drivers/md/mktables.c | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
Index: linux/drivers/md/mktables.c
===================================================================
--- linux.orig/drivers/md/mktables.c
+++ linux/drivers/md/mktables.c
@@ -69,7 +69,9 @@ int main(int argc, char *argv[])
for ( j = 0 ; j < 256 ; j += 8 ) {
printf("\t\t");
for ( k = 0 ; k < 8 ; k++ ) {
- printf("0x%02x, ", gfmul(i,j+k));
+ if (k)
+ printf(" ");
+ printf("0x%02x,", gfmul(i,j+k));
}
printf("\n");
}
@@ -86,7 +88,9 @@ int main(int argc, char *argv[])
printf("\t");
for ( j = 0 ; j < 8 ; j++ ) {
exptbl[i+j] = v;
- printf("0x%02x, ", v);
+ if (j)
+ printf(" ");
+ printf("0x%02x,", v);
v = gfmul(v,2);
if ( v == 1 ) v = 0; /* For entry 255, not a real entry */
}
@@ -102,7 +106,9 @@ int main(int argc, char *argv[])
printf("\t");
for ( j = 0 ; j < 8 ; j++ ) {
invtbl[i+j] = v = gfpow(i+j,254);
- printf("0x%02x, ", v);
+ if (j)
+ printf(" ");
+ printf("0x%02x,", v);
}
printf("\n");
}
@@ -115,7 +121,9 @@ int main(int argc, char *argv[])
for ( i = 0 ; i < 256 ; i += 8 ) {
printf("\t");
for ( j = 0 ; j < 8 ; j++ ) {
- printf("0x%02x, ", invtbl[exptbl[i+j]^1]);
+ if (j)
+ printf(" ");
+ printf("0x%02x,", invtbl[exptbl[i+j]^1]);
}
printf("\n");
}
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [patch] raid6: generate raid6tables.c with proper style
2007-10-26 8:17 [patch] raid6: generate raid6tables.c with proper style Ingo Molnar
@ 2007-10-26 11:26 ` Simon Holm Thøgersen
2007-10-26 15:22 ` Ingo Molnar
0 siblings, 1 reply; 4+ messages in thread
From: Simon Holm Thøgersen @ 2007-10-26 11:26 UTC (permalink / raw)
To: Ingo Molnar; +Cc: H. Peter Anvin, linux-kernel
fre, 26 10 2007 kl. 10:17 +0200, skrev Ingo Molnar:
> Subject: raid6: generate raid6tables.c with proper style
> From: Ingo Molnar <mingo@elte.hu>
[snip]
> Index: linux/drivers/md/mktables.c
> ===================================================================
> --- linux.orig/drivers/md/mktables.c
> +++ linux/drivers/md/mktables.c
> @@ -69,7 +69,9 @@ int main(int argc, char *argv[])
> for ( j = 0 ; j < 256 ; j += 8 ) {
> printf("\t\t");
> for ( k = 0 ; k < 8 ; k++ ) {
> - printf("0x%02x, ", gfmul(i,j+k));
> + if (k)
> + printf(" ");
> + printf("0x%02x,", gfmul(i,j+k));
What happened with the coding style here?
Simon Holm Thøgersen
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [patch] raid6: generate raid6tables.c with proper style
2007-10-26 11:26 ` Simon Holm Thøgersen
@ 2007-10-26 15:22 ` Ingo Molnar
2007-10-26 17:01 ` H. Peter Anvin
0 siblings, 1 reply; 4+ messages in thread
From: Ingo Molnar @ 2007-10-26 15:22 UTC (permalink / raw)
To: Simon Holm Thøgersen; +Cc: H. Peter Anvin, linux-kernel
* Simon Holm Thøgersen <odie@cs.aau.dk> wrote:
> fre, 26 10 2007 kl. 10:17 +0200, skrev Ingo Molnar:
> > Subject: raid6: generate raid6tables.c with proper style
> > From: Ingo Molnar <mingo@elte.hu>
>
> [snip]
>
> > Index: linux/drivers/md/mktables.c
> > ===================================================================
> > --- linux.orig/drivers/md/mktables.c
> > +++ linux/drivers/md/mktables.c
> > @@ -69,7 +69,9 @@ int main(int argc, char *argv[])
> > for ( j = 0 ; j < 256 ; j += 8 ) {
> > printf("\t\t");
> > for ( k = 0 ; k < 8 ; k++ ) {
> > - printf("0x%02x, ", gfmul(i,j+k));
> > + if (k)
> > + printf(" ");
> > + printf("0x%02x,", gfmul(i,j+k));
>
> What happened with the coding style here?
i adopted to the existing (broken) one. Yes, mktables.c could need a
good cleanup too.
Ingo
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [patch] raid6: generate raid6tables.c with proper style
2007-10-26 15:22 ` Ingo Molnar
@ 2007-10-26 17:01 ` H. Peter Anvin
0 siblings, 0 replies; 4+ messages in thread
From: H. Peter Anvin @ 2007-10-26 17:01 UTC (permalink / raw)
To: Ingo Molnar; +Cc: Simon Holm Thøgersen, linux-kernel
Ingo Molnar wrote:
> * Simon Holm Thøgersen <odie@cs.aau.dk> wrote:
>
>> fre, 26 10 2007 kl. 10:17 +0200, skrev Ingo Molnar:
>>> Subject: raid6: generate raid6tables.c with proper style
>>> From: Ingo Molnar <mingo@elte.hu>
>> [snip]
>>
>>> Index: linux/drivers/md/mktables.c
>>> ===================================================================
>>> --- linux.orig/drivers/md/mktables.c
>>> +++ linux/drivers/md/mktables.c
>>> @@ -69,7 +69,9 @@ int main(int argc, char *argv[])
>>> for ( j = 0 ; j < 256 ; j += 8 ) {
>>> printf("\t\t");
>>> for ( k = 0 ; k < 8 ; k++ ) {
>>> - printf("0x%02x, ", gfmul(i,j+k));
>>> + if (k)
>>> + printf(" ");
>>> + printf("0x%02x,", gfmul(i,j+k));
>> What happened with the coding style here?
>
> i adopted to the existing (broken) one. Yes, mktables.c could need a
> good cleanup too.
>
More so than the output, IMNSHO. I'll take care of it.
-hpa
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-10-26 17:02 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-26 8:17 [patch] raid6: generate raid6tables.c with proper style Ingo Molnar
2007-10-26 11:26 ` Simon Holm Thøgersen
2007-10-26 15:22 ` Ingo Molnar
2007-10-26 17:01 ` H. Peter Anvin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox