svn commit: r294825 - head/sys/compat/linuxkpi/common/include/linux

Hans Petter Selasky hselasky at FreeBSD.org
Tue Jan 26 14:21:32 UTC 2016


Author: hselasky
Date: Tue Jan 26 14:21:30 2016
New Revision: 294825
URL: https://svnweb.freebsd.org/changeset/base/294825

Log:
  Define __get_user() and __put_user() for the LinuxKPI.
  
  MFC after:	1 week
  Sponsored by:	Mellanox Technologies

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

Modified: head/sys/compat/linuxkpi/common/include/linux/uaccess.h
==============================================================================
--- head/sys/compat/linuxkpi/common/include/linux/uaccess.h	Tue Jan 26 14:20:25 2016	(r294824)
+++ head/sys/compat/linuxkpi/common/include/linux/uaccess.h	Tue Jan 26 14:21:30 2016	(r294825)
@@ -2,7 +2,7 @@
  * Copyright (c) 2010 Isilon Systems, Inc.
  * Copyright (c) 2010 iX Systems, Inc.
  * Copyright (c) 2010 Panasas, Inc.
- * Copyright (c) 2013-2015 Mellanox Technologies, Ltd.
+ * Copyright (c) 2013-2016 Mellanox Technologies, Ltd.
  * Copyright (c) 2015 François Tigeot
  * All rights reserved.
  *
@@ -34,6 +34,17 @@
 
 #include <linux/compiler.h>
 
+#define	__get_user(_x, _p) ({				\
+	int __err;					\
+	__typeof(*(_p)) __x;				\
+	__err = -copyin((_p), &(__x), sizeof(*(_p)));	\
+	(_x) = __x;					\
+	__err;						\
+})
+#define	__put_user(_x, _p) ({			\
+	__typeof(*(_p)) __x = (_x);		\
+	-copyout(&(__x), (_p), sizeof(*(_p)));	\
+})
 #define	get_user(_x, _p)	-copyin((_p), &(_x), sizeof(*(_p)))
 #define	put_user(_x, _p)	-copyout(&(_x), (_p), sizeof(*(_p)))
 


More information about the svn-src-head mailing list