git: e20c669d21fc - stable/13 - linux(4): To reuse MD linux.h hide kernel dependencies unde _KERNEL constraint

From: Dmitry Chagin <dchagin_at_FreeBSD.org>
Date: Wed, 06 Jul 2022 11:04:13 UTC
The branch stable/13 has been updated by dchagin:

URL: https://cgit.FreeBSD.org/src/commit/?id=e20c669d21fce0b323fdb07545761b98d86d933a

commit e20c669d21fce0b323fdb07545761b98d86d933a
Author:     Dmitry Chagin <dchagin@FreeBSD.org>
AuthorDate: 2022-06-22 11:28:24 +0000
Commit:     Dmitry Chagin <dchagin@FreeBSD.org>
CommitDate: 2022-07-06 11:02:15 +0000

    linux(4): To reuse MD linux.h hide kernel dependencies unde _KERNEL constraint
    
    MFC after:              2 weeks
    
    (cherry picked from commit d416ee86c73bef55ba29c25cd594156441f1daa9)
---
 sys/amd64/linux/linux.h   | 2 ++
 sys/amd64/linux32/linux.h | 4 ++++
 sys/arm64/linux/linux.h   | 2 ++
 3 files changed, 8 insertions(+)

diff --git a/sys/amd64/linux/linux.h b/sys/amd64/linux/linux.h
index 6f91e86255e2..c9e28f20ef94 100644
--- a/sys/amd64/linux/linux.h
+++ b/sys/amd64/linux/linux.h
@@ -319,6 +319,7 @@ struct linux_pt_regset {
 	l_ulong gs;
 };
 
+#ifdef _KERNEL
 struct reg;
 struct syscall_info;
 
@@ -330,5 +331,6 @@ void	linux_ptrace_get_syscall_info_machdep(const struct reg *reg,
 	    struct syscall_info *si);
 int	linux_ptrace_getregs_machdep(struct thread *td, pid_t pid,
 	    struct linux_pt_regset *l_regset);
+#endif /* _KERNEL */
 
 #endif /* !_AMD64_LINUX_H_ */
diff --git a/sys/amd64/linux32/linux.h b/sys/amd64/linux32/linux.h
index f8b72e060de4..7909c9c2081b 100644
--- a/sys/amd64/linux32/linux.h
+++ b/sys/amd64/linux32/linux.h
@@ -426,6 +426,7 @@ struct l_user_desc {
 #define	LINUX_GET_USEABLE(desc)		\
 	(((desc)->b >> LINUX_ENTRY_B_USEABLE) & 1)
 
+#ifdef _KERNEL
 struct iovec;
 struct uio;
 
@@ -439,6 +440,7 @@ int linux32_copyiniov(struct l_iovec32 *iovp32, l_ulong iovcnt,
 int linux32_copyinuio(struct l_iovec32 *iovp, l_ulong iovcnt,
 			    struct uio **uiop);
 int linux_copyout_rusage(struct rusage *ru, void *uaddr);
+#endif /* _KERNEL */
 
 /* robust futexes */
 struct linux_robust_list {
@@ -472,11 +474,13 @@ struct linux_pt_regset32 {
 	l_uint ss;
 };
 
+#ifdef _KERNEL
 struct reg32;
 
 void	bsd_to_linux_regset32(const struct reg32 *b_reg,
 	    struct linux_pt_regset32 *l_regset);
 
 extern bool linux32_emulate_i386;
+#endif /* _KERNEL */
 
 #endif /* !_AMD64_LINUX_H_ */
diff --git a/sys/arm64/linux/linux.h b/sys/arm64/linux/linux.h
index 9b78ac59f9dc..fe9c9b23e552 100644
--- a/sys/arm64/linux/linux.h
+++ b/sys/arm64/linux/linux.h
@@ -235,6 +235,7 @@ struct linux_pt_regset {
 	l_ulong cpsr;
 };
 
+#ifdef _KERNEL
 struct reg;
 struct syscall_info;
 
@@ -246,5 +247,6 @@ void	linux_ptrace_get_syscall_info_machdep(const struct reg *reg,
 	    struct syscall_info *si);
 int	linux_ptrace_getregs_machdep(struct thread *td, pid_t pid,
 	    struct linux_pt_regset *l_regset);
+#endif /* _KERNEL */
 
 #endif /* _ARM64_LINUX_H_ */