X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=afs.h;h=0b35f3c7f2c9b5b028d0e4973efca0a580bb10fc;hp=fdc42f1f5aaa83e23645d32dacbd9eca89e1d2a0;hb=517c7292b342a7339c0b5d3d066a07b88efdf77a;hpb=f6f50d03a09d6bc423324206d274336e9905bbb4 diff --git a/afs.h b/afs.h index fdc42f1f..0b35f3c7 100644 --- a/afs.h +++ b/afs.h @@ -1,10 +1,7 @@ #include #include "osl.h" -#include "afh.h" #include "hash.h" -#define DATABASE_DIR "/home/maan/tmp/osl" /* FIXME */ - struct afs_info { uint64_t last_played; uint64_t attributes; @@ -94,12 +91,13 @@ struct audio_file_data { /* afs */ typedef int callback_function(const struct osl_object *, struct osl_object *); +__noreturn int afs_init(uint32_t cookie, int socket_fd); int send_callback_request(callback_function *f, struct osl_object *query, struct osl_object *result); -int send_standard_callback_request(int argc, const char **argv, +int send_standard_callback_request(int argc, char * const * const argv, callback_function *f, struct osl_object *result); int send_option_arg_callback_request(struct osl_object *options, - int argc, const char **argv, callback_function *f, + int argc, char * const * const argv, callback_function *f, struct osl_object *result); int stdin_command(struct osl_object *arg_obj, callback_function *f, unsigned max_len, struct osl_object *result); @@ -109,7 +107,7 @@ int open_next_audio_file(struct audio_file_data *afd); int close_audio_file(struct audio_file_data *afd); /* score */ -int score_init(struct table_info *ti); +int score_init(struct table_info *ti, const char *db); void score_shutdown(enum osl_close_flags flags); int admissible_file_loop(void *data, osl_rbtree_loop_func *func); int admissible_file_loop_reverse(void *data, osl_rbtree_loop_func *func); @@ -122,18 +120,14 @@ int score_delete(const struct osl_row *aft_row); int row_belongs_to_score_table(const struct osl_row *aft_row); /* attribute */ -int attribute_init(struct table_info *ti); +int attribute_init(struct table_info *ti, const char *db); void attribute_shutdown(enum osl_close_flags flags); -void get_attribute_bitmap(uint64_t *atts, char *buf); +void get_attribute_bitmap(const uint64_t *atts, char *buf); /* needed by com_ls() */ int get_attribute_bitnum_by_name(const char *att_name, unsigned char *bitnum); -int com_lsatt(int fd, int argc, const char **argv); -int com_setatt(int fd, int argc, const char **argv); -int com_addatt(int fd, int argc, const char **argv); -int com_rmatt(int fd, int argc, const char **argv); int get_attribute_text(uint64_t *atts, const char *delim, char **text); /* aft */ -int aft_init(struct table_info *ti); +int aft_init(struct table_info *ti, const char *db); void aft_shutdown(enum osl_close_flags flags); int aft_get_row_of_path(char *path, struct osl_row **row); int open_and_update_audio_file(struct osl_row *aft_row, struct audio_file_data *afd); @@ -141,12 +135,8 @@ int load_afsi(struct afs_info *afsi, struct osl_object *obj); void save_afsi(struct afs_info *afsi, struct osl_object *obj); int get_afsi_of_row(const struct osl_row *row, struct afs_info *afsi); int get_audio_file_path_of_row(const struct osl_row *row, char **path); -int get_afsi_object_of_row(const void *row, struct osl_object *obj); +int get_afsi_object_of_row(const struct osl_row *row, struct osl_object *obj); int audio_file_loop(void *private_data, osl_rbtree_loop_func *func); -int com_touch(int fd, int argc, const char **argv); -int com_add(int fd, int argc, const char **argv); -int com_afs_ls(int fd, int argc, const char **argv); -int com_afs_rm(int fd, int argc, const char **argv); /* mood */ int mood_open(char *mood_name); @@ -166,13 +156,8 @@ int playlist_update_audio_file(struct osl_row *aft_row); #define DECLARE_BLOB_SYMBOLS(table_name, cmd_prefix) \ - int table_name ## _init(struct table_info *ti); \ + int table_name ## _init(struct table_info *ti, const char *db); \ void table_name ## _shutdown(enum osl_close_flags flags); \ - int com_add ## cmd_prefix(int fd, int argc, const char **argv); \ - int com_rm ## cmd_prefix(int fd, int argc, const char **argv); \ - int com_cat ## cmd_prefix(int fd, int argc, const char **argv); \ - int com_ls ## cmd_prefix(int fd, int argc, const char **argv); \ - int com_mv ## cmd_prefix(int fd, int argc, const char **argv); \ int cmd_prefix ## _get_name_by_id(uint32_t id, char **name); \ extern struct osl_table *table_name ## _table; @@ -183,8 +168,7 @@ DECLARE_BLOB_SYMBOLS(playlists, pl); enum blob_table_columns {BLOBCOL_ID, BLOBCOL_NAME, BLOBCOL_DEF, NUM_BLOB_COLUMNS}; #define DEFINE_BLOB_TABLE_DESC(table_name) \ - const struct osl_table_description table_name ## _table_desc = { \ - .dir = DATABASE_DIR, \ + struct osl_table_description table_name ## _table_desc = { \ .name = #table_name, \ .num_columns = NUM_BLOB_COLUMNS, \ .flags = OSL_LARGE_TABLE, \