From 879e52d49df6d00aa9eafe5cccb48bbd24ed4c81 Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Thu, 2 Jan 2014 03:24:48 +0000 Subject: [PATCH] sched: Directly pass context pointer to pre/post_select(). The patch is large, but it's fairly straight forward: Instead of a task pointer all ->pre_select() and ->post_select() methods now receive the context pointer that was passed to the scheduler when the task was registered. This allows to kill the public task_context(). Two pre_select/post_select functions are not directly called by the scheduler: session_post_select(), generic_recv_pre_select(). These are changed to receive a proper struct rather than a void pointer. Note that generic_filter_pre_select() is not changed in this manner because some filters do not provide a pre_select wrapper but set task->pre_select to generic_filter_pre_select(). --- aacdec_filter.c | 4 ++-- afh_recv.c | 10 +++++----- afs.c | 16 ++++++++-------- alsa_write.c | 11 +++++------ amp_filter.c | 4 ++-- ao_write.c | 9 ++++----- audioc.c | 8 ++++---- audiod.c | 29 ++++++++++++----------------- client.c | 12 ++++++------ client_common.c | 30 ++++++++++-------------------- compress_filter.c | 4 ++-- dccp_recv.c | 12 ++++++------ fecdec_filter.c | 4 ++-- file_write.c | 11 +++++------ filter.h | 6 +++--- filter_common.c | 6 +++--- flacdec_filter.c | 8 ++++---- grab_client.c | 10 +++++----- http_recv.c | 12 ++++++------ interactive.c | 4 ++-- mp3dec_filter.c | 4 ++-- oggdec_filter.c | 8 ++++---- opusdec_filter.c | 8 ++++---- oss_write.c | 11 +++++------ osx_write.c | 10 +++++----- play.c | 16 +++++++--------- prebuffer_filter.c | 8 ++++---- recv.h | 6 +++--- recv_common.c | 5 ++--- resample_filter.c | 8 ++++---- sched.c | 21 ++++----------------- sched.h | 12 +++++------- server.c | 14 +++++++------- spxdec_filter.c | 4 ++-- stdin.c | 34 +++++++++++----------------------- stdout.c | 27 +++++++-------------------- sync_filter.c | 8 ++++---- udp_recv.c | 12 ++++++------ vss.c | 13 +++++-------- wav_filter.c | 8 ++++---- wmadec_filter.c | 4 ++-- write.c | 8 ++++---- write.h | 4 ++-- 43 files changed, 199 insertions(+), 264 deletions(-) diff --git a/aacdec_filter.c b/aacdec_filter.c index 12de909c..7988723b 100644 --- a/aacdec_filter.c +++ b/aacdec_filter.c @@ -80,9 +80,9 @@ static void aacdec_close(struct filter_node *fn) fn->private_data = NULL; } -static int aacdec_post_select(__a_unused struct sched *s, struct task *t) +static int aacdec_post_select(__a_unused struct sched *s, void *context) { - struct filter_node *fn = task_context(t); + struct filter_node *fn = context; struct btr_node *btrn = fn->btrn; struct private_aacdec_data *padd = fn->private_data; int i, ret; diff --git a/afh_recv.c b/afh_recv.c index e320fdee..657a2057 100644 --- a/afh_recv.c +++ b/afh_recv.c @@ -150,14 +150,14 @@ static void afh_recv_close(struct receiver_node *rn) freep(&rn->private_data); } -static void afh_recv_pre_select(struct sched *s, struct task *t) +static void afh_recv_pre_select(struct sched *s, void *context) { - struct receiver_node *rn = task_context(t); + struct receiver_node *rn = context; struct private_afh_recv_data *pard = rn->private_data; struct afh_info *afhi = &pard->afhi; struct afh_recv_args_info *conf = rn->conf; struct timeval chunk_time; - int state = generic_recv_pre_select(s, t); + int state = generic_recv_pre_select(s, rn); if (state <= 0) return; @@ -170,9 +170,9 @@ static void afh_recv_pre_select(struct sched *s, struct task *t) sched_request_barrier_or_min_delay(&chunk_time, s); } -static int afh_recv_post_select(__a_unused struct sched *s, struct task *t) +static int afh_recv_post_select(__a_unused struct sched *s, void *context) { - struct receiver_node *rn = task_context(t); + struct receiver_node *rn = context; struct afh_recv_args_info *conf = rn->conf; struct private_afh_recv_data *pard = rn->private_data; struct btr_node *btrn = rn->btrn; diff --git a/afs.c b/afs.c index 7124d83e..a17da5b4 100644 --- a/afs.c +++ b/afs.c @@ -719,13 +719,13 @@ static int open_afs_tables(void) return ret; } -static void signal_pre_select(struct sched *s, struct task *t) +static void signal_pre_select(struct sched *s, void *context) { - struct signal_task *st = task_context(t); + struct signal_task *st = context; para_fd_set(st->fd, &s->rfds, &s->max_fileno); } -static int afs_signal_post_select(struct sched *s, __a_unused struct task *t) +static int afs_signal_post_select(struct sched *s, __a_unused void *context) { int signum, ret; @@ -783,9 +783,9 @@ struct afs_client { struct timeval connect_time; }; -static void command_pre_select(struct sched *s, struct task *t) +static void command_pre_select(struct sched *s, void *context) { - struct command_task *ct = task_context(t); + struct command_task *ct = context; struct afs_client *client; para_fd_set(server_socket, &s->rfds, &s->max_fileno); @@ -920,14 +920,14 @@ err: /** Shutdown connection if query has not arrived until this many seconds. */ #define AFS_CLIENT_TIMEOUT 3 -static int command_post_select(struct sched *s, struct task *t) +static int command_post_select(struct sched *s, void *context) { - struct command_task *ct = task_context(t); + struct command_task *ct = context; struct sockaddr_un unix_addr; struct afs_client *client, *tmp; int fd, ret; - ret = task_get_notification(t); + ret = task_get_notification(ct->task); if (ret < 0) return ret; ret = execute_server_command(&s->rfds); diff --git a/alsa_write.c b/alsa_write.c index 155d0269..32d8a50e 100644 --- a/alsa_write.c +++ b/alsa_write.c @@ -199,10 +199,10 @@ fail: return -E_ALSA; } -static void alsa_write_pre_select(struct sched *s, struct task *t) +static void alsa_write_pre_select(struct sched *s, void *context) { struct pollfd pfd; - struct writer_node *wn = task_context(t); + struct writer_node *wn = context; struct private_alsa_write_data *pad = wn->private_data; int ret = btr_node_status(wn->btrn, wn->min_iqs, BTR_NT_LEAF); @@ -248,10 +248,9 @@ static void alsa_close(struct writer_node *wn) free(pad); } -static int alsa_write_post_select(__a_unused struct sched *s, - struct task *t) +static int alsa_write_post_select(__a_unused struct sched *s, void *context) { - struct writer_node *wn = task_context(t); + struct writer_node *wn = context; struct private_alsa_write_data *pad = wn->private_data; struct btr_node *btrn = wn->btrn; char *data; @@ -259,7 +258,7 @@ static int alsa_write_post_select(__a_unused struct sched *s, snd_pcm_sframes_t frames; int ret; - ret = task_get_notification(t); + ret = task_get_notification(wn->task); if (ret < 0) goto err; again: diff --git a/amp_filter.c b/amp_filter.c index 71855eb2..8b8db201 100644 --- a/amp_filter.c +++ b/amp_filter.c @@ -62,9 +62,9 @@ static void amp_open(struct filter_node *fn) pad->amp, pad->amp / 64.0 + 1.0); } -static int amp_post_select(__a_unused struct sched *s, struct task *t) +static int amp_post_select(__a_unused struct sched *s, void *context) { - struct filter_node *fn = task_context(t); + struct filter_node *fn = context; struct private_amp_data *pad = fn->private_data; struct btr_node *btrn = fn->btrn; int ret, factor = 64 + pad->amp; diff --git a/ao_write.c b/ao_write.c index bab5a80e..4cecdfd8 100644 --- a/ao_write.c +++ b/ao_write.c @@ -46,9 +46,9 @@ static void aow_close(struct writer_node *wn) wn->private_data = NULL; } -static void aow_pre_select(struct sched *s, struct task *t) +static void aow_pre_select(struct sched *s, void *context) { - struct writer_node *wn = task_context(t); + struct writer_node *wn = context; struct private_aow_data *pawd = wn->private_data; int ret; @@ -308,10 +308,9 @@ fail: return -E_AO_PTHREAD; } -static int aow_post_select(__a_unused struct sched *s, - struct task *t) +static int aow_post_select(__a_unused struct sched *s, void *context) { - struct writer_node *wn = task_context(t); + struct writer_node *wn = context; struct private_aow_data *pawd = wn->private_data; int ret; diff --git a/audioc.c b/audioc.c index ab7253f6..e50267fd 100644 --- a/audioc.c +++ b/audioc.c @@ -121,9 +121,9 @@ static struct i9e_completer audiod_completers[] = { {.name = NULL} }; -static void audioc_pre_select(struct sched *s, struct task *t) +static void audioc_pre_select(struct sched *s, void *context) { - struct audioc_task *at = task_context(t); + struct audioc_task *at = context; int ret = btr_node_status(at->btrn, 0, BTR_NT_ROOT); if (ret < 0) @@ -131,10 +131,10 @@ static void audioc_pre_select(struct sched *s, struct task *t) para_fd_set(at->fd, &s->rfds, &s->max_fileno); } -static int audioc_post_select(struct sched *s, struct task *t) +static int audioc_post_select(struct sched *s, void *context) { char *buf = NULL; - struct audioc_task *at = task_context(t); + struct audioc_task *at = context; int ret = btr_node_status(at->btrn, 0, BTR_NT_ROOT); if (ret < 0) diff --git a/audiod.c b/audiod.c index ee136443..6b77e338 100644 --- a/audiod.c +++ b/audiod.c @@ -93,11 +93,7 @@ enum vss_status_flags { */ struct sched sched = {.max_fileno = 0}; -/** - * The task for obtaining para_server's status (para_client stat). - * - * \sa struct task, struct sched. - */ +/* The task for obtaining para_server's status (para_client stat). */ struct status_task { /** The associated task structure of audiod. */ struct task *task; @@ -1004,16 +1000,15 @@ err: exit(EXIT_FAILURE); } -static void signal_pre_select(struct sched *s, struct task *t) +static void signal_pre_select(struct sched *s, void *context) { - struct signal_task *st = task_context(t); + struct signal_task *st = context; para_fd_set(st->fd, &s->rfds, &s->max_fileno); } -static int signal_post_select(struct sched *s, __a_unused struct task *t) +static int signal_post_select(struct sched *s, __a_unused void *context) { int signum; - signum = para_next_signal(&s->rfds); switch (signum) { case SIGINT: @@ -1025,16 +1020,16 @@ static int signal_post_select(struct sched *s, __a_unused struct task *t) return 0; } -static void command_pre_select(struct sched *s, struct task *t) +static void command_pre_select(struct sched *s, void *context) { - struct command_task *ct = task_context(t); + struct command_task *ct = context; para_fd_set(ct->fd, &s->rfds, &s->max_fileno); } -static int command_post_select(struct sched *s, struct task *t) +static int command_post_select(struct sched *s, void *context) { int ret; - struct command_task *ct = task_context(t); + struct command_task *ct = context; static struct timeval last_status_dump; struct timeval tmp, delay; bool force = true; @@ -1196,9 +1191,9 @@ static void start_stop_decoders(void) btr_log_tree(sl->receiver_node->btrn, LL_NOTICE); } -static void status_pre_select(struct sched *s, struct task *t) +static void status_pre_select(struct sched *s, void *context) { - struct status_task *st = task_context(t); + struct status_task *st = context; int i, ret, cafn = stat_task->current_audio_format_num; if (must_start_decoder()) @@ -1228,9 +1223,9 @@ min_delay: } /* restart the client task if necessary */ -static int status_post_select(struct sched *s, struct task *t) +static int status_post_select(struct sched *s, void *context) { - struct status_task *st = task_context(t); + struct status_task *st = context; if (audiod_status == AUDIOD_OFF) { if (!st->ct) diff --git a/client.c b/client.c index 5573d037..987a637f 100644 --- a/client.c +++ b/client.c @@ -45,18 +45,18 @@ struct exec_task { size_t result_size; }; -static void exec_pre_select(struct sched *s, struct task *t) +static void exec_pre_select(struct sched *s, void *context) { - struct exec_task *et = task_context(t); + struct exec_task *et = context; int ret = btr_node_status(et->btrn, 0, BTR_NT_LEAF); if (ret != 0) sched_min_delay(s); } -static int exec_post_select(__a_unused struct sched *s, struct task *t) +static int exec_post_select(__a_unused struct sched *s, void *context) { - struct exec_task *et = task_context(t); + struct exec_task *et = context; struct btr_node *btrn = et->btrn; char *buf; size_t sz; @@ -533,9 +533,9 @@ struct supervisor_task { struct task *task; }; -static int supervisor_post_select(struct sched *s, struct task *t) +static int supervisor_post_select(struct sched *s, void *context) { - struct supervisor_task *svt = task_context(t); + struct supervisor_task *svt = context; int ret = task_status(ct->task); if (ret < 0) diff --git a/client_common.c b/client_common.c index df279129..c111e351 100644 --- a/client_common.c +++ b/client_common.c @@ -53,24 +53,19 @@ void client_close(struct client_task *ct) free(ct); } -/** +/* * The preselect hook for server commands. * - * \param s Pointer to the scheduler. - * \param t Pointer to the task struct for this command. - * * The task pointer must contain a pointer to the initialized client data * structure as it is returned by client_open(). * * This function checks the state of the connection and adds the file descriptor - * of the connection to the read or write fd set of \a s accordingly. - * - * \sa register_task() client_open(), struct sched, struct task. + * of the connection to the read or write fd set of s accordingly. */ -static void client_pre_select(struct sched *s, struct task *t) +static void client_pre_select(struct sched *s, void *context) { int ret; - struct client_task *ct = task_context(t); + struct client_task *ct = context; if (ct->scc.fd < 0) return; @@ -268,27 +263,22 @@ static int send_sb_command(struct client_task *ct) return send_sb(ct, 0, command, len, SBD_COMMAND, false); } -/** +/* * The post select hook for client commands. * - * \param s Pointer to the scheduler. - * \param t Pointer to the task struct for this command. - * * Depending on the current state of the connection and the status of the read - * and write fd sets of \a s, this function performs the necessary steps to - * authenticate the connection, to send the command given by \a t->private_data + * and write fd sets of s, this function performs the necessary steps to + * authenticate the connection, to send the command given by t->private_data * and to receive para_server's output, if any. - * - * \sa struct sched, struct task. */ -static int client_post_select(struct sched *s, struct task *t) +static int client_post_select(struct sched *s, void *context) { - struct client_task *ct = task_context(t); + struct client_task *ct = context; int ret = 0; size_t n; char buf[CLIENT_BUFSIZE]; - ret = task_get_notification(t); + ret = task_get_notification(ct->task); if (ret < 0) goto out; if (ct->scc.fd < 0) diff --git a/compress_filter.c b/compress_filter.c index affb3d4c..119e0169 100644 --- a/compress_filter.c +++ b/compress_filter.c @@ -41,9 +41,9 @@ static void compress_close(struct filter_node *fn) free(fn->private_data); } -static int compress_post_select(__a_unused struct sched *s, struct task *t) +static int compress_post_select(__a_unused struct sched *s, void *context) { - struct filter_node *fn = task_context(t); + struct filter_node *fn = context; struct private_compress_data *pcd = fn->private_data; struct btr_node *btrn = fn->btrn; bool inplace = btr_inplace_ok(btrn); diff --git a/dccp_recv.c b/dccp_recv.c index 1c41fd3c..a45b572d 100644 --- a/dccp_recv.c +++ b/dccp_recv.c @@ -119,24 +119,24 @@ static void *dccp_recv_parse_config(int argc, char **argv) return tmp; } -static void dccp_recv_pre_select(struct sched *s, struct task *t) +static void dccp_recv_pre_select(struct sched *s, void *context) { - struct receiver_node *rn = task_context(t); + struct receiver_node *rn = context; - if (generic_recv_pre_select(s, t) <= 0) + if (generic_recv_pre_select(s, rn) <= 0) return; para_fd_set(rn->fd, &s->rfds, &s->max_fileno); } -static int dccp_recv_post_select(struct sched *s, struct task *t) +static int dccp_recv_post_select(struct sched *s, void *context) { - struct receiver_node *rn = task_context(t); + struct receiver_node *rn = context; struct btr_node *btrn = rn->btrn; struct iovec iov[2]; int ret, iovcnt; size_t num_bytes; - ret = task_get_notification(t); + ret = task_get_notification(rn->task); if (ret < 0) goto out; ret = btr_node_status(btrn, 0, BTR_NT_ROOT); diff --git a/fecdec_filter.c b/fecdec_filter.c index 9d34106d..0909007a 100644 --- a/fecdec_filter.c +++ b/fecdec_filter.c @@ -436,9 +436,9 @@ static void fecdec_close(struct filter_node *fn) fn->private_data = NULL; } -static int fecdec_post_select(__a_unused struct sched *s, struct task *t) +static int fecdec_post_select(__a_unused struct sched *s, void *context) { - struct filter_node *fn = task_context(t); + struct filter_node *fn = context; struct btr_node *btrn = fn->btrn; int ret; struct fec_header h; diff --git a/file_write.c b/file_write.c index 97bdafd3..5d43fe7d 100644 --- a/file_write.c +++ b/file_write.c @@ -74,9 +74,9 @@ out: return ret; } -static void file_write_pre_select(struct sched *s, struct task *t) +static void file_write_pre_select(struct sched *s, void *context) { - struct writer_node *wn = task_context(t); + struct writer_node *wn = context; struct private_file_write_data *pfwd = wn->private_data; int ret = btr_node_status(wn->btrn, wn->min_iqs, BTR_NT_LEAF); @@ -97,17 +97,16 @@ static void file_write_close(struct writer_node *wn) free(pfwd); } -static int file_write_post_select(__a_unused struct sched *s, - struct task *t) +static int file_write_post_select(__a_unused struct sched *s, void *context) { - struct writer_node *wn = task_context(t); + struct writer_node *wn = context; struct private_file_write_data *pfwd = wn->private_data; struct btr_node *btrn = wn->btrn; int ret; char *buf; size_t bytes; - ret = task_get_notification(t); + ret = task_get_notification(wn->task); if (ret < 0) goto out; ret = btr_node_status(btrn, wn->min_iqs, BTR_NT_LEAF); diff --git a/filter.h b/filter.h index 7365f943..7af0fbbb 100644 --- a/filter.h +++ b/filter.h @@ -101,14 +101,14 @@ struct filter { * this function is to set file descriptors to be watched by the * subsequent select call to the two fd sets. */ - void (*pre_select)(struct sched *s, struct task *t); + void (*pre_select)(struct sched *s, void *context); /** * Convert (filter) the given data. * * Pointer to the converting function of the filter. On errors, the * post_select function is supposed to return a negative error code. */ - int (*post_select)(struct sched *s, struct task *t); + int (*post_select)(struct sched *s, void *context); /** * Answer a buffer tree query. * @@ -121,7 +121,7 @@ struct filter { void filter_init(void); int check_filter_arg(char *filter_arg, void **conf); void print_filter_helps(unsigned flags); -void generic_filter_pre_select(struct sched *s, struct task *t); +void generic_filter_pre_select(struct sched *s, void *context); int decoder_execute(const char *cmd, unsigned sample_rate, unsigned channels, char **result); diff --git a/filter_common.c b/filter_common.c index d570e648..616a7601 100644 --- a/filter_common.c +++ b/filter_common.c @@ -132,16 +132,16 @@ void print_filter_helps(unsigned flags) * Set select timeout of the scheduler. * * \param s The scheduler. - * \param t The task struct of this filter. + * \param context Pointer to the filter node (task context). * * This looks at the status of the btr node of the filter. If data is available * in the input queue of the filter, or if an error occurred, a minimal timeout * for the next select call is requested from the scheduler. Otherwise the * scheduler timeout is left unchanged. */ -void generic_filter_pre_select(struct sched *s, struct task *t) +void generic_filter_pre_select(struct sched *s, void *context) { - struct filter_node *fn = task_context(t); + struct filter_node *fn = context; if (btr_node_status(fn->btrn, fn->min_iqs, BTR_NT_INTERNAL) != 0) sched_min_delay(s); diff --git a/flacdec_filter.c b/flacdec_filter.c index 16b44121..b741f6b2 100644 --- a/flacdec_filter.c +++ b/flacdec_filter.c @@ -210,9 +210,9 @@ static bool output_queue_full(struct btr_node *btrn) return btr_get_output_queue_size(btrn) > FLACDEC_MAX_OUTPUT_SIZE; } -static void flacdec_pre_select(struct sched *s, struct task *t) +static void flacdec_pre_select(struct sched *s, void *context) { - struct filter_node *fn = task_context(t); + struct filter_node *fn = context; struct private_flacdec_data *pfd = fn->private_data; struct btr_node *btrn = fn->btrn; int ret; @@ -226,9 +226,9 @@ static void flacdec_pre_select(struct sched *s, struct task *t) return sched_min_delay(s); } -static int flacdec_post_select(__a_unused struct sched *s, struct task *t) +static int flacdec_post_select(__a_unused struct sched *s, void *context) { - struct filter_node *fn = task_context(t); + struct filter_node *fn = context; struct private_flacdec_data *pfd = fn->private_data; struct btr_node *btrn = fn->btrn; int ret; diff --git a/grab_client.c b/grab_client.c index 4f9b4041..7948c449 100644 --- a/grab_client.c +++ b/grab_client.c @@ -92,9 +92,9 @@ err: return -E_GC_WRITE; } -static void gc_pre_select(struct sched *s, struct task *t) +static void gc_pre_select(struct sched *s, void *context) { - struct grab_client *gc = task_context(t); + struct grab_client *gc = context; int ret = btr_node_status(gc->btrn, 0, BTR_NT_LEAF); if (ret == 0) @@ -108,7 +108,7 @@ static void gc_pre_select(struct sched *s, struct task *t) * We need this forward declaration as post_select() needs * activate_grab_client and vice versa. */ -static int gc_post_select(struct sched *s, struct task *t); +static int gc_post_select(struct sched *s, void *context); /** * Move a grab client to the active list and start it. @@ -185,9 +185,9 @@ static int gc_close(struct grab_client *gc, int err) return 0; } -static int gc_post_select(__a_unused struct sched *s, struct task *t) +static int gc_post_select(__a_unused struct sched *s, void *context) { - struct grab_client *gc = task_context(t); + struct grab_client *gc = context; struct btr_node *btrn = gc->btrn; int ret; size_t sz; diff --git a/http_recv.c b/http_recv.c index 03fca4e1..9deea791 100644 --- a/http_recv.c +++ b/http_recv.c @@ -60,12 +60,12 @@ static char *make_request_msg(void) return ret; } -static void http_recv_pre_select(struct sched *s, struct task *t) +static void http_recv_pre_select(struct sched *s, void *context) { - struct receiver_node *rn = task_context(t); + struct receiver_node *rn = context; struct private_http_recv_data *phd = rn->private_data; - if (generic_recv_pre_select(s, t) <= 0) + if (generic_recv_pre_select(s, rn) <= 0) return; if (phd->status == HTTP_CONNECTED) para_fd_set(rn->fd, &s->wfds, &s->max_fileno); @@ -78,16 +78,16 @@ static void http_recv_pre_select(struct sched *s, struct task *t) * area with data read from the socket. In any case, update the state of the * connection if necessary. */ -static int http_recv_post_select(struct sched *s, struct task *t) +static int http_recv_post_select(struct sched *s, void *context) { - struct receiver_node *rn = task_context(t); + struct receiver_node *rn = context; struct private_http_recv_data *phd = rn->private_data; struct btr_node *btrn = rn->btrn; int ret, iovcnt; struct iovec iov[2]; size_t num_bytes; - ret = task_get_notification(t); + ret = task_get_notification(rn->task); if (ret < 0) goto out; ret = btr_node_status(btrn, 0, BTR_NT_ROOT); diff --git a/interactive.c b/interactive.c index c5cdf12e..3d2f6d68 100644 --- a/interactive.c +++ b/interactive.c @@ -314,7 +314,7 @@ free_line: free(line); } -static int i9e_post_select(__a_unused struct sched *s, __a_unused struct task *t) +static int i9e_post_select(__a_unused struct sched *s, __a_unused void *context) { int ret; struct i9e_client_info *ici = i9ep->ici; @@ -371,7 +371,7 @@ out: return ret; } -static void i9e_pre_select(struct sched *s, __a_unused struct task *t) +static void i9e_pre_select(struct sched *s, __a_unused void *context) { int ret; diff --git a/mp3dec_filter.c b/mp3dec_filter.c index 997cb984..a51c77e2 100644 --- a/mp3dec_filter.c +++ b/mp3dec_filter.c @@ -77,9 +77,9 @@ static void mp3dec_close(struct filter_node *fn) #define MP3DEC_MAX_FRAME 8192 -static int mp3dec_post_select(__a_unused struct sched *s, struct task *t) +static int mp3dec_post_select(__a_unused struct sched *s, void *context) { - struct filter_node *fn = task_context(t); + struct filter_node *fn = context; int i, ret; struct private_mp3dec_data *pmd = fn->private_data; struct btr_node *btrn = fn->btrn; diff --git a/oggdec_filter.c b/oggdec_filter.c index ad3ef60f..8a3e261e 100644 --- a/oggdec_filter.c +++ b/oggdec_filter.c @@ -181,9 +181,9 @@ out: #define OGGDEC_MAX_OUTPUT_SIZE (96 * 1024) #define OGGDEC_OUTPUT_CHUNK_SIZE (32 * 1024) -static void ogg_pre_select(struct sched *s, struct task *t) +static void ogg_pre_select(struct sched *s, void *context) { - struct filter_node *fn = task_context(t); + struct filter_node *fn = context; struct private_oggdec_data *pod = fn->private_data; struct btr_node *btrn = fn->btrn; int ret; @@ -198,9 +198,9 @@ static void ogg_pre_select(struct sched *s, struct task *t) sched_min_delay(s); } -static int ogg_post_select(__a_unused struct sched *s, struct task *t) +static int ogg_post_select(__a_unused struct sched *s, void *context) { - struct filter_node *fn = task_context(t); + struct filter_node *fn = context; struct private_oggdec_data *pod = fn->private_data; struct btr_node *btrn = fn->btrn; int ret, have; diff --git a/opusdec_filter.c b/opusdec_filter.c index 292d83c9..4e69a46e 100644 --- a/opusdec_filter.c +++ b/opusdec_filter.c @@ -207,9 +207,9 @@ static int decode_packet(struct opusdec_context *ctx, ogg_packet *op, #define OPUSDEC_MAX_OUTPUT_SIZE (1024 * 1024) -static int opusdec_post_select(__a_unused struct sched *s, struct task *t) +static int opusdec_post_select(__a_unused struct sched *s, void *context) { - struct filter_node *fn = task_context(t); + struct filter_node *fn = context; struct opusdec_context *ctx = fn->private_data; struct btr_node *btrn = fn->btrn; int ret; @@ -269,9 +269,9 @@ out: return ret; } -static void opusdec_pre_select(struct sched *s, struct task *t) +static void opusdec_pre_select(struct sched *s, void *context) { - struct filter_node *fn = task_context(t); + struct filter_node *fn = context; struct opusdec_context *ctx = fn->private_data; int ret = btr_node_status(fn->btrn, fn->min_iqs, BTR_NT_INTERNAL); diff --git a/oss_write.c b/oss_write.c index 33cf8c3c..77fe2a51 100644 --- a/oss_write.c +++ b/oss_write.c @@ -44,9 +44,9 @@ static int get_oss_format(enum sample_format sf) } } -static void oss_pre_select(struct sched *s, struct task *t) +static void oss_pre_select(struct sched *s, void *context) { - struct writer_node *wn = task_context(t); + struct writer_node *wn = context; struct private_oss_write_data *powd = wn->private_data; int ret = btr_node_status(wn->btrn, wn->min_iqs, BTR_NT_LEAF); @@ -157,17 +157,16 @@ err_free: return ret; } -static int oss_post_select(__a_unused struct sched *s, - struct task *t) +static int oss_post_select(__a_unused struct sched *s, void *context) { - struct writer_node *wn = task_context(t); + struct writer_node *wn = context; struct private_oss_write_data *powd = wn->private_data; struct btr_node *btrn = wn->btrn; size_t frames, bytes; int ret; char *data; - ret = task_get_notification(t); + ret = task_get_notification(wn->task); if (ret < 0) goto out; ret = btr_node_status(btrn, wn->min_iqs, BTR_NT_LEAF); diff --git a/osx_write.c b/osx_write.c index a9c421a6..229930be 100644 --- a/osx_write.c +++ b/osx_write.c @@ -274,9 +274,9 @@ static inline bool need_drain_delay(struct private_osx_write_data *powd) return btr_get_input_queue_size(powd->callback_btrn) != 0; } -static void osx_write_pre_select(struct sched *s, struct task *t) +static void osx_write_pre_select(struct sched *s, void *context) { - struct writer_node *wn = task_context(t); + struct writer_node *wn = context; struct private_osx_write_data *powd = wn->private_data; int ret; bool drain_delay_nec = false; @@ -301,14 +301,14 @@ static void osx_write_pre_select(struct sched *s, struct task *t) sched_request_timeout_ms(50, s); } -static int osx_write_post_select(__a_unused struct sched *s, struct task *t) +static int osx_write_post_select(__a_unused struct sched *s, void *context) { - struct writer_node *wn = task_context(t); + struct writer_node *wn = context; struct private_osx_write_data *powd = wn->private_data; struct btr_node *btrn = wn->btrn; int ret; - ret = task_get_notification(t); + ret = task_get_notification(wn->task); if (ret < 0) goto fail; if (!powd) { diff --git a/play.c b/play.c index 088a1bff..cf7c5a30 100644 --- a/play.c +++ b/play.c @@ -1095,9 +1095,8 @@ static void session_update_time_string(struct play_task *pt, char *str, unsigned * terminates. Subsequent calls to i9e_get_error() then return negative and we * are allowed to call i9e_close() and terminate as well. */ -static int session_post_select(__a_unused struct sched *s, struct task *t) +static int session_post_select(__a_unused struct sched *s, struct play_task *pt) { - struct play_task *pt = task_context(t); int ret; if (pt->background) @@ -1119,9 +1118,8 @@ static int session_post_select(__a_unused struct sched *s, struct task *t) #else /* HAVE_READLINE */ -static int session_post_select(struct sched *s, struct task *t) +static int session_post_select(struct sched *s, struct play_task *pt) { - struct play_task *pt = task_context(t); char c; if (!FD_ISSET(STDIN_FILENO, &s->rfds)) @@ -1144,9 +1142,9 @@ static void session_update_time_string(__a_unused struct play_task *pt, } #endif /* HAVE_READLINE */ -static void play_pre_select(struct sched *s, struct task *t) +static void play_pre_select(struct sched *s, void *context) { - struct play_task *pt = task_context(t); + struct play_task *pt = context; char state; para_fd_set(STDIN_FILENO, &s->rfds, &s->max_fileno); @@ -1183,9 +1181,9 @@ static unsigned get_time_string(struct play_task *pt, char **result) ); } -static int play_post_select(struct sched *s, struct task *t) +static int play_post_select(struct sched *s, void *context) { - struct play_task *pt = task_context(t); + struct play_task *pt = context; int ret; ret = eof_cleanup(pt); @@ -1193,7 +1191,7 @@ static int play_post_select(struct sched *s, struct task *t) pt->rq = CRT_TERM_RQ; return 0; } - ret = session_post_select(s, t); + ret = session_post_select(s, pt); if (ret < 0) goto out; if (!pt->wn.btrn && !pt->fn.btrn) { diff --git a/prebuffer_filter.c b/prebuffer_filter.c index 160781a1..356fb54c 100644 --- a/prebuffer_filter.c +++ b/prebuffer_filter.c @@ -28,9 +28,9 @@ struct private_prebuffer_data { struct timeval barrier; }; -static void prebuffer_pre_select(struct sched *s, struct task *t) +static void prebuffer_pre_select(struct sched *s, void *context) { - struct filter_node *fn = task_context(t); + struct filter_node *fn = context; struct btr_node *btrn = fn->btrn; size_t iqs = btr_get_input_queue_size(btrn); struct private_prebuffer_data *ppd = fn->private_data; @@ -56,9 +56,9 @@ static void prebuffer_close(struct filter_node *fn) free(fn->private_data); } -static int prebuffer_post_select(__a_unused struct sched *s, struct task *t) +static int prebuffer_post_select(__a_unused struct sched *s, void *context) { - struct filter_node *fn = task_context(t); + struct filter_node *fn = context; struct btr_node *btrn = fn->btrn; size_t iqs = btr_get_input_queue_size(btrn); struct private_prebuffer_data *ppd = fn->private_data; diff --git a/recv.h b/recv.h index 2b5e36d7..4564337c 100644 --- a/recv.h +++ b/recv.h @@ -103,7 +103,7 @@ struct receiver { * * \sa select(2), time.c struct task, struct sched. */ - void (*pre_select)(struct sched *s, struct task *t); + void (*pre_select)(struct sched *s, void *context); /** * Evaluate the result from select(). * @@ -115,7 +115,7 @@ struct receiver { * * \sa select(2), struct receiver. */ - int (*post_select)(struct sched *s, struct task *t); + int (*post_select)(struct sched *s, void *context); /** The two help texts of this receiver. */ struct ggo_help help; @@ -142,7 +142,7 @@ struct receiver { void recv_init(void); void *check_receiver_arg(char *ra, int *receiver_num); void print_receiver_helps(unsigned flags); -int generic_recv_pre_select(struct sched *s, struct task *t); +int generic_recv_pre_select(struct sched *s, struct receiver_node *rn); /** \cond receiver */ extern void http_recv_init(struct receiver *r); diff --git a/recv_common.c b/recv_common.c index 921d57ae..280f5bc4 100644 --- a/recv_common.c +++ b/recv_common.c @@ -116,7 +116,7 @@ void print_receiver_helps(unsigned flags) * Simple pre-select hook, used by all receivers. * * \param s Scheduler info. - * \param t Determines the receiver node. + * \param rn The receiver node. * * This requests a minimal delay from the scheduler if the status of the buffer * tree node indicates an error/eof condition. No file descriptors are added to @@ -125,9 +125,8 @@ void print_receiver_helps(unsigned flags) * \return The status of the btr node of the receiver node, i.e. the return * value of the underlying call to \ref btr_node_status(). */ -int generic_recv_pre_select(struct sched *s, struct task *t) +int generic_recv_pre_select(struct sched *s, struct receiver_node *rn) { - struct receiver_node *rn = task_context(t); int ret = btr_node_status(rn->btrn, 0, BTR_NT_ROOT); if (ret < 0) diff --git a/resample_filter.c b/resample_filter.c index e34af839..61ffd2b6 100644 --- a/resample_filter.c +++ b/resample_filter.c @@ -65,9 +65,9 @@ static void resample_open(struct filter_node *fn) btr_log_tree(btr_parent(btr_parent(btrn)), LL_INFO); } -static void resample_pre_select(struct sched *s, struct task *t) +static void resample_pre_select(struct sched *s, void *context) { - struct filter_node *fn = task_context(t); + struct filter_node *fn = context; struct resample_context *ctx = fn->private_data; int ret = btr_node_status(fn->btrn, fn->min_iqs, BTR_NT_INTERNAL); @@ -202,10 +202,10 @@ static int resample_frames(int16_t *in, size_t num_frames, bool have_more, return data.input_frames_used; } -static int resample_post_select(__a_unused struct sched *s, struct task *t) +static int resample_post_select(__a_unused struct sched *s, void *context) { int ret; - struct filter_node *fn = task_context(t); + struct filter_node *fn = context; struct resample_context *ctx = fn->private_data; struct resample_filter_args_info *conf = fn->conf; struct btr_node *btrn = fn->btrn; diff --git a/sched.c b/sched.c index 13993b13..f355c975 100644 --- a/sched.c +++ b/sched.c @@ -67,7 +67,7 @@ static void sched_preselect(struct sched *s) if (t->notification != 0) sched_min_delay(s); if (t->info.pre_select) - t->info.pre_select(s, t); + t->info.pre_select(s, t->info.context); } } @@ -85,13 +85,13 @@ static inline void call_post_select(struct sched *s, struct task *t) int ret; #ifndef SCHED_DEBUG - ret = t->info.post_select(s, t); + ret = t->info.post_select(s, t->info.context); #else struct timeval t1, t2, diff; unsigned long pst; clock_get_realtime(&t1); - ret = t->info.post_select(s, t); + ret = t->info.post_select(s, t->info.context); clock_get_realtime(&t2); tv_diff(&t1, &t2, &diff); pst = tv2ms(&diff); @@ -133,7 +133,7 @@ static unsigned sched_post_select(struct sched *s) * \return Zero if no more tasks are left in the task list, negative if the * select function returned an error. * - * \sa \ref task, \ref now. + * \sa \ref now. */ int schedule(struct sched *s) { @@ -262,19 +262,6 @@ struct task *task_register(struct task_info *info, struct sched *s) return t; } -/** - * Obtain the context pointer of a task. - * - * \param t Return this task's context pointer. - * - * \return A pointer to the memory location specified previously as \a - * task_info->context when the task was registered with \ref task_register(). - */ -void *task_context(struct task *t) -{ - return t->info.context; -} - /** * Get the list of all registered tasks. * diff --git a/sched.h b/sched.h index 05b6c51e..9c0e10a3 100644 --- a/sched.h +++ b/sched.h @@ -45,7 +45,7 @@ struct task_info { * Its purpose is to add file descriptors to the fd sets of the * scheduler and to decrease the select timeout if necessary. */ - void (*pre_select)(struct sched *s, struct task *t); + void (*pre_select)(struct sched *s, void *context); /** * The mandatory post select method. * @@ -53,12 +53,11 @@ struct task_info { * select call. If this function returns a negative value, the * scheduler unregisters the task. */ - int (*post_select)(struct sched *s, struct task *t); + int (*post_select)(struct sched *s, void *context); /** - * This pointer is saved when the task is register(ed). It may be - * queried from ->pre_select() and ->post_select() via \ref - * task_context(). Usually this is a pointer to the struct owned by the - * caller which contains the task pointer as one member. + * This pointer is saved when the task is registered. It is passed to + * ->pre_select() and ->post_select(). Usually this is a pointer to the + * struct owned by the caller which contains the task pointer. */ void *context; }; @@ -72,7 +71,6 @@ struct task_info { extern struct timeval *now; struct task *task_register(struct task_info *info, struct sched *s); -void *task_context(struct task *t); int schedule(struct sched *s); void sched_shutdown(struct sched *s); char *get_task_list(struct sched *s); diff --git a/server.c b/server.c index 1d67b8b8..bcbf2404 100644 --- a/server.c +++ b/server.c @@ -235,9 +235,9 @@ out: exit(EXIT_FAILURE); } -static void signal_pre_select(struct sched *s, struct task *t) +static void signal_pre_select(struct sched *s, void *context) { - struct signal_task *st = task_context(t); + struct signal_task *st = context; para_fd_set(st->fd, &s->rfds, &s->max_fileno); } @@ -253,7 +253,7 @@ static void handle_sighup(void) kill(mmd->afs_pid, SIGHUP); } -static int signal_post_select(struct sched *s, __a_unused struct task *t) +static int signal_post_select(struct sched *s, __a_unused void *context) { int signum = para_next_signal(&s->rfds); @@ -329,15 +329,15 @@ static void init_signal_task(void) }, &sched); } -static void command_pre_select(struct sched *s, struct task *t) +static void command_pre_select(struct sched *s, void *context) { - struct server_command_task *sct = task_context(t); + struct server_command_task *sct = context; para_fd_set(sct->listen_fd, &s->rfds, &s->max_fileno); } -static int command_post_select(struct sched *s, struct task *t) +static int command_post_select(struct sched *s, void *context) { - struct server_command_task *sct = task_context(t); + struct server_command_task *sct = context; int new_fd, ret, i; char *peer_name; diff --git a/spxdec_filter.c b/spxdec_filter.c index a1ff3ddb..8b29007c 100644 --- a/spxdec_filter.c +++ b/spxdec_filter.c @@ -238,9 +238,9 @@ static int compute_skip_samples(ogg_page *og, struct private_spxdec_data *psd) return ret; } -static int speexdec_post_select(__a_unused struct sched *s, struct task *t) +static int speexdec_post_select(__a_unused struct sched *s, void *context) { - struct filter_node *fn = task_context(t); + struct filter_node *fn = context; struct private_spxdec_data *psd = fn->private_data; struct btr_node *btrn = fn->btrn; int ret, ns; diff --git a/stdin.c b/stdin.c index ed663169..a66ad469 100644 --- a/stdin.c +++ b/stdin.c @@ -18,19 +18,13 @@ #include "buffer_tree.h" #include "string.h" -/** - * The pre_select function of the stdin task. - * - * \param s The scheduler this task was registered to. - * \param t The task structure of the stdin task. - * - * This function is always successful. If there is space left in the - * buffer of the stdin task, it adds \p STDIN_FILENO to the read fd set - * of \a s. +/* + * If there is space left in the buffer of the stdin task add STDIN_FILENO to + * the read fd set of s. */ -static void stdin_pre_select(struct sched *s, struct task *t) +static void stdin_pre_select(struct sched *s, void *context) { - struct stdin_task *sit = task_context(t); + struct stdin_task *sit = context; int ret; ret = btr_node_status(sit->btrn, 0, BTR_NT_ROOT); @@ -43,20 +37,14 @@ static void stdin_pre_select(struct sched *s, struct task *t) sched_request_timeout_ms(100, s); } -/** - * The post select function of the stdin task. - * - * \param s The scheduler this task was registered to. - * \param t The task structure of the stdin task. - * - * This function checks if \p STDIN_FILENO was included by in the read fd set - * of \a s during the previous pre_select call. If yes, and \p STDIN_FILENO - * appears to be readable, data is read from stdin and fed into the buffer - * tree. +/* + * This function checks if STDIN_FILENO was included by in the read fd set of s + * during the previous pre_select call. If so, and if STDIN_FILENO is readable, + * data is read from stdin and fed into the buffer tree. */ -static int stdin_post_select(struct sched *s, struct task *t) +static int stdin_post_select(struct sched *s, void *context) { - struct stdin_task *sit = task_context(t); + struct stdin_task *sit = context; ssize_t ret; size_t sz, n; char *buf = NULL; diff --git a/stdout.c b/stdout.c index 0ff24e92..bb921ad1 100644 --- a/stdout.c +++ b/stdout.c @@ -16,18 +16,10 @@ #include "stdout.h" #include "buffer_tree.h" -/** - * The pre_select function of the stdout task. - * - * \param s The scheduler this task was registered to. - * \param t The task structure of the stdout task. - * - * This function is always successful. If there is input data available, it - * adds \p STDOUT_FILENO to the write fd set of \a s. - */ -static void stdout_pre_select(struct sched *s, struct task *t) +/* Add STDOUT_FILENO to the write fd set if there is input data available. */ +static void stdout_pre_select(struct sched *s, void *context) { - struct stdout_task *sot = task_context(t); + struct stdout_task *sot = context; int ret; ret = btr_node_status(sot->btrn, 0, BTR_NT_LEAF); @@ -37,18 +29,13 @@ static void stdout_pre_select(struct sched *s, struct task *t) sched_min_delay(s); } -/** - * The post select function of the stdout task. - * - * \param s The scheduler this task was registered to. - * \param t The task structure of the stdout task. - * - * This function writes input data from the buffer tree to stdout if \p +/* + * This function writes input data from the buffer tree to stdout if * STDOUT_FILENO is writable. */ -static int stdout_post_select(struct sched *s, struct task *t) +static int stdout_post_select(struct sched *s, void *context) { - struct stdout_task *sot = task_context(t); + struct stdout_task *sot = context; struct btr_node *btrn = sot->btrn; int ret; char *buf; diff --git a/sync_filter.c b/sync_filter.c index 203451f2..fceb1d1c 100644 --- a/sync_filter.c +++ b/sync_filter.c @@ -258,10 +258,10 @@ static void sync_set_timeout(struct sync_filter_context *ctx, tv_add(now, &to, &ctx->timeout); } -static void sync_pre_select(struct sched *s, struct task *t) +static void sync_pre_select(struct sched *s, void *context) { int ret; - struct filter_node *fn = task_context(t); + struct filter_node *fn = context; struct sync_filter_context *ctx = fn->private_data; struct sync_filter_config *sfc = fn->conf; @@ -295,10 +295,10 @@ static struct sync_buddy *sync_find_buddy(struct sockaddr *addr, return NULL; } -static int sync_post_select(__a_unused struct sched *s, struct task *t) +static int sync_post_select(__a_unused struct sched *s, void *context) { int ret; - struct filter_node *fn = task_context(t); + struct filter_node *fn = context; struct sync_filter_context *ctx = fn->private_data; struct sync_filter_config *sfc = fn->conf; struct sync_buddy *buddy, *tmp; diff --git a/udp_recv.c b/udp_recv.c index 4d4b67f9..bde41243 100644 --- a/udp_recv.c +++ b/udp_recv.c @@ -27,11 +27,11 @@ #include "net.h" #include "fd.h" -static void udp_recv_pre_select(struct sched *s, struct task *t) +static void udp_recv_pre_select(struct sched *s, void *context) { - struct receiver_node *rn = task_context(t); + struct receiver_node *rn = context; - if (generic_recv_pre_select(s, t) <= 0) + if (generic_recv_pre_select(s, rn) <= 0) return; para_fd_set(rn->fd, &s->rfds, &s->max_fileno); } @@ -54,15 +54,15 @@ static int udp_check_eof(size_t sz, struct iovec iov[2]) return -E_RECV_EOF; } -static int udp_recv_post_select(__a_unused struct sched *s, struct task *t) +static int udp_recv_post_select(__a_unused struct sched *s, void *context) { - struct receiver_node *rn = task_context(t); + struct receiver_node *rn = context; struct btr_node *btrn = rn->btrn; size_t num_bytes; struct iovec iov[2]; int ret, readv_ret, iovcnt; - ret = task_get_notification(t); + ret = task_get_notification(rn->task); if (ret < 0) goto out; ret = btr_node_status(btrn, 0, BTR_NT_ROOT); diff --git a/vss.c b/vss.c index 1b66a6e5..928ef6c2 100644 --- a/vss.c +++ b/vss.c @@ -885,12 +885,9 @@ static void set_mmd_offset(void) mmd->offset = tv2ms(&offset); } -/** +/* * Compute the timeout for the main select-loop of the scheduler. * - * \param s Pointer to the server scheduler. - * \param t Pointer to the vss task structure. - * * Before the timeout is computed, the current vss status flags are evaluated * and acted upon by calling appropriate functions from the lower layers. * Possible actions include @@ -899,10 +896,10 @@ static void set_mmd_offset(void) * - shutdown of all senders (stop/pause command), * - reposition the stream (ff/jmp command). */ -static void vss_pre_select(struct sched *s, struct task *t) +static void vss_pre_select(struct sched *s, void *context) { int i; - struct vss_task *vsst = task_context(t); + struct vss_task *vsst = context; if (!vsst->map || vss_next() || vss_paused() || vss_repos()) { struct fec_client *fc, *tmp; @@ -1126,10 +1123,10 @@ static void vss_send(struct vss_task *vsst) } } -static int vss_post_select(struct sched *s, struct task *t) +static int vss_post_select(struct sched *s, void *context) { int ret, i; - struct vss_task *vsst = task_context(t); + struct vss_task *vsst = context; if (mmd->sender_cmd_data.cmd_num >= 0) { int num = mmd->sender_cmd_data.cmd_num, diff --git a/wav_filter.c b/wav_filter.c index b5b0df80..199db45a 100644 --- a/wav_filter.c +++ b/wav_filter.c @@ -63,9 +63,9 @@ static void wav_open(struct filter_node *fn) *bof = 1; } -static void wav_pre_select(struct sched *s, struct task *t) +static void wav_pre_select(struct sched *s, void *context) { - struct filter_node *fn = task_context(t); + struct filter_node *fn = context; size_t iqs = btr_get_input_queue_size(fn->btrn); if (iqs == 0) @@ -73,9 +73,9 @@ static void wav_pre_select(struct sched *s, struct task *t) sched_min_delay(s); } -static int wav_post_select(__a_unused struct sched *s, struct task *t) +static int wav_post_select(__a_unused struct sched *s, void *context) { - struct filter_node *fn = task_context(t); + struct filter_node *fn = context; struct btr_node *btrn = fn->btrn; size_t iqs = btr_get_input_queue_size(btrn); int ret; diff --git a/wmadec_filter.c b/wmadec_filter.c index e4afbb56..562bc251 100644 --- a/wmadec_filter.c +++ b/wmadec_filter.c @@ -1213,9 +1213,9 @@ static int wmadec_execute(struct btr_node *btrn, const char *cmd, char **result) #define WMA_OUTPUT_BUFFER_SIZE (128 * 1024) -static int wmadec_post_select(__a_unused struct sched *s, struct task *t) +static int wmadec_post_select(__a_unused struct sched *s, void *context) { - struct filter_node *fn = task_context(t); + struct filter_node *fn = context; int ret, converted, out_size; struct private_wmadec_data *pwd = fn->private_data; struct btr_node *btrn = fn->btrn; diff --git a/write.c b/write.c index 44077840..eaf56f41 100644 --- a/write.c +++ b/write.c @@ -75,15 +75,15 @@ struct write_task { struct check_wav_context *cwc; }; -static void write_pre_select(struct sched *s, struct task *t) +static void write_pre_select(struct sched *s, void *context) { - struct write_task *wt = task_context(t); + struct write_task *wt = context; check_wav_pre_select(s, wt->cwc); } -static int write_post_select(__a_unused struct sched *s, struct task *t) +static int write_post_select(__a_unused struct sched *s, void *context) { - struct write_task *wt = task_context(t); + struct write_task *wt = context; return check_wav_post_select(wt->cwc); } diff --git a/write.h b/write.h index 32c437f8..cb734988 100644 --- a/write.h +++ b/write.h @@ -59,13 +59,13 @@ struct writer { * This is called from scheduler. It may use the sched pointer to add * any file descriptors or to decrease the select timeout. */ - void (*pre_select)(struct sched *s, struct task *t); + void (*pre_select)(struct sched *s, void *context); /** * Write audio data. * * Called from the post_select function of the writer node's task. */ - int (*post_select)(struct sched *s, struct task *t); + int (*post_select)(struct sched *s, void *context); /** * Close one instance of the writer. * -- 2.39.2