]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - afs.c
afs: Make afs callbacks more flexible.
[paraslash.git] / afs.c
diff --git a/afs.c b/afs.c
index fa750d21c2424e1beb3e08a42226e54c5feff40d..30acfa041d4d8b6d483857096b9196e17311ba20 100644 (file)
--- a/afs.c
+++ b/afs.c
@@ -588,17 +588,17 @@ void flush_and_free_pb(struct para_buffer *pb)
        free(pb->buf);
 }
 
-static int com_select_callback(int fd, const struct osl_object *query)
+static int com_select_callback(struct afs_callback_arg *aca)
 {
        struct para_buffer pb = {
                .max_size = shm_get_shmmax(),
                .private_data = &(struct afs_max_size_handler_data) {
-                       .fd = fd,
+                       .fd = aca->fd,
                        .band = SBD_OUTPUT
                },
                .max_size_handler = afs_max_size_handler,
        };
-       char *arg = query->data;
+       char *arg = aca->query.data;
        int num_admissible, ret;
 
        ret = clear_score_table();
@@ -849,16 +849,16 @@ static int call_callback(int fd, int query_shmid)
 {
        void *query_shm;
        struct callback_query *cq;
-       struct osl_object query;
        int ret, ret2;
+       struct afs_callback_arg aca = {.fd = fd};
 
        ret = shm_attach(query_shmid, ATTACH_RW, &query_shm);
        if (ret < 0)
                return ret;
        cq = query_shm;
-       query.data = (char *)query_shm + sizeof(*cq);
-       query.size = cq->query_size;
-       ret = cq->handler(fd, &query);
+       aca.query.data = (char *)query_shm + sizeof(*cq);
+       aca.query.size = cq->query_size;
+       ret = cq->handler(&aca);
        ret2 = shm_detach(query_shm);
        if (ret2 < 0) {
                if (ret < 0) /* ignore (but log) detach error */
@@ -1033,14 +1033,14 @@ out:
        exit(EXIT_FAILURE);
 }
 
-static int com_init_callback(int fd, const struct osl_object *query)
+static int com_init_callback(struct afs_callback_arg *aca)
 {
-       uint32_t table_mask = *(uint32_t *)query->data;
+       uint32_t table_mask = *(uint32_t *)aca->query.data;
        int i, ret;
        struct para_buffer pb = {
                .max_size = shm_get_shmmax(),
                .private_data = &(struct afs_max_size_handler_data) {
-                       .fd = fd,
+                       .fd = aca->fd,
                        .band = SBD_OUTPUT
                }
        };