Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F156936988
D15452.id43379.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
11 KB
Referenced Files
None
Subscribers
None
D15452.id43379.diff
View Options
Index: sys/compat/linuxkpi/common/include/asm/uaccess.h
===================================================================
--- sys/compat/linuxkpi/common/include/asm/uaccess.h
+++ sys/compat/linuxkpi/common/include/asm/uaccess.h
@@ -31,25 +31,32 @@
#ifndef _ASM_UACCESS_H_
#define _ASM_UACCESS_H_
-#include <linux/uaccess.h>
+/*
-static inline long
-copy_to_user(void *to, const void *from, unsigned long n)
-{
- if (linux_copyout(from, to, n) != 0)
- return n;
- return 0;
-}
-#define __copy_to_user(...) copy_to_user(__VA_ARGS__)
+Disable. Need __{get,put}_user_size() functions...
+Use defaults in linux/uaccess.h for now.
-static inline long
-copy_from_user(void *to, const void *from, unsigned long n)
-{
- if (linux_copyin(from, to, n) != 0)
- return n;
- return 0;
-}
-#define __copy_from_user(...) copy_from_user(__VA_ARGS__)
-#define __copy_in_user(...) copy_from_user(__VA_ARGS__)
+#define user_access_begin() stac()
+#define user_access_end() clac()
+
+#define unsafe_put_user(x, ptr, err_label) \
+ do { \
+ int __error; \
+ __typeof__(*(ptr)) __x = (x); \
+ __put_user_size(__x, (ptr), sizeof(*(ptr)), \
+ __error, -EFAULT); \
+ if (unlikely(__error)) goto err_label; \
+ } while (0)
+
+#define unsafe_get_user(x, ptr, err_label) \
+ do { \
+ int __error; \
+ __inttype(*(ptr)) __x; \
+ __get_user_size(__x, (ptr), sizeof(*(ptr)), \
+ __error, -EFAULT); \
+ (x) = (__force __typeof__(*(ptr)))__x; \
+ if (unlikely(__error)) goto err_label; \
+ } while (0)
+*/
#endif /* _ASM_UACCESS_H_ */
Index: sys/compat/linuxkpi/common/include/linux/compiler.h
===================================================================
--- sys/compat/linuxkpi/common/include/linux/compiler.h
+++ sys/compat/linuxkpi/common/include/linux/compiler.h
@@ -34,6 +34,10 @@
#include <sys/cdefs.h>
+#ifndef __LinuxKPI_version
+#define __LinuxKPI_version 40009
+#endif
+
#define __user
#define __kernel
#define __safe
Index: sys/compat/linuxkpi/common/include/linux/device.h
===================================================================
--- sys/compat/linuxkpi/common/include/linux/device.h
+++ sys/compat/linuxkpi/common/include/linux/device.h
@@ -461,6 +461,12 @@
device_unregister(device_get_softc(bsddev));
}
+static inline void
+dev_pm_set_driver_flags(struct device *dev, u32 flags)
+{
+ printf("%s: missing implementation\n", __func__);
+}
+
static inline void
linux_class_kfree(struct class *class)
{
Index: sys/compat/linuxkpi/common/include/linux/export.h
===================================================================
--- /dev/null
+++ sys/compat/linuxkpi/common/include/linux/export.h
@@ -0,0 +1,34 @@
+/*-
+ * Copyright (c) 2018 Johannes Lundberg <johalun0@gmail.com>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice unmodified, this list of conditions, and the following
+ * disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+#ifndef _LINUX_EXPORT_H
+#define _LINUX_EXPORT_H
+
+#define NR_IRQS 512 /* XXX Need correct value */
+#define EXPORT_SYMBOL(name)
+#define EXPORT_SYMBOL_GPL(name)
+
+#endif
Index: sys/compat/linuxkpi/common/include/linux/kernel.h
===================================================================
--- sys/compat/linuxkpi/common/include/linux/kernel.h
+++ sys/compat/linuxkpi/common/include/linux/kernel.h
@@ -88,7 +88,9 @@
#define BUILD_BUG() do { CTASSERT(0); } while (0)
#define BUILD_BUG_ON(x) CTASSERT(!(x))
+#ifndef BUILD_BUG_ON_MSG
#define BUILD_BUG_ON_MSG(x, msg) BUILD_BUG_ON(x)
+#endif
#define BUILD_BUG_ON_NOT_POWER_OF_2(x) BUILD_BUG_ON(!powerof2(x))
#define BUILD_BUG_ON_INVALID(expr) while (0) { (void)(expr); }
@@ -372,6 +374,56 @@
return (0);
}
+static inline int
+kstrtobool(const char *s, bool *res)
+{
+ if (!s)
+ return -EINVAL;
+
+ switch (s[0]) {
+ case 'y':
+ case 'Y':
+ case '1':
+ *res = true;
+ return 0;
+ case 'n':
+ case 'N':
+ case '0':
+ *res = false;
+ return 0;
+ case 'o':
+ case 'O':
+ switch (s[1]) {
+ case 'n':
+ case 'N':
+ *res = true;
+ return 0;
+ case 'f':
+ case 'F':
+ *res = false;
+ return 0;
+ default:
+ break;
+ }
+ default:
+ break;
+ }
+
+ return -EINVAL;
+}
+
+static inline int
+kstrtobool_from_user(const char __user *s, size_t count, bool *res)
+{
+ char buf[4];
+
+ count = min(count, sizeof(buf) - 1);
+ if (copy_from_user(buf, s, count))
+ return -EFAULT;
+ buf[count] = '\0';
+ return kstrtobool(buf, res);
+}
+
#define min(x, y) ((x) < (y) ? (x) : (y))
#define max(x, y) ((x) > (y) ? (x) : (y))
Index: sys/compat/linuxkpi/common/include/linux/ktime.h
===================================================================
--- sys/compat/linuxkpi/common/include/linux/ktime.h
+++ sys/compat/linuxkpi/common/include/linux/ktime.h
@@ -159,6 +159,7 @@
}
#define ktime_to_timespec(kt) ns_to_timespec(kt)
+#define ktime_to_timespec64(kt) ns_to_timespec(kt)
#define ktime_to_timeval(kt) ns_to_timeval(kt)
#define ktime_to_ns(kt) (kt)
Index: sys/compat/linuxkpi/common/include/linux/mmu_context.h
===================================================================
--- /dev/null
+++ sys/compat/linuxkpi/common/include/linux/mmu_context.h
@@ -0,0 +1,20 @@
+#ifndef _LINUX_MMU_CONTEXT_H
+#define _LINUX_MMU_CONTEXT_H
+
+struct mm_struct;
+
+static inline void
+use_mm(struct mm_struct *mm)
+{
+
+ printf("%s: missing implementation!\n", __func__);
+}
+
+static inline void
+unuse_mm(struct mm_struct *mm)
+{
+
+ printf("%s: missing implementation!\n", __func__);
+}
+
+#endif
Index: sys/compat/linuxkpi/common/include/linux/module.h
===================================================================
--- sys/compat/linuxkpi/common/include/linux/module.h
+++ sys/compat/linuxkpi/common/include/linux/module.h
@@ -42,6 +42,7 @@
#include <linux/sysfs.h>
#include <linux/moduleparam.h>
#include <linux/slab.h>
+#include <linux/export.h>
#define MODULE_AUTHOR(name)
#define MODULE_DESCRIPTION(name)
@@ -51,8 +52,6 @@
#define THIS_MODULE ((struct module *)0)
-#define EXPORT_SYMBOL(name)
-#define EXPORT_SYMBOL_GPL(name)
#define __MODULE_STRING(x) __stringify(x)
/* OFED pre-module initialization */
Index: sys/compat/linuxkpi/common/include/linux/slab.h
===================================================================
--- sys/compat/linuxkpi/common/include/linux/slab.h
+++ sys/compat/linuxkpi/common/include/linux/slab.h
@@ -85,6 +85,8 @@
#define SLAB_DESTROY_BY_RCU \
SLAB_TYPESAFE_BY_RCU
+#define ARCH_KMALLOC_MINALIGN __alignof__(unsigned long long)
+
static inline gfp_t
linux_check_m_flags(gfp_t flags)
{
Index: sys/compat/linuxkpi/common/include/linux/time.h
===================================================================
--- sys/compat/linuxkpi/common/include/linux/time.h
+++ sys/compat/linuxkpi/common/include/linux/time.h
@@ -38,6 +38,8 @@
#include <sys/time.h>
#include <sys/stdint.h>
+#define timespec64 timespec
+
static inline struct timeval
ns_to_timeval(const int64_t nsec)
{
Index: sys/compat/linuxkpi/common/include/linux/timer.h
===================================================================
--- sys/compat/linuxkpi/common/include/linux/timer.h
+++ sys/compat/linuxkpi/common/include/linux/timer.h
@@ -64,7 +64,7 @@
#define setup_timer(timer, func, dat) do { \
(timer)->function = (func); \
(timer)->data = (dat); \
- callout_init(&(timer)->callout, 1); \
+ callout_init(&(timer)->callout, 1); \
} while (0)
#define __setup_timer(timer, func, dat, flags) do { \
@@ -75,7 +75,7 @@
#define init_timer(timer) do { \
(timer)->function = NULL; \
(timer)->data = 0; \
- callout_init(&(timer)->callout, 1); \
+ callout_init(&(timer)->callout, 1); \
} while (0)
extern void mod_timer(struct timer_list *, int);
Index: sys/compat/linuxkpi/common/include/linux/uaccess.h
===================================================================
--- sys/compat/linuxkpi/common/include/linux/uaccess.h
+++ sys/compat/linuxkpi/common/include/linux/uaccess.h
@@ -42,6 +42,8 @@
#include <linux/compiler.h>
+#include <asm/uaccess.h>
+
#define VERIFY_READ VM_PROT_READ
#define VERIFY_WRITE VM_PROT_WRITE
@@ -67,6 +69,25 @@
extern size_t linux_clear_user(void *uaddr, size_t len);
extern int linux_access_ok(int rw, const void *uaddr, size_t len);
+static inline long
+copy_to_user(void *to, const void *from, unsigned long n)
+{
+ if (linux_copyout(from, to, n) != 0)
+ return n;
+ return 0;
+}
+#define __copy_to_user(...) copy_to_user(__VA_ARGS__)
+
+static inline long
+copy_from_user(void *to, const void *from, unsigned long n)
+{
+ if (linux_copyin(from, to, n) != 0)
+ return n;
+ return 0;
+}
+#define __copy_from_user(...) copy_from_user(__VA_ARGS__)
+#define __copy_in_user(...) copy_from_user(__VA_ARGS__)
+
/*
* NOTE: Each pagefault_disable() call must have a corresponding
* pagefault_enable() call in the same scope. The former creates a new
@@ -88,4 +109,20 @@
return ((curthread->td_pflags & TDP_NOFAULTING) != 0);
}
+#ifndef user_access_begin
+#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
+
#endif /* _LINUX_UACCESS_H_ */
Index: sys/compat/linuxkpi/common/include/linux/wait.h
===================================================================
--- sys/compat/linuxkpi/common/include/linux/wait.h
+++ sys/compat/linuxkpi/common/include/linux/wait.h
@@ -59,7 +59,6 @@
typedef struct wait_queue wait_queue_t;
typedef struct wait_queue_entry wait_queue_entry_t;
typedef struct wait_queue_head wait_queue_head_t;
-
typedef int wait_queue_func_t(wait_queue_t *, unsigned int, int, void *);
/*
Index: sys/compat/linuxkpi/common/include/linux/ww_mutex.h
===================================================================
--- sys/compat/linuxkpi/common/include/linux/ww_mutex.h
+++ sys/compat/linuxkpi/common/include/linux/ww_mutex.h
@@ -35,6 +35,8 @@
#include <linux/mutex.h>
+struct task_struct;
+
struct ww_class {
const char *mutex_name;
};
@@ -44,6 +46,7 @@
struct ww_mutex {
struct mutex base;
+ struct ww_acquire_ctx *ctx;
struct cv condvar;
};
@@ -120,6 +123,7 @@
static inline void
ww_acquire_init(struct ww_acquire_ctx *ctx, struct ww_class *ww_class)
{
+ /* NOP is deliberate */
}
static inline void
@@ -132,11 +136,13 @@
static inline void
ww_acquire_fini(struct ww_acquire_ctx *ctx)
{
+ /* NOP is deliberate */
}
static inline void
ww_acquire_done(struct ww_acquire_ctx *ctx)
{
+ /* NOP is deliberate */
}
#endif /* _LINUX_WW_MUTEX_H_ */
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, May 18, 12:00 PM (19 h, 12 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
33247325
Default Alt Text
D15452.id43379.diff (11 KB)
Attached To
Mode
D15452: Update LinuxKPI to 4.15
Attached
Detach File
Event Timeline
Log In to Comment