Lustre Style Guide Includes
Jump to navigation
Jump to search
When adding new #include files
Includes should be ordered in the following way:
- Linux kernel headers (
<linux/...>) - kernel compatibility headers (
<lustre_compat/...>) - libcfs and LNet headers (
<linux/libcfs/...>,<linux/lnet/...>) - Lustre UAPI headers (
<uapi/linux/lustre/...>) - Lustre headers in
lustre/include/
Each group shall be sorted alphanumerically when new headers are added, but existing include blocks do not need to be reordered just to sort them, and a real dependency between headers takes precedence over the sort order.
The rationale for this is that Lustre is a strict superset of LNet functionality so there shouldn't be any LNet code that depends on Lustre headers, and Lustre headers should not override or otherwise conflict with kernel headers. Sorting alphabetically makes it easier to avoid duplicate header include and reduces the chance of patch conflicts if new headers are added at the end in separate patches.