]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
Let afs callbacks return an error code.
authorAndre Noll <maan@tuebingen.mpg.de>
Sat, 4 Apr 2015 21:45:11 +0000 (21:45 +0000)
committerAndre Noll <maan@tuebingen.mpg.de>
Wed, 12 Aug 2015 21:23:47 +0000 (23:23 +0200)
It was a design mistake that callbacks have no way to tell whether
they were successful. This commit changes the callback_function
typedef so that callbacks return int instead of void.

Naturally, every callback must be adjusted accordingly. Doing so would
make the patch a bit large, so as a first step we make all callbacks
(except path_brother_callback() and hash_sister_callback() which
are special) return zero. The return value is ignored at the moment,
so the changes of this commit have no effect yet.

afs.c
afs.h
aft.c
attribute.c
blob.c
mood.c
mood.h
playlist.c

diff --git a/afs.c b/afs.c
index 0b2a4765b16f82fbde4674ac230bda4d2b5f9e18..24e737b67e3995c8723cd1d7ae7f72899554c322 100644 (file)
--- a/afs.c
+++ b/afs.c
@@ -578,7 +578,7 @@ void flush_and_free_pb(struct para_buffer *pb)
        free(pb->buf);
 }
 
        free(pb->buf);
 }
 
-static void com_select_callback(int fd, const struct osl_object *query)
+static int com_select_callback(int fd, const struct osl_object *query)
 {
        struct para_buffer pb = {
                .max_size = shm_get_shmmax(),
 {
        struct para_buffer pb = {
                .max_size = shm_get_shmmax(),
@@ -617,6 +617,7 @@ static void com_select_callback(int fd, const struct osl_object *query)
                        num_admissible);
 out:
        flush_and_free_pb(&pb);
                        num_admissible);
 out:
        flush_and_free_pb(&pb);
+       return 0;
 }
 
 int com_select(struct command_context *cc)
 }
 
 int com_select(struct command_context *cc)
@@ -1005,7 +1006,7 @@ out:
        exit(EXIT_FAILURE);
 }
 
        exit(EXIT_FAILURE);
 }
 
-static void create_tables_callback(int fd, const struct osl_object *query)
+static int create_tables_callback(int fd, const struct osl_object *query)
 {
        uint32_t table_mask = *(uint32_t *)query->data;
        int i, ret;
 {
        uint32_t table_mask = *(uint32_t *)query->data;
        int i, ret;
@@ -1035,6 +1036,7 @@ out:
        if (ret < 0)
                para_printf(&pb, "%s\n", para_strerror(-ret));
        flush_and_free_pb(&pb);
        if (ret < 0)
                para_printf(&pb, "%s\n", para_strerror(-ret));
        flush_and_free_pb(&pb);
+       return 0;
 }
 
 int com_init(struct command_context *cc)
 }
 
 int com_init(struct command_context *cc)
diff --git a/afs.h b/afs.h
index feada5b622c642ee7ae9fffd243551ffce2dc2f8..efd7fbacf61d1bea136e7162c14407c66b457b82 100644 (file)
--- a/afs.h
+++ b/afs.h
@@ -166,7 +166,7 @@ struct pattern_match_data {
  *
  * \sa send_callback_request().
  */
  *
  * \sa send_callback_request().
  */
-typedef void callback_function(int fd, const struct osl_object *);
+typedef int callback_function(int fd, const struct osl_object *);
 
 /**
  * Callbacks send chunks to data back to the command handler. Pointers to
 
 /**
  * Callbacks send chunks to data back to the command handler. Pointers to
@@ -252,12 +252,12 @@ int get_afsi_of_row(const struct osl_row *row, struct afs_info *afsi);
 int get_afhi_of_row(const struct osl_row *row, struct afh_info *afhi);
 int get_audio_file_path_of_row(const struct osl_row *row, char **path);
 int audio_file_loop(void *private_data, osl_rbtree_loop_func *func);
 int get_afhi_of_row(const struct osl_row *row, struct afh_info *afhi);
 int get_audio_file_path_of_row(const struct osl_row *row, char **path);
 int audio_file_loop(void *private_data, osl_rbtree_loop_func *func);
-void aft_check_callback(int fd, __a_unused const struct osl_object *query);
+int aft_check_callback(int fd, __a_unused const struct osl_object *query);
 
 /* playlist */
 int playlist_open(char *name);
 void playlist_close(void);
 
 /* playlist */
 int playlist_open(char *name);
 void playlist_close(void);
-void playlist_check_callback(int fd, __a_unused const struct osl_object *query);
+int playlist_check_callback(int fd, __a_unused const struct osl_object *query);
 
 /** evaluates to 1 if x < y, to -1 if x > y and to 0 if x == y */
 #define NUM_COMPARE(x, y) ((int)((x) < (y)) - (int)((x) > (y)))
 
 /** evaluates to 1 if x < y, to -1 if x > y and to 0 if x == y */
 #define NUM_COMPARE(x, y) ((int)((x) < (y)) - (int)((x) > (y)))
diff --git a/aft.c b/aft.c
index 16de67634677c4ba75774bc9453ae427f4581a13..acb6c6bf879f838976652ca3c48cfbf3ff75f70c 100644 (file)
--- a/aft.c
+++ b/aft.c
@@ -1291,7 +1291,7 @@ err:
        return ret;
 }
 
        return ret;
 }
 
-static void com_ls_callback(int fd, const struct osl_object *query)
+static int com_ls_callback(int fd, const struct osl_object *query)
 {
        struct ls_options *opts = query->data;
        char *p, *pattern_start = (char *)query->data + sizeof(*opts);
 {
        struct ls_options *opts = query->data;
        char *p, *pattern_start = (char *)query->data + sizeof(*opts);
@@ -1348,6 +1348,7 @@ out:
        free(opts->data);
        free(opts->data_ptr);
        free(opts->patterns);
        free(opts->data);
        free(opts->data_ptr);
        free(opts->patterns);
+       return 0;
 }
 
 /*
 }
 
 /*
@@ -1612,7 +1613,7 @@ enum com_add_flags {
        ADD_FLAG_ALL = 8,
 };
 
        ADD_FLAG_ALL = 8,
 };
 
-static void com_add_callback(int fd, const struct osl_object *query)
+static int com_add_callback(int fd, const struct osl_object *query)
 {
        char *buf = query->data, *path;
        struct osl_row *pb, *aft_row;
 {
        char *buf = query->data, *path;
        struct osl_row *pb, *aft_row;
@@ -1738,6 +1739,7 @@ out:
        if (ret < 0)
                para_printf(&msg, "%s\n", para_strerror(-ret));
        flush_and_free_pb(&msg);
        if (ret < 0)
                para_printf(&msg, "%s\n", para_strerror(-ret));
        flush_and_free_pb(&msg);
+       return 0;
 }
 
 /** Used by com_add(). */
 }
 
 /** Used by com_add(). */
@@ -1748,26 +1750,26 @@ struct private_add_data {
        uint32_t flags;
 };
 
        uint32_t flags;
 };
 
-static void path_brother_callback(int fd, const struct osl_object *query)
+static int path_brother_callback(int fd, const struct osl_object *query)
 {
        char *path = query->data;
        struct osl_row *path_brother;
        int ret = aft_get_row_of_path(path, &path_brother);
        if (ret < 0)
 {
        char *path = query->data;
        struct osl_row *path_brother;
        int ret = aft_get_row_of_path(path, &path_brother);
        if (ret < 0)
-               return;
-       pass_buffer_as_shm(fd, SBD_OUTPUT, (char *)&path_brother,
+               return ret;
+       return pass_buffer_as_shm(fd, SBD_OUTPUT, (char *)&path_brother,
                sizeof(path_brother));
 }
 
                sizeof(path_brother));
 }
 
-static void hash_sister_callback(int fd, const struct osl_object *query)
+static int hash_sister_callback(int fd, const struct osl_object *query)
 {
        unsigned char *hash = query->data;
        struct osl_row *hash_sister;
 
        hash_sister = find_hash_sister(hash);
        if (!hash_sister)
 {
        unsigned char *hash = query->data;
        struct osl_row *hash_sister;
 
        hash_sister = find_hash_sister(hash);
        if (!hash_sister)
-               return;
-       pass_buffer_as_shm(fd, SBD_OUTPUT, (char *)&hash_sister,
+               return 0;
+       return pass_buffer_as_shm(fd, SBD_OUTPUT, (char *)&hash_sister,
                sizeof(hash_sister));
 }
 
                sizeof(hash_sister));
 }
 
@@ -2009,7 +2011,7 @@ static int touch_audio_file(__a_unused struct osl_table *table,
        return 1;
 }
 
        return 1;
 }
 
-static void com_touch_callback(int fd, const struct osl_object *query)
+static int com_touch_callback(int fd, const struct osl_object *query)
 {
        struct touch_action_data tad = {.cto = query->data,
                .pb = {
 {
        struct touch_action_data tad = {.cto = query->data,
                .pb = {
@@ -2039,6 +2041,7 @@ static void com_touch_callback(int fd, const struct osl_object *query)
        else if (pmd.num_matches == 0)
                para_printf(&tad.pb, "no matches\n");
        flush_and_free_pb(&tad.pb);
        else if (pmd.num_matches == 0)
                para_printf(&tad.pb, "no matches\n");
        flush_and_free_pb(&tad.pb);
+       return 0;
 }
 
 int com_touch(struct command_context *cc)
 }
 
 int com_touch(struct command_context *cc)
@@ -2148,7 +2151,7 @@ static int remove_audio_file(__a_unused struct osl_table *table,
        return ret;
 }
 
        return ret;
 }
 
-static void com_rm_callback(int fd, const struct osl_object *query)
+static int com_rm_callback(int fd, const struct osl_object *query)
 {
        struct com_rm_action_data crd = {.flags = *(uint32_t *)query->data,
                .pb = {
 {
        struct com_rm_action_data crd = {.flags = *(uint32_t *)query->data,
                .pb = {
@@ -2175,13 +2178,14 @@ static void com_rm_callback(int fd, const struct osl_object *query)
        ret = for_each_matching_row(&pmd);
        if (ret < 0) {
                para_printf(&crd.pb, "%s\n", para_strerror(-ret));
        ret = for_each_matching_row(&pmd);
        if (ret < 0) {
                para_printf(&crd.pb, "%s\n", para_strerror(-ret));
-               return;
+               return 0;
        }
        if ((pmd.num_matches == 0) && !(crd.flags & RM_FLAG_FORCE))
                para_printf(&crd.pb, "no matches -- nothing removed\n");
        else if (crd.flags & RM_FLAG_VERBOSE)
                para_printf(&crd.pb, "removed %u files\n", pmd.num_matches);
        flush_and_free_pb(&crd.pb);
        }
        if ((pmd.num_matches == 0) && !(crd.flags & RM_FLAG_FORCE))
                para_printf(&crd.pb, "no matches -- nothing removed\n");
        else if (crd.flags & RM_FLAG_VERBOSE)
                para_printf(&crd.pb, "removed %u files\n", pmd.num_matches);
        flush_and_free_pb(&crd.pb);
+       return 0;
 }
 
 /* TODO options: -r (recursive) */
 }
 
 /* TODO options: -r (recursive) */
@@ -2285,7 +2289,7 @@ static int copy_selector_info(__a_unused struct osl_table *table,
        return 1;
 }
 
        return 1;
 }
 
-static void com_cpsi_callback(int fd, const struct osl_object *query)
+static int com_cpsi_callback(int fd, const struct osl_object *query)
 {
        struct cpsi_action_data cad = {
                .flags = *(unsigned *)query->data,
 {
        struct cpsi_action_data cad = {
                .flags = *(unsigned *)query->data,
@@ -2325,6 +2329,7 @@ out:
        } else
                para_printf(&cad.pb, "no matches - nothing copied\n");
        flush_and_free_pb(&cad.pb);
        } else
                para_printf(&cad.pb, "no matches - nothing copied\n");
        flush_and_free_pb(&cad.pb);
+       return 0;
 }
 
 int com_cpsi(struct command_context *cc)
 }
 
 int com_cpsi(struct command_context *cc)
@@ -2409,7 +2414,7 @@ static int change_atts(__a_unused struct osl_table *table,
        return 1;
 }
 
        return 1;
 }
 
-static void com_setatt_callback(int fd, const struct osl_object *query)
+static int com_setatt_callback(int fd, const struct osl_object *query)
 {
        char *p;
        int ret;
 {
        char *p;
        int ret;
@@ -2470,6 +2475,7 @@ out:
        if (ret < 0)
                para_printf(&cad.pb, "%s\n", para_strerror(-ret));
        flush_and_free_pb(&cad.pb);
        if (ret < 0)
                para_printf(&cad.pb, "%s\n", para_strerror(-ret));
        flush_and_free_pb(&cad.pb);
+       return 0;
 }
 
 int com_setatt(struct command_context *cc)
 }
 
 int com_setatt(struct command_context *cc)
@@ -2480,15 +2486,15 @@ int com_setatt(struct command_context *cc)
                com_setatt_callback, afs_cb_result_handler, cc);
 }
 
                com_setatt_callback, afs_cb_result_handler, cc);
 }
 
-static void afs_stat_callback(int fd, const struct osl_object *query)
+static int afs_stat_callback(int fd, const struct osl_object *query)
 {
        int *parser_friendly = query->data;
        char *buf = *parser_friendly?
                parser_friendly_status_items : status_items;
 
        if (!buf)
 {
        int *parser_friendly = query->data;
        char *buf = *parser_friendly?
                parser_friendly_status_items : status_items;
 
        if (!buf)
-               return;
-       pass_buffer_as_shm(fd, SBD_OUTPUT, buf, strlen(buf));
+               return 0;
+       return pass_buffer_as_shm(fd, SBD_OUTPUT, buf, strlen(buf));
 }
 
 /**
 }
 
 /**
@@ -2554,11 +2560,11 @@ static int check_audio_file(struct osl_row *row, void *data)
  * \param fd The afs socket.
  * \param query Unused.
  *
  * \param fd The afs socket.
  * \param query Unused.
  *
- * This function always succeeds.
+ * \return This function always returns zero.
  *
  * \sa com_check().
  */
  *
  * \sa com_check().
  */
-void aft_check_callback(int fd, __a_unused const struct osl_object *query)
+int aft_check_callback(int fd, __a_unused const struct osl_object *query)
 {
        struct para_buffer pb = {
                .max_size = shm_get_shmmax(),
 {
        struct para_buffer pb = {
                .max_size = shm_get_shmmax(),
@@ -2571,6 +2577,7 @@ void aft_check_callback(int fd, __a_unused const struct osl_object *query)
        para_printf(&pb, "checking audio file table...\n");
        audio_file_loop(&pb, check_audio_file);
        flush_and_free_pb(&pb);
        para_printf(&pb, "checking audio file table...\n");
        audio_file_loop(&pb, check_audio_file);
        flush_and_free_pb(&pb);
+       return 0;
 }
 
 /**
 }
 
 /**
index 0c23addf3228fb753f5ded3b49dafb45f4d5823e..7da525eb90c7f6feef5a8af631e2be06e4b38dca 100644 (file)
@@ -149,7 +149,7 @@ static int print_attribute(struct osl_table *table, struct osl_row *row,
        return 1;
 }
 
        return 1;
 }
 
-static void com_lsatt_callback(int fd, const struct osl_object *query)
+static int com_lsatt_callback(int fd, const struct osl_object *query)
 {
        struct lsatt_action_data laad = {
                .flags = *(unsigned *) query->data,
 {
        struct lsatt_action_data laad = {
                .flags = *(unsigned *) query->data,
@@ -179,6 +179,7 @@ static void com_lsatt_callback(int fd, const struct osl_object *query)
                pmd.pm_flags |= PM_REVERSE_LOOP;
        for_each_matching_row(&pmd);
        flush_and_free_pb(&laad.pb);
                pmd.pm_flags |= PM_REVERSE_LOOP;
        for_each_matching_row(&pmd);
        flush_and_free_pb(&laad.pb);
+       return 0;
 }
 
 int com_lsatt(struct command_context *cc)
 }
 
 int com_lsatt(struct command_context *cc)
@@ -223,7 +224,7 @@ struct addatt_event_data {
 };
 
 
 };
 
 
-static void com_addatt_callback(int fd, const struct osl_object *query)
+static int com_addatt_callback(int fd, const struct osl_object *query)
 {
        char *p;
        int ret = 1;
 {
        char *p;
        int ret = 1;
@@ -285,6 +286,7 @@ out:
        if (ret < 0)
                para_printf(&pb, "%s: %s\n", p, para_strerror(-ret));
        flush_and_free_pb(&pb);
        if (ret < 0)
                para_printf(&pb, "%s: %s\n", p, para_strerror(-ret));
        flush_and_free_pb(&pb);
+       return 0;
 }
 
 int com_addatt(struct command_context *cc)
 }
 
 int com_addatt(struct command_context *cc)
@@ -300,7 +302,7 @@ int com_addatt(struct command_context *cc)
        return ret;
 }
 
        return ret;
 }
 
-static void com_mvatt_callback(int fd, const struct osl_object *query)
+static int com_mvatt_callback(int fd, const struct osl_object *query)
 {
        char *old = query->data;
        size_t size = strlen(old) + 1;
 {
        char *old = query->data;
        size_t size = strlen(old) + 1;
@@ -329,6 +331,7 @@ out:
        else
                afs_event(ATTRIBUTE_RENAME, &pb, NULL);
        flush_and_free_pb(&pb);
        else
                afs_event(ATTRIBUTE_RENAME, &pb, NULL);
        flush_and_free_pb(&pb);
+       return 0;
 }
 
 int com_mvatt(struct command_context *cc)
 }
 
 int com_mvatt(struct command_context *cc)
@@ -379,7 +382,7 @@ static int remove_attribute(struct osl_table *table, struct osl_row *row,
        return 1;
 }
 
        return 1;
 }
 
-static void com_rmatt_callback(int fd, const struct osl_object *query)
+static int com_rmatt_callback(int fd, const struct osl_object *query)
 {
        struct remove_attribute_action_data raad = {
                .num_removed = 0,
 {
        struct remove_attribute_action_data raad = {
                .num_removed = 0,
@@ -407,6 +410,7 @@ static void com_rmatt_callback(int fd, const struct osl_object *query)
        else if (!raad.num_removed)
                para_printf(&raad.pb, "no match -- nothing removed\n");
        flush_and_free_pb(&raad.pb);
        else if (!raad.num_removed)
                para_printf(&raad.pb, "no match -- nothing removed\n");
        flush_and_free_pb(&raad.pb);
+       return 0;
 }
 
 int com_rmatt(struct command_context *cc)
 }
 
 int com_rmatt(struct command_context *cc)
diff --git a/blob.c b/blob.c
index 47253b5e08811c7fbb4a2c2aa12e6f368307454c..5eb125c8262f6b34aaff506f9c6cb1310fa5916d 100644 (file)
--- a/blob.c
+++ b/blob.c
@@ -130,7 +130,7 @@ static int print_blob(struct osl_table *table, struct osl_row *row,
        return 1;
 }
 
        return 1;
 }
 
-static void com_lsblob_callback(struct osl_table *table,
+static int com_lsblob_callback(struct osl_table *table,
                int fd, const struct osl_object *query)
 {
        struct lsblob_action_data lbad = {
                int fd, const struct osl_object *query)
 {
        struct lsblob_action_data lbad = {
@@ -167,6 +167,7 @@ static void com_lsblob_callback(struct osl_table *table,
        else if (pmd.num_matches == 0 && pmd.patterns.size > 0)
                para_printf(&lbad.pb, "no matches\n");
        flush_and_free_pb(&lbad.pb);
        else if (pmd.num_matches == 0 && pmd.patterns.size > 0)
                para_printf(&lbad.pb, "no matches\n");
        flush_and_free_pb(&lbad.pb);
+       return 0;
 }
 
 static int com_lsblob(callback_function *f, struct command_context *cc)
 }
 
 static int com_lsblob(callback_function *f, struct command_context *cc)
@@ -218,7 +219,7 @@ static int cat_blob(struct osl_table *table, struct osl_row *row,
        return (ret < 0)? ret : ret2;
 }
 
        return (ret < 0)? ret : ret2;
 }
 
-static void com_catblob_callback(struct osl_table *table, int fd,
+static int com_catblob_callback(struct osl_table *table, int fd,
                const struct osl_object *query)
 {
        struct pattern_match_data pmd = {
                const struct osl_object *query)
 {
        struct pattern_match_data pmd = {
@@ -235,6 +236,7 @@ static void com_catblob_callback(struct osl_table *table, int fd,
                char err_msg[] = "no matches\n";
                pass_buffer_as_shm(fd, SBD_OUTPUT, err_msg, sizeof(err_msg));
        }
                char err_msg[] = "no matches\n";
                pass_buffer_as_shm(fd, SBD_OUTPUT, err_msg, sizeof(err_msg));
        }
+       return 0;
 }
 
 static int com_catblob(callback_function *f, struct command_context *cc)
 }
 
 static int com_catblob(callback_function *f, struct command_context *cc)
@@ -263,7 +265,7 @@ static int remove_blob(struct osl_table *table, struct osl_row *row,
        return 1;
 }
 
        return 1;
 }
 
-static void com_rmblob_callback(struct osl_table *table, int fd,
+static int com_rmblob_callback(struct osl_table *table, int fd,
                const struct osl_object *query)
 {
        int ret;
                const struct osl_object *query)
 {
        int ret;
@@ -296,6 +298,7 @@ static void com_rmblob_callback(struct osl_table *table, int fd,
                afs_event(BLOB_RENAME, NULL, table);
        }
        flush_and_free_pb(&rmbd.pb);
                afs_event(BLOB_RENAME, NULL, table);
        }
        flush_and_free_pb(&rmbd.pb);
+       return 0;
 }
 
 static int com_rmblob(callback_function *f, struct command_context *cc)
 }
 
 static int com_rmblob(callback_function *f, struct command_context *cc)
@@ -306,7 +309,7 @@ static int com_rmblob(callback_function *f, struct command_context *cc)
                afs_cb_result_handler, cc);
 }
 
                afs_cb_result_handler, cc);
 }
 
-static void com_addblob_callback(struct osl_table *table, int fd,
+static int com_addblob_callback(struct osl_table *table, int fd,
                const struct osl_object *query)
 {
        struct osl_object objs[NUM_BLOB_COLUMNS];
                const struct osl_object *query)
 {
        struct osl_object objs[NUM_BLOB_COLUMNS];
@@ -382,6 +385,7 @@ out:
                msg_len = xasprintf(&msg, "added %s as id %u\n", name, id);
        pass_buffer_as_shm(fd, SBD_OUTPUT, msg, msg_len);
        free(msg);
                msg_len = xasprintf(&msg, "added %s as id %u\n", name, id);
        pass_buffer_as_shm(fd, SBD_OUTPUT, msg, msg_len);
        free(msg);
+       return 0;
 }
 
 /* Write input from fd to dynamically allocated buffer, but maximal 10M. */
 }
 
 /* Write input from fd to dynamically allocated buffer, but maximal 10M. */
@@ -466,7 +470,7 @@ static int com_addblob(callback_function *f, struct command_context *cc)
        return stdin_command(cc, &arg_obj, f);
 }
 
        return stdin_command(cc, &arg_obj, f);
 }
 
-static void com_mvblob_callback(struct osl_table *table, int fd,
+static int com_mvblob_callback(struct osl_table *table, int fd,
                const struct osl_object *query)
 {
        char *src = (char *) query->data;
                const struct osl_object *query)
 {
        char *src = (char *) query->data;
@@ -496,6 +500,7 @@ static void com_mvblob_callback(struct osl_table *table, int fd,
        afs_event(BLOB_RENAME, NULL, table);
 out:
        flush_and_free_pb(&pb);
        afs_event(BLOB_RENAME, NULL, table);
 out:
        flush_and_free_pb(&pb);
+       return 0;
 }
 
 static int com_mvblob(callback_function *f, struct command_context *cc)
 }
 
 static int com_mvblob(callback_function *f, struct command_context *cc)
@@ -512,7 +517,7 @@ static int com_mvblob(callback_function *f, struct command_context *cc)
 }
 
 #define DEFINE_BLOB_COMMAND(cmd_name, table_name, cmd_prefix) \
 }
 
 #define DEFINE_BLOB_COMMAND(cmd_name, table_name, cmd_prefix) \
-       static void com_ ## cmd_name ## cmd_prefix ## _callback(int fd, const struct osl_object *query) \
+       static int com_ ## cmd_name ## cmd_prefix ## _callback(int fd, const struct osl_object *query) \
        { \
                return com_ ## cmd_name ## blob_callback(table_name ## _table, fd, query); \
        } \
        { \
                return com_ ## cmd_name ## blob_callback(table_name ## _table, fd, query); \
        } \
diff --git a/mood.c b/mood.c
index 13b5b1807a7e2705ff2a8e28561550274371150a..a98f68b2e44c997843148a0400d84d3ba02710be 100644 (file)
--- a/mood.c
+++ b/mood.c
@@ -432,8 +432,10 @@ out:
  *
  * \param fd The afs socket.
  * \param query Unused.
  *
  * \param fd The afs socket.
  * \param query Unused.
+ *
+ * \return Currently this function always returns zero.
  */
  */
-void mood_check_callback(int fd, __a_unused const struct osl_object *query)
+int mood_check_callback(int fd, __a_unused const struct osl_object *query)
 {
        struct para_buffer pb = {
                .max_size = shm_get_shmmax(),
 {
        struct para_buffer pb = {
                .max_size = shm_get_shmmax(),
@@ -448,6 +450,7 @@ void mood_check_callback(int fd, __a_unused const struct osl_object *query)
        osl_rbtree_loop(moods_table, BLOBCOL_ID, &pb,
                check_mood);
        flush_and_free_pb(&pb);
        osl_rbtree_loop(moods_table, BLOBCOL_ID, &pb,
                check_mood);
        flush_and_free_pb(&pb);
+       return 0;
 }
 
 static int64_t normalized_value(int64_t x, int64_t n, int64_t sum, int64_t qd)
 }
 
 static int64_t normalized_value(int64_t x, int64_t n, int64_t sum, int64_t qd)
diff --git a/mood.h b/mood.h
index 2630ba1607fec7e8467ea9a7baca8b5ab263315f..4ea10ef8b988caf5b9e3771a8cb890970ae46cde 100644 (file)
--- a/mood.h
+++ b/mood.h
@@ -8,4 +8,4 @@
 
 int change_current_mood(char *mood_name);
 void close_current_mood(void);
 
 int change_current_mood(char *mood_name);
 void close_current_mood(void);
-void mood_check_callback(int fd, __a_unused const struct osl_object *query);
+int mood_check_callback(int fd, __a_unused const struct osl_object *query);
index 2c5b67777e2f0b41671bc436e3ef7b02f83e6740..e3569358fffeac5dd83799ef6cea60a078edf9ee 100644 (file)
@@ -126,8 +126,10 @@ static int check_playlist(struct osl_row *row, void *data)
  *
  * \param fd The afs socket.
  * \param query Unused.
  *
  * \param fd The afs socket.
  * \param query Unused.
+ *
+ * \return Currently this function always returns zero.
  */
  */
-void playlist_check_callback(int fd, __a_unused const struct osl_object *query)
+int playlist_check_callback(int fd, __a_unused const struct osl_object *query)
 {
        struct para_buffer pb = {
                .max_size = shm_get_shmmax(),
 {
        struct para_buffer pb = {
                .max_size = shm_get_shmmax(),
@@ -141,6 +143,7 @@ void playlist_check_callback(int fd, __a_unused const struct osl_object *query)
        osl_rbtree_loop(playlists_table, BLOBCOL_ID, &pb,
                check_playlist);
        flush_and_free_pb(&pb);
        osl_rbtree_loop(playlists_table, BLOBCOL_ID, &pb,
                check_playlist);
        flush_and_free_pb(&pb);
+       return 0;
 }
 
 /**
 }
 
 /**