From: Andre Noll Date: Mon, 30 Dec 2013 23:34:08 +0000 (+0000) Subject: task_register() conversion: afs command task X-Git-Tag: v0.5.3~8^2~18 X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=commitdiff_plain;h=7f72602378768f695b661d62b266b763ca09a432 task_register() conversion: afs command task --- diff --git a/afs.c b/afs.c index a2789bd8..7124d83e 100644 --- a/afs.c +++ b/afs.c @@ -81,7 +81,7 @@ struct command_task { */ uint32_t cookie; /** The associated task structure. */ - struct task task; + struct task *task; }; extern int mmd_mutex; @@ -785,7 +785,7 @@ struct afs_client { static void command_pre_select(struct sched *s, struct task *t) { - struct command_task *ct = container_of(t, struct command_task, task); + struct command_task *ct = task_context(t); struct afs_client *client; para_fd_set(server_socket, &s->rfds, &s->max_fileno); @@ -922,7 +922,7 @@ err: static int command_post_select(struct sched *s, struct task *t) { - struct command_task *ct = container_of(t, struct command_task, task); + struct command_task *ct = task_context(t); struct sockaddr_un unix_addr; struct afs_client *client, *tmp; int fd, ret; @@ -975,10 +975,12 @@ static void register_command_task(uint32_t cookie, struct sched *s) ct->fd = setup_command_socket_or_die(); ct->cookie = cookie; - ct->task.pre_select = command_pre_select; - ct->task.post_select = command_post_select; - sprintf(ct->task.status, "afs command task"); - register_task(s, &ct->task); + ct->task = task_register(&(struct task_info) { + .name = "afs command", + .pre_select = command_pre_select, + .post_select = command_post_select, + .context = ct, + }, s); } /** @@ -1010,6 +1012,7 @@ __noreturn void afs_init(uint32_t cookie, int socket_fd) s.default_timeout.tv_sec = 0; s.default_timeout.tv_usec = 999 * 1000; ret = schedule(&s); + sched_shutdown(&s); out_close: close_afs_tables(); out: