Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 11 Jun 2018 15:42:29 +0000 (UTC)
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r334953 - head/sys/compat/linuxkpi/common/include/asm
Message-ID:  <201806111542.w5BFgTdu028218@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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@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_ */



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