diff options
| author | Hans Petter Selasky <hselasky@FreeBSD.org> | 2017-02-21 12:43:02 +0000 |
|---|---|---|
| committer | Hans Petter Selasky <hselasky@FreeBSD.org> | 2017-02-21 12:43:02 +0000 |
| commit | 1e3db1de0cf6b904373e0f4c9e738b9713f3e17b (patch) | |
| tree | 9c3eb36eac0b6065dcb12dfdf875957ee7c51293 /sys/compat/linuxkpi/common/include/linux/compat.h | |
| parent | 27569d019d4edb44094fab5f2fa60ad2b8b03bb7 (diff) | |
Notes
Diffstat (limited to 'sys/compat/linuxkpi/common/include/linux/compat.h')
| -rw-r--r-- | sys/compat/linuxkpi/common/include/linux/compat.h | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/sys/compat/linuxkpi/common/include/linux/compat.h b/sys/compat/linuxkpi/common/include/linux/compat.h index 01b8a85b9760..62ea3363394b 100644 --- a/sys/compat/linuxkpi/common/include/linux/compat.h +++ b/sys/compat/linuxkpi/common/include/linux/compat.h @@ -2,7 +2,7 @@ * Copyright (c) 2010 Isilon Systems, Inc. * Copyright (c) 2010 iX Systems, Inc. * Copyright (c) 2010 Panasas, Inc. - * Copyright (c) 2013, 2014 Mellanox Technologies, Ltd. + * Copyright (c) 2013-2017 Mellanox Technologies, Ltd. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -31,10 +31,29 @@ #ifndef _LINUX_COMPAT_H_ #define _LINUX_COMPAT_H_ +#include <sys/param.h> +#include <sys/proc.h> +#include <sys/malloc.h> + struct thread; struct task_struct; -void linux_set_current(struct thread *td, struct task_struct *t); -void linux_clear_current(struct thread *td); +extern int linux_alloc_current(struct thread *, int flags); +extern void linux_free_current(struct task_struct *); + +static inline void +linux_set_current(struct thread *td) +{ + if (__predict_false(td->td_lkpi_task == NULL)) + linux_alloc_current(td, M_WAITOK); +} + +static inline int +linux_set_current_flags(struct thread *td, int flags) +{ + if (__predict_false(td->td_lkpi_task == NULL)) + return (linux_alloc_current(td, flags)); + return (0); +} #endif /* _LINUX_COMPAT_H_ */ |
