svn commit: r334953 - head/sys/compat/linuxkpi/common/include/asm

Hans Petter Selasky hselasky at FreeBSD.org
Mon Jun 11 15:42:30 UTC 2018


Author: hselasky
Date: Mon Jun 11 15:42:29 2018
New Revision: 334953
URL: https://svnweb.freebsd.org/changeset/base/334953

Log:
  Implement the user_access_begin(), user_access_end(), usafe_get_user() and
  unsafe_put_user() function macros in the LinuxKPI.
  
  Submitted by:	Johannes Lundberg <johalun0 at gmail.com>
  MFC after:	1 week
  Sponsored by:	Mellanox Technologies
  Sponsored by:	Limelight Networks

Modified:
  head/sys/compat/linuxkpi/common/include/asm/uaccess.h

Modified: head/sys/compat/linuxkpi/common/include/asm/uaccess.h
==============================================================================
--- head/sys/compat/linuxkpi/common/include/asm/uaccess.h	Mon Jun 11 15:28:20 2018	(r334952)
+++ head/sys/compat/linuxkpi/common/include/asm/uaccess.h	Mon Jun 11 15:42:29 2018	(r334953)
@@ -52,4 +52,17 @@ copy_from_user(void *to, const void *from, unsigned lo
 #define	__copy_from_user(...)	copy_from_user(__VA_ARGS__)
 #define	__copy_in_user(...)	copy_from_user(__VA_ARGS__)
 
+#define	user_access_begin() do { } while (0)
+#define	user_access_end() do { } while (0)
+
+#define	unsafe_get_user(x, ptr, err) do { \
+	if (unlikely(__get_user(x, ptr))) \
+		goto err; \
+} while (0)
+
+#define	unsafe_put_user(x, ptr, err) do { \
+	if (unlikely(__put_user(x, ptr))) \
+		goto err; \
+} while (0)
+
 #endif	/* _ASM_UACCESS_H_ */


More information about the svn-src-head mailing list