This section explains which format should be followed by header
inclusion guards via a drop-down list of rules.

No functional change.

Signed-off-by: Alessandro Zucchelli <alessandro.zucche...@bugseng.com>

---
Changes in v6:
- edit inclusion guards naming conventions, including more details
Changes in v5:
- edit inclusion guards naming conventions, according to feedback
  received

Note:
This patch is part of a 17-element patch series, which can be found at
the following link:
https://lore.kernel.org/xen-devel/cover.1721720583.git.alessandro.zucche...@bugseng.com/
Since this is the only patch that required revision, and as requested by
the maintainers, it is now submitted as a standalone patch.
---
 CODING_STYLE | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/CODING_STYLE b/CODING_STYLE
index 7f6e9ad065..711f6811f8 100644
--- a/CODING_STYLE
+++ b/CODING_STYLE
@@ -159,6 +159,34 @@ Emacs local variables
 A comment block containing local variables for emacs is permitted at
 the end of files.  It should be:
 
+Header inclusion guards
+-----------------------
+
+Unless otherwise specified, all header files should include proper
+guards to prevent multiple inclusions. The following naming conventions
+apply:
+
+- Private headers: <dir>__<filename>_H
+    - arch/arm/arm64/lib/something.h -> ARM__ARM64__LIB__SOMETHING_H
+    - arch/arm/arm32/lib/something.h -> ARM__ARM32__LIB__SOMETHING_H
+    - arch/x86/lib/something.h -> X86__LIB__SOMETHING_H
+
+- asm-generic headers: ASM_GENERIC__<filename>_H
+    - include/asm-generic/something.h -> ASM_GENERIC__SOMETHING_H
+
+- arch-specific headers: ASM__<architecture>__<subdir>__<filename>_H
+    - arch/x86/include/asm/something.h -> ASM__X86__SOMETHING_H
+
+- Xen headers: XEN__<filename>_H
+    - include/xen/something.h -> XEN__SOMETHING_H
+
+Notes:
+
+- Filenames and directories are converted to uppercase.
+- Non-alphanumeric characters are converted to underscores.
+- Directories, subdirectories, and filenames are separated by double
+  underscores.
+
 /*
  * Local variables:
  * mode: C
-- 
2.34.1


Reply via email to