]> arthur.barton.de Git - netatalk.git/blobdiff - etc/afpd/afp_dsi.c
Move and rename Spotlight module
[netatalk.git] / etc / afpd / afp_dsi.c
index 70caf468694d6318060fb69591acf8e940126b49..44d5b0e601d3b1ba7c0d9ea3df6ac6b35100ea33 100644 (file)
@@ -39,6 +39,7 @@
 #include <atalk/fce_api.h>
 #include <atalk/globals.h>
 #include <atalk/netatalk_conf.h>
+#include <atalk/spotlight.h>
 
 #include "switch.h"
 #include "auth.h"
@@ -143,8 +144,6 @@ static void afp_dsi_die(int sig)
 /* SIGQUIT handler */
 static void ipc_reconnect_handler(int sig _U_)
 {
-    DSI *dsi = (DSI *)AFPobj->dsi;
-
     if (reconnect_ipc(AFPobj) != 0) {
         LOG(log_error, logtype_afpd, "ipc_reconnect_handler: failed IPC reconnect");
         afp_dsi_close(AFPobj);
@@ -381,9 +380,6 @@ static void pending_request(DSI *dsi)
 void afp_over_dsi_sighandlers(AFPObj *obj)
 {
     DSI *dsi = (DSI *) obj->dsi;
-    int rc_idx;
-    uint32_t err, cmd;
-    uint8_t function;
     struct sigaction action;
 
     memset(&action, 0, sizeof(action));
@@ -455,10 +451,10 @@ void afp_over_dsi_sighandlers(AFPObj *obj)
 */
 void afp_over_dsi(AFPObj *obj)
 {
-    DSI *dsi = (DSI *) obj->handle;
+    DSI *dsi = (DSI *) obj->dsi;
     int rc_idx;
-    u_int32_t err, cmd;
-    u_int8_t function;
+    uint32_t err, cmd;
+    uint8_t function;
 
     AFPobj = obj;
     obj->exit = afp_dsi_die;
@@ -495,6 +491,10 @@ void afp_over_dsi(AFPObj *obj)
     int flag = 1;
     setsockopt(dsi->socket, SOL_TCP, TCP_NODELAY, &flag, sizeof(flag));
 
+    /* Initialize Spotlight */
+    if (obj->options.flags & OPTION_SPOTLIGHT)
+        sl_mod_load(_PATH_AFPDUAMPATH "slmod_sparql.so");
+
     /* get stuck here until the end */
     while (1) {
         if (sigsetjmp(recon_jmp, 1) != 0)
@@ -552,7 +552,7 @@ void afp_over_dsi(AFPObj *obj)
 
         if (reload_request) {
             reload_request = 0;
-            load_volumes(AFPobj, closevol);
+            load_volumes(AFPobj);
         }
 
         /* The first SIGINT enables debugging, the next restores the config */
@@ -629,7 +629,7 @@ void afp_over_dsi(AFPObj *obj)
                     LOG(log_debug, logtype_afpd, "<== Start AFP command: %s", AfpNum2name(function));
 
                     err = (*afp_switch[function])(obj,
-                                                  (char *)&dsi->commands, dsi->cmdlen,
+                                                  (char *)dsi->commands, dsi->cmdlen,
                                                   (char *)&dsi->data, &dsi->datalen);
 
                     LOG(log_debug, logtype_afpd, "==> Finished AFP command: %s -> %s",
@@ -670,7 +670,7 @@ void afp_over_dsi(AFPObj *obj)
                 LOG(log_debug, logtype_afpd, "<== Start AFP command: %s", AfpNum2name(function));
 
                 err = (*afp_switch[function])(obj,
-                                              (char *)&dsi->commands, dsi->cmdlen,
+                                              (char *)dsi->commands, dsi->cmdlen,
                                               (char *)&dsi->data, &dsi->datalen);
 
                 LOG(log_debug, logtype_afpd, "==> Finished AFP command: %s -> %s",