Start CODINGSTYLE document and add table with abbreviations

To get consistent and readable code let's try to advertise some common
abbreviations.

Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
This commit is contained in:
Michael Holzheu
2017-11-17 14:37:15 +01:00
parent f595bce3c0
commit c12c4af760
3 changed files with 49 additions and 9 deletions

46
CODINGSTYLE.md Normal file
View File

@@ -0,0 +1,46 @@
Coding guidelines for s390-tools
================================
For s390-tools the preferred language is C. We provide libraries, e.g. libutil
that should be used by all tools if possible.
The coding style is based on the Linux kernel guidelines. Therefore, use
the checkpatch tool for verification before you submit a patch:
- https://github.com/torvalds/linux/blob/master/scripts/checkpatch.pl
Below we describe some additional things that we want you to consider when
writing new code for s390-tools.
This package started in 2001 and has a long "tradition" - therefore, older tools
might not follow all recommendations. Note that when changing existing code,
consistency could have priority over applying rules.
Standard abbreviations
----------------------
The abbreviations below are recommended to be used in the source code.
| __Short Name__ | __Long Name__ |
|:----------------|:--------------------------------------------------|
| attr | Attribute |
| blk | Block |
| buf | Buffer |
| col | Column |
| count | Count |
| desc | Description |
| dir | Directory |
| fd | File descriptor (open) |
| fp | File pointer (fopen) |
| len | Length |
| lib | Library |
| mod | Module |
| nr | Number |
| parm | Parameter |
| path | File path |
| ptr | Pointer |
| rc | Return code |
| size | Size |
| src | Source |
| str | String |
| sym | Symbol |

View File

@@ -54,12 +54,5 @@ Submitting code
---------------
The preferred way is to create a github pull request for your code.
Coding guidelines
-----------------
For s390-tools the preferred language is C. We provide libraries, e.g. libutil
that should be used by all tools if possible.
The coding style is based on the Linux kernel guidelines. Therefore, use
the checkpatch tool [1] for verification before you submit a patch.
[1] https://github.com/torvalds/linux/blob/master/scripts/checkpatch.pl
Before you submit your code please consider our recommendations in the
[CODINGSTYLE](CODINGSTYLE.md) document.

View File

@@ -11,6 +11,7 @@ The package also contains the following files:
* [LICENSE](LICENSE): The MIT license that applies to this package
* [CHANGELOG](CHANGELOG.md): The history of s390-tools versions
* [AUTHORS](AUTHORS.md): A list of all authors of the s390-tools package
* [CODINGSTYLE](CODINGSTYLE.md): Recommendations for writing s390-tools code
Package contents
----------------