Re: [Ocf-linux-users] ocf/random.c uses kernel_thread symbol no longer exported
Brought to you by:
david-m
|
From: Russell S. <ru...@pe...> - 2013-02-07 10:33:14
|
>>>>> "David" == David McCullough <uc...@gm...> writes:
David> Russell Senior wrote the following:
>> This past autumn, the long-advertised removal of
>> EXPORT_SYMBOL(kernel_thread) finally occurred. Linux 3.7.x no
>> longer exports the symbol, which causes ocf/random.c to not build.
>> Needs converting to kthread_$foo.
David> Thanksd for the update, will look into that as soon as I get
David> time, for now if you are stuck just turn off the OCF random
David> option,
I'm sure this is both horrid and ignorant, but I hacked at it enough
to compile. This is what got commited in OpenWrt. Possibly it will
kernel panic if the instruction pointer wanders too nearby:
Index: ocf/random.c
===================================================================
--- a/ocf/random.c
+++ b/ocf/random.c
@@ -50,4 +50,5 @@
#include <linux/poll.h>
#include <linux/random.h>
+#include <linux/kthread.h>
#include <cryptodev.h>
@@ -80,7 +81,7 @@
};
+static struct task_struct *random_thread;
static int random_proc(void *arg);
-static pid_t randomproc = (pid_t) -1;
static spinlock_t random_lock;
@@ -142,10 +143,8 @@
list_add_tail(&rops->random_list, &random_ops);
if (!started) {
- randomproc = kernel_thread(random_proc, NULL, CLONE_FS|CLONE_FILES);
- if (randomproc < 0) {
- ret = randomproc;
- printk("crypto: crypto_rregister cannot start random thread; "
- "error %d", ret);
- } else
+ random_thread = kthread_run(random_proc, NULL, "ocf-random");
+ if (IS_ERR(random_thread))
+ ret = PTR_ERR(random_thread);
+ else
started = 1;
}
@@ -173,5 +172,5 @@
spin_lock_irqsave(&random_lock, flags);
if (list_empty(&random_ops) && started)
- kill_proc(randomproc, SIGKILL, 1);
+ kthread_stop(random_thread);
spin_unlock_irqrestore(&random_lock, flags);
return(0);
@@ -204,5 +203,4 @@
#else
daemonize("ocf-random");
- allow_signal(SIGKILL);
#endif
@@ -307,10 +305,9 @@
}
}
-
+
kfree(buf);
bad_alloc:
spin_lock_irq(&random_lock);
- randomproc = (pid_t) -1;
started = 0;
spin_unlock_irq(&random_lock);
--
Russell Senior, President
ru...@pe...
|