Linux Coding style template

Greg KH greg at kroah.com
Sun Aug 7 00:39:48 EDT 2016


On Sun, Aug 07, 2016 at 12:22:03AM +0300, Charls D. Chap wrote:
> I want to transform some C source files. following Linux kernel coding style.
> 
> - Does script/Lindent STRICTLY follows all linux kernel coding style rules?
> - What scripts/templates do you use/suggest for elegant code style
> with the fact that
>   we are talking about Linux Kernel Coding?
> 
> 
> The GNU guys suggest indent with the following parameters:
> -nbad -bap -nbc -bbo -hnl -br -brs -c33 -cd33 -ncdb -ce -ci4
> -cli0 -d0 -di1 -nfc1 -i8 -ip0 -l80 -lp -npcs -nprs -npsl -sai
> -saf -saw -ncs -nsc -sob -nfca -cp33 -ss -ts8 -il1
> 
> On the other hand:
> Linux/script/Lindent contains:
> -npro -kr -i8 -ts8 -sob -l80 -ss -ncs -cp1
> 
> Differences so far:
> 1)
> indent with gnu parameters inserts a space on labels eg.
>  err: vs
> err:
> 
> 2)
> indent with gnu parameters inserts 26 spaces
> #endif                                                        /*
> something like this*/
> 
> 
> So probably gnu site is outdated?

Probably, start with running Lindent, and then fix up the mess it leaves
by hand.  Shouldn't take more than a day to do it.

good luck!

greg k-h



More information about the Kernelnewbies mailing list