Coding/style guidelines for cryptsetup?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

What are the coding and style guidelines when you want to propose a patch to cryptsetup?

I don't quite get a clear picture from the source code for some things, and I couldn't find documentation on it inside the repo.
I can write a clang-format ruleset if I know the rules...

Here are some things I've noticed while reading the source code, and some remaining questions:

- mostly restricted to C90, e.g. variable declarations at top of functions; but there some use of C99 features like designators in array initializations
  -> do we have to declare variables at the top of functions?
  -> are // style comments allowed?
- would adding -pedantic in GCC be acceptable? (not sure how that would work in autotools)
- tabs are used for indentation
- unclear if spaces for alignment are OK
  -> tab == 8 spaces?
- how to indent when wrapping lines, e.g. for function parameters? 2 tabs? Align at ( with spaces?
  -> sometimes, function declarations put every parameter on its own line
- top-level declarations like functions and structs have { on new line, if/loops/etc inside functions have { on same line, else on same line as }, if/else without braces is allowed
- one space between if/while/for/.. and the (
- documentation of API via doxygen (@ style, not \ style)
- internal documentation via plain comments, no text on first line and all lines starting with aligned *
- max line length?
- the * for pointers binds to the variable name (void *p instead of void* p)
- multiple declarations in the same statement are allowed
- functions with external linkage have a prefix like LUKS2_
- types are not typedef'ed -> struct crypt_device instead of crypt_device_t
- there are file comments with copyright notices
  -> how to create a new file?


Thanks,
Robert
_______________________________________________
dm-crypt mailing list -- dm-crypt@xxxxxxxx
To unsubscribe send an email to dm-crypt-leave@xxxxxxxx



[Index of Archives]     [Device Mapper Devel]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite News]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux