Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 7 May 2009 10:01:05 +0000 (UTC)
From:      Dmitry Chagin <dchagin@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r191877 - in head/sys: compat/linux modules/linux
Message-ID:  <200905071001.n47A15Rj048560@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dchagin
Date: Thu May  7 10:01:05 2009
New Revision: 191877
URL: http://svn.freebsd.org/changeset/base/191877

Log:
  Add preliminary KTR(9) support to the linux emulation layer.
  
  Approved by:	kib (mentor)
  MFC after:	1 month

Modified:
  head/sys/compat/linux/linux_mib.c
  head/sys/compat/linux/linux_util.h
  head/sys/modules/linux/Makefile

Modified: head/sys/compat/linux/linux_mib.c
==============================================================================
--- head/sys/compat/linux/linux_mib.c	Thu May  7 09:39:20 2009	(r191876)
+++ head/sys/compat/linux/linux_mib.c	Thu May  7 10:01:05 2009	(r191877)
@@ -318,7 +318,7 @@ linux_set_oss_version(struct thread *td,
 	return (0);
 }
 
-#ifdef DEBUG
+#if defined(DEBUG) || defined(KTR)
 
 u_char linux_debug_map[howmany(LINUX_SYS_MAXSYSCALL, sizeof(u_char))];
 
@@ -377,4 +377,4 @@ SYSCTL_PROC(_compat_linux, OID_AUTO, deb
             0, 0, linux_sysctl_debug, "A",
             "Linux debugging control");
 
-#endif /* DEBUG */
+#endif /* DEBUG || KTR */

Modified: head/sys/compat/linux/linux_util.h
==============================================================================
--- head/sys/compat/linux/linux_util.h	Thu May  7 09:39:20 2009	(r191876)
+++ head/sys/compat/linux/linux_util.h	Thu May  7 10:01:05 2009	(r191877)
@@ -106,4 +106,33 @@ int	linux_driver_get_major_minor(char *n
 char	*linux_get_char_devices(void);
 void	linux_free_get_char_devices(char *string);
 
+#if defined(KTR)
+
+#define	KTR_LINUX				KTR_SUBSYS
+#define	LINUX_CTRFMT(nm, fmt)	#nm"("fmt")"
+
+#define	LINUX_CTR6(f, m, p1, p2, p3, p4, p5, p6) do {			\
+	if (ldebug(f))							\
+		CTR6(KTR_LINUX, LINUX_CTRFMT(f, m),			\
+		    p1, p2, p3, p4, p5, p6);				\
+} while (0)
+
+#define	LINUX_CTR(f)			LINUX_CTR6(f, "", 0, 0, 0, 0, 0, 0)
+#define	LINUX_CTR0(f, m)		LINUX_CTR6(f, m, 0, 0, 0, 0, 0, 0)
+#define	LINUX_CTR1(f, m, p1)		LINUX_CTR6(f, m, p1, 0, 0, 0, 0, 0)
+#define	LINUX_CTR2(f, m, p1, p2)	LINUX_CTR6(f, m, p1, p2, 0, 0, 0, 0)
+#define	LINUX_CTR3(f, m, p1, p2, p3)	LINUX_CTR6(f, m, p1, p2, p3, 0, 0, 0)
+#define	LINUX_CTR4(f, m, p1, p2, p3, p4)	LINUX_CTR6(f, m, p1, p2, p3, p4, 0, 0)
+#define	LINUX_CTR5(f, m, p1, p2, p3, p4, p5)	LINUX_CTR6(f, m, p1, p2, p3, p4, p5, 0)
+#else
+#define	LINUX_CTR(f)
+#define	LINUX_CTR0(f, m)
+#define	LINUX_CTR1(f, m, p1)
+#define	LINUX_CTR2(f, m, p1, p2)
+#define	LINUX_CTR3(f, m, p1, p2, p3)
+#define	LINUX_CTR4(f, m, p1, p2, p3, p4)
+#define	LINUX_CTR5(f, m, p1, p2, p3, p4, p5)
+#define	LINUX_CTR6(f, m, p1, p2, p3, p4, p5, p6)
+#endif
+
 #endif /* !_LINUX_UTIL_H_ */

Modified: head/sys/modules/linux/Makefile
==============================================================================
--- head/sys/modules/linux/Makefile	Thu May  7 09:39:20 2009	(r191876)
+++ head/sys/modules/linux/Makefile	Thu May  7 10:01:05 2009	(r191877)
@@ -55,6 +55,9 @@ linux${SFX}_genassym.o: linux${SFX}_gena
 .if !defined(KERNBUILDDIR)
 opt_inet6.h:
 	echo "#define INET6 1" > ${.TARGET}
+.if defined(KTR)
+CFLAGS+=	-DKTR
+.endif
 .endif
 
 .include <bsd.kmod.mk>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200905071001.n47A15Rj048560>