]> arthur.barton.de Git - netatalk.git/blobdiff - etc/afpd/spotlight.c
Start working on replying queries, add struct for storing query and a queue
[netatalk.git] / etc / afpd / spotlight.c
index a96883251034a24a15321b1e2086ba90e792f842..205a20e18b4c4e5ea9ae1ebb8b52105bfffd90a7 100644 (file)
 #include <atalk/byteorder.h>
 #include <atalk/netatalk_conf.h>
 #include <atalk/volume.h>
+#include <atalk/queue.h>
 
 #include "spotlight.h"
 
-void *sl_module;
-struct sl_module_export *sl_module_export;
-
+static void *sl_module;
+static struct sl_module_export *sl_module_export;
+static q_t *sl_queries;
 
 /* Helper functions and stuff */
 static const char *neststrings[] = {
@@ -153,6 +154,8 @@ static int sl_rpc_openQuery(const AFPObj *obj, const DALLOC_CTX *query, DALLOC_C
 
     LOG(log_debug, logtype_sl, "sl_rpc_openQuery: %s", *sl_query);
 
+    enqueue(sl_queries, query);
+
 EC_CLEANUP:
     EC_EXIT;
 }
@@ -165,6 +168,8 @@ int sl_mod_load(const char *path)
 {
     EC_INIT;
 
+    sl_queries = queue_init();
+
     if ((sl_module = mod_open(path)) == NULL) {
         LOG(log_error, logtype_sl, "sl_mod_load(%s): failed to load: %s", path, mod_error());
         EC_FAIL;