mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-16 19:47:55 +00:00
[PATCH] kthread: convert smbiod
Update smbiod to use kthread instead of deprecated kernel_thread. [akpm@osdl.org: cleanup] Signed-off-by: Serge E. Hallyn <serue@us.ibm.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
parent
c7b2eff059
commit
fa366ad5d7
1 changed files with 17 additions and 9 deletions
|
@ -20,6 +20,7 @@
|
||||||
#include <linux/smp_lock.h>
|
#include <linux/smp_lock.h>
|
||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
#include <linux/net.h>
|
#include <linux/net.h>
|
||||||
|
#include <linux/kthread.h>
|
||||||
#include <net/ip.h>
|
#include <net/ip.h>
|
||||||
|
|
||||||
#include <linux/smb_fs.h>
|
#include <linux/smb_fs.h>
|
||||||
|
@ -40,7 +41,7 @@ enum smbiod_state {
|
||||||
};
|
};
|
||||||
|
|
||||||
static enum smbiod_state smbiod_state = SMBIOD_DEAD;
|
static enum smbiod_state smbiod_state = SMBIOD_DEAD;
|
||||||
static pid_t smbiod_pid;
|
static struct task_struct *smbiod_thread;
|
||||||
static DECLARE_WAIT_QUEUE_HEAD(smbiod_wait);
|
static DECLARE_WAIT_QUEUE_HEAD(smbiod_wait);
|
||||||
static LIST_HEAD(smb_servers);
|
static LIST_HEAD(smb_servers);
|
||||||
static DEFINE_SPINLOCK(servers_lock);
|
static DEFINE_SPINLOCK(servers_lock);
|
||||||
|
@ -67,20 +68,29 @@ void smbiod_wake_up(void)
|
||||||
*/
|
*/
|
||||||
static int smbiod_start(void)
|
static int smbiod_start(void)
|
||||||
{
|
{
|
||||||
pid_t pid;
|
struct task_struct *tsk;
|
||||||
|
int err = 0;
|
||||||
|
|
||||||
if (smbiod_state != SMBIOD_DEAD)
|
if (smbiod_state != SMBIOD_DEAD)
|
||||||
return 0;
|
return 0;
|
||||||
smbiod_state = SMBIOD_STARTING;
|
smbiod_state = SMBIOD_STARTING;
|
||||||
__module_get(THIS_MODULE);
|
__module_get(THIS_MODULE);
|
||||||
spin_unlock(&servers_lock);
|
spin_unlock(&servers_lock);
|
||||||
pid = kernel_thread(smbiod, NULL, 0);
|
tsk = kthread_run(smbiod, NULL, "smbiod");
|
||||||
if (pid < 0)
|
if (IS_ERR(tsk)) {
|
||||||
|
err = PTR_ERR(tsk);
|
||||||
module_put(THIS_MODULE);
|
module_put(THIS_MODULE);
|
||||||
|
}
|
||||||
|
|
||||||
spin_lock(&servers_lock);
|
spin_lock(&servers_lock);
|
||||||
smbiod_state = pid < 0 ? SMBIOD_DEAD : SMBIOD_RUNNING;
|
if (err < 0) {
|
||||||
smbiod_pid = pid;
|
smbiod_state = SMBIOD_DEAD;
|
||||||
return pid;
|
smbiod_thread = NULL;
|
||||||
|
} else {
|
||||||
|
smbiod_state = SMBIOD_RUNNING;
|
||||||
|
smbiod_thread = tsk;
|
||||||
|
}
|
||||||
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -290,8 +300,6 @@ out:
|
||||||
*/
|
*/
|
||||||
static int smbiod(void *unused)
|
static int smbiod(void *unused)
|
||||||
{
|
{
|
||||||
daemonize("smbiod");
|
|
||||||
|
|
||||||
allow_signal(SIGKILL);
|
allow_signal(SIGKILL);
|
||||||
|
|
||||||
VERBOSE("SMB Kernel thread starting (%d) ...\n", current->pid);
|
VERBOSE("SMB Kernel thread starting (%d) ...\n", current->pid);
|
||||||
|
|
Loading…
Add table
Reference in a new issue