diff options
author | Serge E. Hallyn <serue@us.ibm.com> | 2006-06-25 08:49:00 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-06-25 13:01:21 -0400 |
commit | fa366ad5d7fe05abaae44a1cd216348669e42ef8 (patch) | |
tree | 5c4bf3a48dca37d139b8ec16b6d3b71ee6a76abe | |
parent | c7b2eff059fcc2d1b7085ee3d84b79fd657a537b (diff) |
[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>
-rw-r--r-- | fs/smbfs/smbiod.c | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/fs/smbfs/smbiod.c b/fs/smbfs/smbiod.c index 481a97a423fa..3f71384020cb 100644 --- a/fs/smbfs/smbiod.c +++ b/fs/smbfs/smbiod.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <linux/smp_lock.h> | 20 | #include <linux/smp_lock.h> |
21 | #include <linux/module.h> | 21 | #include <linux/module.h> |
22 | #include <linux/net.h> | 22 | #include <linux/net.h> |
23 | #include <linux/kthread.h> | ||
23 | #include <net/ip.h> | 24 | #include <net/ip.h> |
24 | 25 | ||
25 | #include <linux/smb_fs.h> | 26 | #include <linux/smb_fs.h> |
@@ -40,7 +41,7 @@ enum smbiod_state { | |||
40 | }; | 41 | }; |
41 | 42 | ||
42 | static enum smbiod_state smbiod_state = SMBIOD_DEAD; | 43 | static enum smbiod_state smbiod_state = SMBIOD_DEAD; |
43 | static pid_t smbiod_pid; | 44 | static struct task_struct *smbiod_thread; |
44 | static DECLARE_WAIT_QUEUE_HEAD(smbiod_wait); | 45 | static DECLARE_WAIT_QUEUE_HEAD(smbiod_wait); |
45 | static LIST_HEAD(smb_servers); | 46 | static LIST_HEAD(smb_servers); |
46 | static DEFINE_SPINLOCK(servers_lock); | 47 | static DEFINE_SPINLOCK(servers_lock); |
@@ -67,20 +68,29 @@ void smbiod_wake_up(void) | |||
67 | */ | 68 | */ |
68 | static int smbiod_start(void) | 69 | static int smbiod_start(void) |
69 | { | 70 | { |
70 | pid_t pid; | 71 | struct task_struct *tsk; |
72 | int err = 0; | ||
73 | |||
71 | if (smbiod_state != SMBIOD_DEAD) | 74 | if (smbiod_state != SMBIOD_DEAD) |
72 | return 0; | 75 | return 0; |
73 | smbiod_state = SMBIOD_STARTING; | 76 | smbiod_state = SMBIOD_STARTING; |
74 | __module_get(THIS_MODULE); | 77 | __module_get(THIS_MODULE); |
75 | spin_unlock(&servers_lock); | 78 | spin_unlock(&servers_lock); |
76 | pid = kernel_thread(smbiod, NULL, 0); | 79 | tsk = kthread_run(smbiod, NULL, "smbiod"); |
77 | if (pid < 0) | 80 | if (IS_ERR(tsk)) { |
81 | err = PTR_ERR(tsk); | ||
78 | module_put(THIS_MODULE); | 82 | module_put(THIS_MODULE); |
83 | } | ||
79 | 84 | ||
80 | spin_lock(&servers_lock); | 85 | spin_lock(&servers_lock); |
81 | smbiod_state = pid < 0 ? SMBIOD_DEAD : SMBIOD_RUNNING; | 86 | if (err < 0) { |
82 | smbiod_pid = pid; | 87 | smbiod_state = SMBIOD_DEAD; |
83 | return pid; | 88 | smbiod_thread = NULL; |
89 | } else { | ||
90 | smbiod_state = SMBIOD_RUNNING; | ||
91 | smbiod_thread = tsk; | ||
92 | } | ||
93 | return err; | ||
84 | } | 94 | } |
85 | 95 | ||
86 | /* | 96 | /* |
@@ -290,8 +300,6 @@ out: | |||
290 | */ | 300 | */ |
291 | static int smbiod(void *unused) | 301 | static int smbiod(void *unused) |
292 | { | 302 | { |
293 | daemonize("smbiod"); | ||
294 | |||
295 | allow_signal(SIGKILL); | 303 | allow_signal(SIGKILL); |
296 | 304 | ||
297 | VERBOSE("SMB Kernel thread starting (%d) ...\n", current->pid); | 305 | VERBOSE("SMB Kernel thread starting (%d) ...\n", current->pid); |