[11/16] kni: add define guards to avoid multi-inclusion

Message ID tencent_93CC9E464690EBA87DE78E848988C4FCF10A@qq.com (mailing list archive)
State Superseded, archived
Headers
Series [01/16] bus/dpaa: add define guards to avoid multiple inclusion |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Weiguo Li Feb. 6, 2022, 3:58 a.m. UTC
  Supplement define guards to prevent multiple inclusion.

Signed-off-by: Weiguo Li <liwg06@foxmail.com>
---
 kernel/linux/kni/compat.h | 5 +++++
 lib/kni/rte_kni_fifo.h    | 5 ++++-
 2 files changed, 9 insertions(+), 1 deletion(-)
  

Patch

diff --git a/kernel/linux/kni/compat.h b/kernel/linux/kni/compat.h
index 664785674f..0879a7666e 100644
--- a/kernel/linux/kni/compat.h
+++ b/kernel/linux/kni/compat.h
@@ -3,6 +3,9 @@ 
  * Minimal wrappers to allow compiling kni on older kernels.
  */
 
+#ifndef _KNI_COMPAT_H_
+#define _KNI_COMPAT_H_
+
 #include <linux/version.h>
 
 #ifndef RHEL_RELEASE_VERSION
@@ -141,3 +144,5 @@ 
 #if KERNEL_VERSION(5, 9, 0) > LINUX_VERSION_CODE
 #define HAVE_TSK_IN_GUP
 #endif
+
+#endif /* _KNI_COMPAT_H_ */
diff --git a/lib/kni/rte_kni_fifo.h b/lib/kni/rte_kni_fifo.h
index d2ec82fe87..73d70c9bda 100644
--- a/lib/kni/rte_kni_fifo.h
+++ b/lib/kni/rte_kni_fifo.h
@@ -2,7 +2,8 @@ 
  * Copyright(c) 2010-2014 Intel Corporation
  */
 
-
+#ifndef _RTE_KNI_FIFO_H_
+#define _RTE_KNI_FIFO_H_
 
 /**
  * @internal when c11 memory model enabled use c11 atomic memory barrier.
@@ -115,3 +116,5 @@  kni_fifo_free_count(struct rte_kni_fifo *fifo)
 	uint32_t fifo_read = __KNI_LOAD_ACQUIRE(&fifo->read);
 	return (fifo_read - fifo_write - 1) & (fifo->len - 1);
 }
+
+#endif /* _RTE_KNI_FIFO_H_ */