#include "dbwrap/dbwrap_open.h"
#include "dbwrap/dbwrap_tdb.h"
#include "dbwrap/dbwrap_ctdb.h"
+#include "lib/param/param.h"
#include "util_tdb.h"
#ifdef CLUSTER_SUPPORT
#include "ctdb_private.h"
#endif
if (result == NULL) {
- result = db_open_tdb(mem_ctx, name, hash_size,
+ struct loadparm_context *lp_ctx = loadparm_init_s3(mem_ctx, loadparm_s3_context());
+ result = db_open_tdb(mem_ctx, lp_ctx, name, hash_size,
tdb_flags, open_flags, mode,
lock_order);
+ talloc_unlink(mem_ctx, lp_ctx);
}
return result;
}
#include "dbwrap/dbwrap_private.h"
#include "dbwrap/dbwrap_tdb.h"
#include "lib/tdb_wrap/tdb_wrap.h"
-#include "lib/param/param.h"
#include "util_tdb.h"
struct db_tdb_ctx {
}
struct db_context *db_open_tdb(TALLOC_CTX *mem_ctx,
+ struct loadparm_context *lp_ctx,
const char *name,
int hash_size, int tdb_flags,
int open_flags, mode_t mode,
{
struct db_context *result = NULL;
struct db_tdb_ctx *db_tdb;
- struct loadparm_context *lp_ctx;
result = talloc_zero(mem_ctx, struct db_context);
if (result == NULL) {
DEBUG(0, ("talloc failed\n"));
goto fail;
}
- lp_ctx = loadparm_init_s3(result, loadparm_s3_context());
result->private_data = db_tdb = talloc(result, struct db_tdb_ctx);
if (db_tdb == NULL) {
db_tdb->wtdb = tdb_wrap_open(db_tdb, name, hash_size, tdb_flags,
open_flags, mode, lp_ctx);
- talloc_unlink(result, lp_ctx);
if (db_tdb->wtdb == NULL) {
DEBUG(3, ("Could not open tdb: %s\n", strerror(errno)));
goto fail;
struct db_context;
struct db_context *db_open_tdb(TALLOC_CTX *mem_ctx,
+ struct loadparm_context *lp_ctx,
const char *name,
int hash_size, int tdb_flags,
int open_flags, mode_t mode,
struct messaging_context *msg,
struct event_context *ev)
{
+ struct loadparm_context *lp_ctx;
struct notify_context *notify;
notify = talloc(mem_ctx, struct notify_context);
notify->msg = msg;
notify->list = NULL;
+ lp_ctx = loadparm_init_s3(notify, loadparm_s3_context());
notify->db_notify = db_open_tdb(
- notify, lock_path("notify.tdb"),
+ notify, lp_ctx, lock_path("notify.tdb"),
0, TDB_CLEAR_IF_FIRST|TDB_INCOMPATIBLE_HASH,
O_RDWR|O_CREAT, 0644, DBWRAP_LOCK_ORDER_2);
+ talloc_unlink(notify, lp_ctx);
if (notify->db_notify == NULL) {
goto fail;
}