diff options
author | Hauke Mehrtens <hauke@hauke-m.de> | 2011-07-24 14:17:58 +0000 |
---|---|---|
committer | Hauke Mehrtens <hauke@hauke-m.de> | 2011-07-24 14:17:58 +0000 |
commit | 00dd85d8f61db55d6e08d224ed30f077075e9766 (patch) | |
tree | 7cabb1d9085c88122c18b953a731e548953a544b /target/linux/generic/files/crypto/ocf/ocf-compat.h | |
parent | 8ecad9c51ad06d4eaa325e5a9f4c42adb4b4eecb (diff) | |
download | master-31e0f0ae-00dd85d8f61db55d6e08d224ed30f077075e9766.tar.gz master-31e0f0ae-00dd85d8f61db55d6e08d224ed30f077075e9766.tar.bz2 master-31e0f0ae-00dd85d8f61db55d6e08d224ed30f077075e9766.zip |
ocf-linux: version bump to 20110720
Fixes problem with TFM allocation in cryptosoft.c
Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
Hauke:
* remove ubsec_ssb package and take it from ocf-linux
* use patches from ocf-linux package
* refresh all patches
* readd some build fixes for OpenWrt.
* readd CRYPTO_MANAGER dependency
SVN-Revision: 27753
Diffstat (limited to 'target/linux/generic/files/crypto/ocf/ocf-compat.h')
-rw-r--r-- | target/linux/generic/files/crypto/ocf/ocf-compat.h | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/target/linux/generic/files/crypto/ocf/ocf-compat.h b/target/linux/generic/files/crypto/ocf/ocf-compat.h index 212f971239..2d985360f2 100644 --- a/target/linux/generic/files/crypto/ocf/ocf-compat.h +++ b/target/linux/generic/files/crypto/ocf/ocf-compat.h @@ -34,6 +34,11 @@ */ /****************************************************************************/ #ifdef __KERNEL__ +#include <linux/version.h> +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,38) && !defined(AUTOCONF_INCLUDED) +#include <linux/config.h> +#endif + /* * fake some BSD driver interface stuff specifically for OCF use */ @@ -288,6 +293,72 @@ static inline void *sg_virt(struct scatterlist *sg) #define late_initcall(init) module_init(init) #endif +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,4) || !defined(CONFIG_SMP) +#define ocf_for_each_cpu(cpu) for ((cpu) = 0; (cpu) == 0; (cpu)++) +#else +#define ocf_for_each_cpu(cpu) for_each_present_cpu(cpu) +#endif + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) +#include <linux/sched.h> +#define kill_proc(p,s,v) send_sig(s,find_task_by_vpid(p),0) +#endif + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,4) + +struct ocf_thread { + struct task_struct *task; + int (*func)(void *arg); + void *arg; +}; + +/* thread startup helper func */ +static inline int ocf_run_thread(void *arg) +{ + struct ocf_thread *t = (struct ocf_thread *) arg; + if (!t) + return -1; /* very bad */ + t->task = current; + daemonize(); + spin_lock_irq(¤t->sigmask_lock); + sigemptyset(¤t->blocked); + recalc_sigpending(current); + spin_unlock_irq(¤t->sigmask_lock); + return (*t->func)(t->arg); +} + +#define kthread_create(f,a,fmt...) \ + ({ \ + struct ocf_thread t; \ + pid_t p; \ + t.task = NULL; \ + t.func = (f); \ + t.arg = (a); \ + p = kernel_thread(ocf_run_thread, &t, CLONE_FS|CLONE_FILES); \ + while (p != (pid_t) -1 && t.task == NULL) \ + schedule(); \ + if (t.task) \ + snprintf(t.task->comm, sizeof(t.task->comm), fmt); \ + (t.task); \ + }) + +#define kthread_bind(t,cpu) /**/ + +#define kthread_should_stop() (strcmp(current->comm, "stopping") == 0) + +#define kthread_stop(t) \ + ({ \ + strcpy((t)->comm, "stopping"); \ + kill_proc((t)->pid, SIGTERM, 1); \ + do { \ + schedule(); \ + } while (kill_proc((t)->pid, SIGTERM, 1) == 0); \ + }) + +#else +#include <linux/kthread.h> +#endif + #endif /* __KERNEL__ */ /****************************************************************************/ |