]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
sched: Directly pass context pointer to pre/post_select().
authorAndre Noll <maan@systemlinux.org>
Thu, 2 Jan 2014 03:24:48 +0000 (03:24 +0000)
committerAndre Noll <maan@systemlinux.org>
Sun, 25 May 2014 13:40:20 +0000 (15:40 +0200)
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().

43 files changed:
aacdec_filter.c
afh_recv.c
afs.c
alsa_write.c
amp_filter.c
ao_write.c
audioc.c
audiod.c
client.c
client_common.c
compress_filter.c
dccp_recv.c
fecdec_filter.c
file_write.c
filter.h
filter_common.c
flacdec_filter.c
grab_client.c
http_recv.c
interactive.c
mp3dec_filter.c
oggdec_filter.c
opusdec_filter.c
oss_write.c
osx_write.c
play.c
prebuffer_filter.c
recv.h
recv_common.c
resample_filter.c
sched.c
sched.h
server.c
spxdec_filter.c
stdin.c
stdout.c
sync_filter.c
udp_recv.c
vss.c
wav_filter.c
wmadec_filter.c
write.c
write.h

index 12de909cb6cecca2a3abc4c027177bc31b91ab5d..7988723bd2b3cf4194de426dcdc965937cfe29d2 100644 (file)
@@ -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;
index e320fdee65627665d1247da98ddc68ff0786b364..657a205737595f370eeb238813a7cd2c009064dc 100644 (file)
@@ -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 7124d83ed0146d6618dd1b3adee89e212baa4f1d..a17da5b4ac82e11b88561c35e54ec624960424cd 100644 (file)
--- 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);
index 155d02697cb90400107b59922e1cb99f917f978e..32d8a50e98715ec92e2c43734c44c2bc33b39098 100644 (file)
@@ -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:
index 71855eb2e9e5a8102d6cebf1f0c6ffd4b6180250..8b8db2019c81c6712d8a587325b4153392cd571d 100644 (file)
@@ -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;
index bab5a80ef9308b7204bf6294dea8963f89880113..4cecdfd87c10047eb8a5b646b7178401da1eac6f 100644 (file)
@@ -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;
 
index ab7253f698946c44651325611141ec34ffeb66e1..e50267fdfba290bf7ba39050afd5a388ced41ff0 100644 (file)
--- 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)
index ee1364433e77de965e715fe59692040e6e590989..6b77e338565dc633c15d891f9ed05de73fa38f96 100644 (file)
--- 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)
index 5573d037794d8b34049200b9bb32322074a39cbb..987a637fa2301b22beea8795fbe7ee063b46787b 100644 (file)
--- 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)
index df279129411b9cfaca3d7529654e59509b11029b..c111e351ba50dc54ca48a2dae851d2f8f72dcae7 100644 (file)
@@ -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)
index affb3d4ca9a1ab30155ead26511df789eca29206..119e01693a9accf7fcc788d3433c8edce4979a5e 100644 (file)
@@ -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);
index 1c41fd3c0d0d9d09b745bbd48fdabc181c74fec4..a45b572d9a322f72f76e54ab323e1859144ee8d1 100644 (file)
@@ -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);
index 9d34106db7562b5bc1c6ab419bf955dc15eb9572..0909007a48a1b6962f17a0754724b75c0d2e3e37 100644 (file)
@@ -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;
index 97bdafd3d617602f7afd745ba0371477ff046281..5d43fe7d1cc8e748f16fd874f668b50bd883891d 100644 (file)
@@ -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);
index 7365f943f038583052695387ce261374d5051e63..7af0fbbb2a67421984953ef75660344cfc2c93fa 100644 (file)
--- 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);
 
index d570e648788bf1d90253aa1d9b96aa310803d5af..616a7601a76e30db8ccfaeca408cf60f5dc36fab 100644 (file)
@@ -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);
index 16b4412152f1b6618c8cf839b57a5237615a9d7d..b741f6b2a13c787d3a635db7566c2036cdd08e2f 100644 (file)
@@ -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;
index 4f9b40418592d422e580051a19207da031421117..7948c44957cdf7f8d28e40c7d3253b385969adf6 100644 (file)
@@ -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;
index 03fca4e11bf519a0202e191b7df704c617fd570b..9deea791a598a42d4a3567885f3b0beb4bb8fcc7 100644 (file)
@@ -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);
index c5cdf12ea3781d9bc0b5ca860f2a642d6161dafa..3d2f6d686e491fffd91a09281696bfdd07fdf0e5 100644 (file)
@@ -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;
 
index 997cb9842df365318c151ddd9d93236e78bfb449..a51c77e28a84a6b032d151f1713bf64cf0674a89 100644 (file)
@@ -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;
index ad3ef60f637fbdc3239970d4b5a0f76a42614e93..8a3e261e122c2b92061bbe2bf73c44132884249a 100644 (file)
@@ -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;
index 292d83c9f960ce1332e029c4addd231a8e7f7cb1..4e69a46efaf535405d0d3016ced360e6cf33c550 100644 (file)
@@ -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);
 
index 33cf8c3cf1d56b3b0e851e1157279e5351529d3f..77fe2a51314e1268fdfcc3b5b1b2db68ac816788 100644 (file)
@@ -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);
index a9c421a6a0a27397afbd69b302c77199c52e768b..229930be074794cb2eea575c40fdb980f2856585 100644 (file)
@@ -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 088a1bff0919edac79444b63d32cc72673464523..cf7c5a302d2cac9e96fd3793778733f874d3e267 100644 (file)
--- 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) {
index 160781a121a51f4adff74d88928144f06af4f5ee..356fb54cb6a860f6e623e14c0cd819158c98ba19 100644 (file)
@@ -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 2b5e36d7c260c9fddbbd091c269886b3ad6dbfd3..4564337cc9047bb38d4d77a5ec1eede83cfbc78c 100644 (file)
--- 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);
index 921d57ae7f48838a4cb6412658e60fa072ab2a99..280f5bc40a7b6703ca737efe3e4f9e57baf30bde 100644 (file)
@@ -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)
index e34af83992526c23b73f24c03c92fde88a3a9bd0..61ffd2b6f5090419d90b27c9c8972fc97eba839d 100644 (file)
@@ -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 13993b13be128e261e989cb3963cfc2e73a693b4..f355c9750bc3ee2c426b2b5505073813973ce3cb 100644 (file)
--- 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 05b6c51e725b31bba2f75bf46d1faf714e5ebe2e..9c0e10a33b38d7df6f64d893473f54d58ed65938 100644 (file)
--- 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);
index 1d67b8b8f503bcaad721371b01c3ef07c6dd7e81..bcbf240423bd9c207df9bd33c5f53f3e6b53d275 100644 (file)
--- 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;
index a1ff3ddb018011eadffc3b6b0975334e33b52dab..8b29007c67e5a7299c52cf8aada7875bef964a48 100644 (file)
@@ -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 ed66316964c15a2cac030ae713c25e30c69951c6..a66ad469c2d648a875d4e8f1ce6917606a18967d 100644 (file)
--- a/stdin.c
+++ b/stdin.c
 #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;
index 0ff24e92b1b7065b8c5a2267c70817487363d251..bb921ad12dd84acc71b5fb7a9c3944bc0d117732 100644 (file)
--- a/stdout.c
+++ b/stdout.c
 #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;
index 203451f2c23cef6cec6db8072654cbf123a30a0e..fceb1d1cc8bbfe64c7aefe4eb9175d69560b14c8 100644 (file)
@@ -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;
index 4d4b67f9b772d9d178ddbd92bc9d10fbf9f347ec..bde4124384abe918225f58bc658c1ef7d99dfae9 100644 (file)
 #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 1b66a6e5d01cbecb5b08d0e4f17d5808ae8c5d7f..928ef6c2e2bf9e564872d60e99f7deef3c23bd6c 100644 (file)
--- 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,
index b5b0df80f8fe31448f991d8ba86111f6b1774ae3..199db45abe2e0663baa30e51e9f4acefc7b9ec60 100644 (file)
@@ -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;
index e4afbb56ab2d82d8d482cf27ec1eb7f96c1e5832..562bc2513c94c445805d0639d647e73a39b05506 100644 (file)
@@ -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 440778407b3c8388e278a0cd79f505fe016c28ce..eaf56f413412bbd6420767d59803bda7ab0bcb71 100644 (file)
--- 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 32c437f8d175826951f2861f82277cf68ca52461..cb73498881d1fb2d32e5d259d0bd21fd4227d8f4 100644 (file)
--- 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.
         *