aboutsummaryrefslogtreecommitdiff
path: root/sys/compat
diff options
context:
space:
mode:
authorJohannes Lundberg <johalun@FreeBSD.org>2019-05-16 17:44:17 +0000
committerJohannes Lundberg <johalun@FreeBSD.org>2019-05-16 17:44:17 +0000
commit47e2723ad727c1952492dc018246ab39a6f0f5fe (patch)
treea43397956889f99a97cf907a9c573f4b2d94c3b6 /sys/compat
parentb961c0f2442979d7a611964adb729188c90e5203 (diff)
downloadsrc-47e2723ad727c1952492dc018246ab39a6f0f5fe.tar.gz
src-47e2723ad727c1952492dc018246ab39a6f0f5fe.zip
LinuxKPI: Update access_ok macro for v5.0.
Check LINUXKPI_VERSION macro for backwards compatibility. It's recommended to update any drivers that depend on the older KPI so we can deprecate < 5.0 code as we update to newer Linux version. This patch is part of D19565 Reviewed by: hps Approved by: imp (mentor), hps MFC after: 1 week
Notes
Notes: svn path=/head/; revision=347837
Diffstat (limited to 'sys/compat')
-rw-r--r--sys/compat/linuxkpi/common/include/linux/uaccess.h9
-rw-r--r--sys/compat/linuxkpi/common/src/linux_compat.c2
2 files changed, 8 insertions, 3 deletions
diff --git a/sys/compat/linuxkpi/common/include/linux/uaccess.h b/sys/compat/linuxkpi/common/include/linux/uaccess.h
index a69e9cc1e8c8..c09c363a98a7 100644
--- a/sys/compat/linuxkpi/common/include/linux/uaccess.h
+++ b/sys/compat/linuxkpi/common/include/linux/uaccess.h
@@ -60,12 +60,17 @@
#define get_user(_x, _p) linux_copyin((_p), &(_x), sizeof(*(_p)))
#define put_user(_x, _p) __put_user(_x, _p)
#define clear_user(...) linux_clear_user(__VA_ARGS__)
-#define access_ok(...) linux_access_ok(__VA_ARGS__)
+
+#if defined(LINUXKPI_VERSION) && LINUXKPI_VERSION >= 50000
+#define access_ok(a,b) linux_access_ok(a,b)
+#else
+#define access_ok(a,b,c) linux_access_ok(b,c)
+#endif
extern int linux_copyin(const void *uaddr, void *kaddr, size_t len);
extern int linux_copyout(const void *kaddr, void *uaddr, size_t len);
extern size_t linux_clear_user(void *uaddr, size_t len);
-extern int linux_access_ok(int rw, const void *uaddr, size_t len);
+extern int linux_access_ok(const void *uaddr, size_t len);
/*
* NOTE: Each pagefault_disable() call must have a corresponding
diff --git a/sys/compat/linuxkpi/common/src/linux_compat.c b/sys/compat/linuxkpi/common/src/linux_compat.c
index 291318747e1e..b7c1cc36b8d6 100644
--- a/sys/compat/linuxkpi/common/src/linux_compat.c
+++ b/sys/compat/linuxkpi/common/src/linux_compat.c
@@ -897,7 +897,7 @@ linux_clear_user(void *_uaddr, size_t _len)
}
int
-linux_access_ok(int rw, const void *uaddr, size_t len)
+linux_access_ok(const void *uaddr, size_t len)
{
uintptr_t saddr;
uintptr_t eaddr;