Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 26 Jan 2016 14:21:31 +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: r294825 - head/sys/compat/linuxkpi/common/include/linux
Message-ID:  <201601261421.u0QELVcm044213@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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)))
 



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