static int sl_rpc_openQuery(const AFPObj *obj, const DALLOC_CTX *query, DALLOC_CTX *reply, const struct vol *v)
{
EC_INIT;
+
+ char **sl_query;
+ EC_NULL_LOG( sl_query = dalloc_value_for_key(query, "DALLOC_CTX", 0, "DALLOC_CTX", 1, "kMDQueryString") );
+
+ LOG(log_debug, logtype_sl, "sl_rpc_openQuery: %s", *sl_query);
+
EC_CLEANUP:
EC_EXIT;
}
EC_NULL( reply = talloc_zero(tmp_ctx, DALLOC_CTX) );
EC_NEG1_LOG( sl_unpack(query, ibuf + 22) );
+ dd_dump(query, 0);
char **cmd;
EC_NULL_LOG( cmd = dalloc_get(query, "DALLOC_CTX", 0, "DALLOC_CTX", 0, "char *", 0) );
--- /dev/null
+/*
+ Copyright (c) 2012 Frank Lahm <franklahm@gmail.com>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+*/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif /* HAVE_CONFIG_H */
+
+#include <atalk/util.h>
+#include <atalk/errchk.h>
+#include <atalk/logger.h>
+
+#include "spotlight.h"
+
+int sl_mod_init(void *p)
+{
+ EC_INIT;
+
+ const char *msg = p;
+
+ LOG(log_note, logtype_sl, "sl_mod_init: %s", msg);
+
+EC_CLEANUP:
+ EC_EXIT;
+}
+
+struct sl_module_export sl_mod = {
+ SL_MODULE_VERSION,
+ sl_mod_init,
+ NULL,
+ NULL,
+ NULL
+};
void **dd_talloc_array;
} DALLOC_CTX;
-#define dalloc_add(d, obj, type) dalloc_add_talloc_chunk((d), talloc((d), type), (obj), sizeof(type));
-
/* Use dalloc_add() macro, not this function */
extern int dalloc_add_talloc_chunk(DALLOC_CTX *dd, void *talloc_chunk, void *obj, size_t size);
-extern void *dalloc_get(DALLOC_CTX *d, ...);
+#define dalloc_add(d, obj, type) dalloc_add_talloc_chunk((d), talloc((d), type), (obj), sizeof(type));
+extern void *dalloc_get(const DALLOC_CTX *d, ...);
+extern void *dalloc_value_for_key(const DALLOC_CTX *d, ...);
#endif /* DALLOC_H */
return 0;
}
-void *dalloc_get(DALLOC_CTX *d, ...)
+void *dalloc_get(const DALLOC_CTX *d, ...)
{
EC_INIT;
void *p = NULL;
p = NULL;
return p;
}
+
+void *dalloc_value_for_key(const DALLOC_CTX *d, ...)
+{
+ EC_INIT;
+ void *p = NULL;
+ va_list args;
+ const char *type;
+ int elem;
+ const char *elemtype;
+ char *s;
+
+ va_start(args, d);
+ type = va_arg(args, const char *);
+
+ if (STRCMP(type, !=, "DALLOC_CTX"))
+ EC_FAIL;
+
+ while (STRCMP(type, ==, "DALLOC_CTX")) {
+ elem = va_arg(args, int);
+ AFP_ASSERT(elem < talloc_array_length(d->dd_talloc_array));
+ d = d->dd_talloc_array[elem];
+ type = va_arg(args, const char *);
+ }
+
+ for (elem = 0; elem + 1 < talloc_array_length(d->dd_talloc_array); elem += 2) {
+ memcpy(&s, d->dd_talloc_array[elem], sizeof(char *));
+ if (STRCMP(s, ==, type)) {
+ p = d->dd_talloc_array[elem + 1];
+ break;
+ }
+ }
+ va_end(args);
+
+EC_CLEANUP:
+ if (ret != 0)
+ p = NULL;
+ return p;
+}