Define __get_user() and __put_user() for the LinuxKPI.

MFC after:	1 week
Sponsored by:	Mellanox Technologies
This commit is contained in:
Hans Petter Selasky 2016-01-26 14:21:30 +00:00
parent a65ef21558
commit 9f34efb9f4

View File

@ -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)))