Skip to contentSkip to conversation

fs/ntfs3: Add ifndef + define to all header files

PATCH In review Kari Argillander 2 participants 2 messages Aug 16, 2021 – Aug 27, 2021 NTFS3 filesystem

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fs/ntfs3: Add ifndef + define to all header files

Add guards so that compiler will only include header files once.

---
I do not mind if this get's merged to V28/V29 without commit.

---
 fs/ntfs3/debug.h   | 5 +++++
 fs/ntfs3/ntfs.h    | 3 +++
 fs/ntfs3/ntfs_fs.h | 5 +++++
 3 files changed, 13 insertions(+)
fs/ntfs3/debug.h +5 -0
index dfaa4c79dc6d..465466631d38 100644
@@ -7,6 +7,9 @@
  */
 
 // clang-format off
+#ifndef _LINUX_NTFS3_DEBUG_H
+#define _LINUX_NTFS3_DEBUG_H
+
 #ifndef Add2Ptr
 #define Add2Ptr(P, I)		((void *)((u8 *)(P) + (I)))
 #define PtrOffset(B, O)		((size_t)((size_t)(O) - (size_t)(B)))
@@ -61,4 +64,6 @@ void ntfs_inode_printk(struct inode *inode, const char *fmt, ...)
 #define ntfs_free(p)		kfree(p)
 #define ntfs_vfree(p)		kvfree(p)
 #define ntfs_memdup(src, len)	kmemdup(src, len, GFP_NOFS)
+
+#endif /* _LINUX_NTFS3_DEBUG_H */
 // clang-format on
fs/ntfs3/ntfs.h +3 -0
index 40398e6c39c9..16da514af124 100644
@@ -7,6 +7,8 @@
  */
 
 // clang-format off
+#ifndef _LINUX_NTFS3_NTFS_H
+#define _LINUX_NTFS3_NTFS_H
 
 /* TODO:
  * - Check 4K mft record and 512 bytes cluster
@@ -1235,4 +1237,5 @@ struct SID {
 };
 static_assert(offsetof(struct SID, SubAuthority) == 8);
 
+#endif /* _LINUX_NTFS3_NTFS_H */
 // clang-format on
fs/ntfs3/ntfs_fs.h +5 -0
index 0c3ac89c3115..80e1dea2579a 100644
@@ -6,6 +6,9 @@
  */
 
 // clang-format off
+#ifndef _LINUX_NTFS3_NTFS_FS_H
+#define _LINUX_NTFS3_NTFS_FS_H
+
 #define MINUS_ONE_T			((size_t)(-1))
 /* Biggest MFT / smallest cluster */
 #define MAXIMUM_BYTES_PER_MFT		4096
@@ -1090,3 +1093,5 @@ static inline void le64_sub_cpu(__le64 *var, u64 val)
 {
 	*var = cpu_to_le64(le64_to_cpu(*var) - val);
 }
+
+#endif /* _LINUX_NTFS3_NTFS_FS_H */
Signature · 1 line
2.30.2
#1 lore raw
Quoted 78 lines

From: Kari Argillander <[email protected]>
Sent: Monday, August 16, 2021 3:02 PM
To: Konstantin Komarov <[email protected]>; [email protected]
Cc: Kari Argillander <[email protected]>; [email protected]
Subject: [PATCH] fs/ntfs3: Add ifndef + define to all header files

Add guards so that compiler will only include header files once.

---
I do not mind if this get's merged to V28/V29 without commit.

---
 fs/ntfs3/debug.h   | 5 +++++
 fs/ntfs3/ntfs.h    | 3 +++
 fs/ntfs3/ntfs_fs.h | 5 +++++
 3 files changed, 13 insertions(+)
fs/ntfs3/debug.h +5 -0
index dfaa4c79dc6d..465466631d38 100644
@@ -7,6 +7,9 @@
  */
 
 // clang-format off
+#ifndef _LINUX_NTFS3_DEBUG_H
+#define _LINUX_NTFS3_DEBUG_H
+
 #ifndef Add2Ptr
 #define Add2Ptr(P, I)		((void *)((u8 *)(P) + (I)))
 #define PtrOffset(B, O)		((size_t)((size_t)(O) - (size_t)(B)))
@@ -61,4 +64,6 @@ void ntfs_inode_printk(struct inode *inode, const char *fmt, ...)
 #define ntfs_free(p)		kfree(p)
 #define ntfs_vfree(p)		kvfree(p)
 #define ntfs_memdup(src, len)	kmemdup(src, len, GFP_NOFS)
+
+#endif /* _LINUX_NTFS3_DEBUG_H */
 // clang-format on
fs/ntfs3/ntfs.h +3 -0
index 40398e6c39c9..16da514af124 100644
@@ -7,6 +7,8 @@
  */
 
 // clang-format off
+#ifndef _LINUX_NTFS3_NTFS_H
+#define _LINUX_NTFS3_NTFS_H
 
 /* TODO:
  * - Check 4K mft record and 512 bytes cluster
@@ -1235,4 +1237,5 @@ struct SID {
 };
 static_assert(offsetof(struct SID, SubAuthority) == 8);
 
+#endif /* _LINUX_NTFS3_NTFS_H */
 // clang-format on
fs/ntfs3/ntfs_fs.h +5 -1
index 0c3ac89c3115..80e1dea2579a 100644
@@ -6,6 +6,9 @@
  */
 
 // clang-format off
+#ifndef _LINUX_NTFS3_NTFS_FS_H
+#define _LINUX_NTFS3_NTFS_FS_H
+
 #define MINUS_ONE_T			((size_t)(-1))
 /* Biggest MFT / smallest cluster */
 #define MAXIMUM_BYTES_PER_MFT		4096
@@ -1090,3 +1093,5 @@ static inline void le64_sub_cpu(__le64 *var, u64 val)
 {
 	*var = cpu_to_le64(le64_to_cpu(*var) - val);
 }
+
+#endif /* _LINUX_NTFS3_NTFS_FS_H */
--
Quoted 1 line

2.30.2

Thanks again - applied!

Best regards