mini-os: add a coding style file
PATCH 1/1 mini-os: add a coding style file
Since carving out Mini-OS from the Xen repository there hasn't been a description of the preferred coding style. Copy the Xen CODING_STYLE file.
--- CODING_STYLE | 109 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 109 insertions(+) create mode 100644 CODING_STYLE
CODING_STYLE new file +109 -0
@@ -0,0 +1,109 @@ +Coding Style for Mini-OS +======================== + +Indentation +----------- + +Indenting uses spaces, not tabs - in contrast to Linux. An indent +level consists of four spaces. Code within blocks is indented by one +extra indent level. The enclosing braces of a block are indented the +same as the code _outside_ the block. e.g. + +void fun(void) +{ + /* One level of indent. */ + + { + /* A second level of indent. */ + } +} + +White space +----------- + +Space characters are used to spread out logical statements, such as in +the condition of an if or while. Spaces are placed between the +keyword and the brackets surrounding the condition, between the +brackets and the condition itself, and around binary operators (except +the structure access operators, '.' and '->'). e.g. + +if ( (wibble & wombat) == 42 ) +{ + ... + +There should be no trailing white space at the end of lines (including +after the opening /* of a comment block). + +Line Length +----------- + +Lines should be less than 80 characters in length. Long lines should +be split at sensible places and the trailing portions indented. + +User visible strings (e.g., printk() messages) should not be split so +they can searched for more easily. + +Bracing +------- + +Braces ('{' and '}') are usually placed on a line of their own, except +for the do/while loop. This is unlike the Linux coding style and +unlike K&R. do/while loops are an exception. e.g.: + +if ( condition ) +{ + /* Do stuff. */ +} +else +{ + /* Other stuff. */ +} + +while ( condition ) +{ + /* Do stuff. */ +} + +do { + /* Do stuff. */ +} while ( condition ); + +etc. + +Braces should be omitted for blocks with a single statement. e.g., + +if ( condition ) + single_statement(); + +Comments +-------- + +Only C style /* ... */ comments are to be used. C++ style // comments +should not be used. Multi-word comments should begin with a capital +letter. Comments containing a single sentence may end with a full +stop; comments containing several sentences must have a full stop +after each sentence. + +Multi-line comment blocks should start and end with comment markers on +separate lines and each line should begin with a leading '*'. + +/* + * Example, multi-line comment block. + * + * Note beginning and end markers on separate lines and leading '*'. + */ + +Emacs local variables +--------------------- + +A comment block containing local variables for emacs is permitted at +the end of files. It should be: + +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 4 + * indent-tabs-mode: nil + * End: + */
Signature · 7 lines
2.12.3 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Quoted 4 lines · Juergen Gross
Since carving out Mini-OS from the Xen repository there hasn't been a description of the preferred coding style. Copy the Xen
CODING_STYLEfile.
I welcome such addition. I have no opinion in actual style used though. I just want consistency. :-)
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 8 lines · Wei Liu
Quoted 4 lines · Juergen Gross
Since carving out Mini-OS from the Xen repository there hasn't been a description of the preferred coding style. Copy the Xen
CODING_STYLEfile.I welcome such addition. I have no opinion in actual style used though. I just want consistency. :-)
Is this an Ack?
Juergen
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Wei Liu
Acked-byQuoted 7 lines · Juergen Gross
Quoted 6 lines · Wei Liu
Quoted 4 lines · Juergen Gross
Since carving out Mini-OS from the Xen repository there hasn't been a description of the preferred coding style. Copy the Xen
CODING_STYLEfile.
Quoted 5 lines
Quoted 2 lines
I welcome such addition. I have no opinion in actual style used though. I just want consistency. :-)
Is this an Ack?
Yes.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 11 lines · Wei Liu
Quoted 10 lines · Juergen Gross
Quoted 8 lines · Wei Liu
Quoted 4 lines · Juergen Gross
Since carving out Mini-OS from the Xen repository there hasn't been a description of the preferred coding style. Copy the Xen
CODING_STYLEfile.I welcome such addition. I have no opinion in actual style used though. I just want consistency. :-)
Quoted 6 lines
Quoted 2 lines
Is this an Ack?
Yes.
Acked-by Wei Liu <[email protected]>
So this is pending for 3 months now...
Juergen
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 12 lines · Juergen Gross
Quoted 11 lines · Wei Liu
Quoted 10 lines · Juergen Gross
Quoted 8 lines · Wei Liu
Quoted 4 lines · Juergen Gross
Since carving out Mini-OS from the Xen repository there hasn't been a description of the preferred coding style. Copy the Xen
CODING_STYLEfile.I welcome such addition. I have no opinion in actual style used though. I just want consistency. :-)
Quoted 9 lines
Quoted 6 lines
Quoted 2 lines
Is this an Ack?
Yes.
Acked-by Wei Liu <[email protected]>So this is pending for 3 months now...
Oops, sorry. You know why I didn't get to this earlier. :-)
This and other pending patches will be committed shortly.
Wei.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel