X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=afs.c;h=1350db3423c3a184cb645e09cae9a2ebb060358b;hp=8e3aa9235c15dcb53f099685fc74f665ab61a3d6;hb=f4cc69fd2fad1e51f47be16f552e7a114f43eade;hpb=a37e903213215dd36b11bbde4ea98e1d4590a472 diff --git a/afs.c b/afs.c index 8e3aa923..1350db34 100644 --- a/afs.c +++ b/afs.c @@ -29,6 +29,7 @@ #include "sched.h" #include "signal.h" #include "fd.h" +#include "mood.h" /** The osl tables used by afs. \sa blob.c. */ enum afs_table_num { @@ -59,13 +60,13 @@ enum afs_table_num { }; static struct afs_table afs_tables[NUM_AFS_TABLES] = { - [TBLNUM_AUDIO_FILES] = {.init = aft_init}, - [TBLNUM_ATTRIBUTES] = {.init = attribute_init}, - [TBLNUM_SCORES] = {.init = score_init}, - [TBLNUM_MOODS] = {.init = moods_init}, - [TBLNUM_LYRICS] = {.init = lyrics_init}, - [TBLNUM_IMAGES] = {.init = images_init}, - [TBLNUM_PLAYLIST] = {.init = playlists_init}, + [TBLNUM_AUDIO_FILES] = {.init = aft_init, .name = "audio_files"}, + [TBLNUM_ATTRIBUTES] = {.init = attribute_init, .name = "attributes"}, + [TBLNUM_SCORES] = {.init = score_init, .name = "scores"}, + [TBLNUM_MOODS] = {.init = moods_init, .name = "moods"}, + [TBLNUM_LYRICS] = {.init = lyrics_init, .name = "lyrics"}, + [TBLNUM_IMAGES] = {.init = images_init, .name = "images"}, + [TBLNUM_PLAYLIST] = {.init = playlists_init, .name = "playlists"}, }; struct command_task { @@ -1002,7 +1003,7 @@ static void create_tables_callback(int fd, const struct osl_object *query) { uint32_t table_mask = *(uint32_t *)query->data; int i, ret; - char *buf; + struct para_buffer pb = {.buf = NULL}; close_afs_tables(); for (i = 0; i < NUM_AFS_TABLES; i++) { @@ -1015,15 +1016,15 @@ static void create_tables_callback(int fd, const struct osl_object *query) ret = t->create(database_dir); if (ret < 0) goto out; + para_printf(&pb, "successfully created %s table\n", t->name); } ret = open_afs_tables(); out: - if (ret >= 0) - buf = make_message("successfully created afs table(s)\n"); - else - buf = make_message("%s\n", para_strerror(-ret)); - pass_buffer_as_shm(buf, strlen(buf), &fd); - free(buf); + if (ret < 0) + para_printf(&pb, "%s\n", para_strerror(-ret)); + if (pb.buf) + pass_buffer_as_shm(pb.buf, pb.offset, &fd); + free(pb.buf); } int com_init(struct rc4_context *rc4c, int argc, char * const * const argv)