]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - afs.h
afs: Make afs callbacks more flexible.
[paraslash.git] / afs.h
diff --git a/afs.h b/afs.h
index fb704046caafe3ae09008ab53c0437ba73137bc6..81012ff888a95e2a9b7232671b0577d0b6ffd19d 100644 (file)
--- a/afs.h
+++ b/afs.h
@@ -157,6 +157,13 @@ struct pattern_match_data {
        int (*action)(struct osl_table *table, struct osl_row *row, const char *name, void *data);
 };
 
        int (*action)(struct osl_table *table, struct osl_row *row, const char *name, void *data);
 };
 
+/** Arguments passed to each afs callback. */
+struct afs_callback_arg {
+       /** The local socket connecting afs and the command handler. */
+       int fd;
+       /** Callback-specific data. */
+       struct osl_object query;
+};
 
 /**
  * Afs command handlers run as a process which is not related to the afs
 
 /**
  * Afs command handlers run as a process which is not related to the afs
@@ -166,7 +173,7 @@ struct pattern_match_data {
  *
  * \sa send_callback_request().
  */
  *
  * \sa send_callback_request().
  */
-typedef int afs_callback(int fd, const struct osl_object *);
+typedef int afs_callback(struct afs_callback_arg *aca);
 
 /**
  * Callbacks send chunks to data back to the command handler. Pointers to
 
 /**
  * Callbacks send chunks to data back to the command handler. Pointers to
@@ -242,7 +249,7 @@ void attribute_init(struct afs_table *t);
 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 get_attribute_text(uint64_t *atts, const char *delim, char **text);
 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 get_attribute_text(uint64_t *atts, const char *delim, char **text);
-int attribute_check_callback(int fd, __a_unused const struct osl_object *query);
+int attribute_check_callback(struct afs_callback_arg *aca);
 
 /* aft */
 void aft_init(struct afs_table *t);
 
 /* aft */
 void aft_init(struct afs_table *t);
@@ -254,12 +261,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);
-int aft_check_callback(int fd, __a_unused const struct osl_object *query);
+int aft_check_callback(struct afs_callback_arg *aca);
 
 /* playlist */
 int playlist_open(char *name);
 void playlist_close(void);
 
 /* playlist */
 int playlist_open(char *name);
 void playlist_close(void);
-int playlist_check_callback(int fd, __a_unused const struct osl_object *query);
+int playlist_check_callback(struct afs_callback_arg *aca);
 
 /** 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)))