From 735290f474a34986be4c66eb0bdf0b0ba14da970 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Fri, 22 Jun 2012 09:44:41 +0930 Subject: util: util_ntdb.c The first function is ntdb_new: this is preferred over ntdb_open, as it makes the ntdb_context returned (and all NTDB_DATA returned from ntdb_fetch) valid talloc pointers. The API is very similar to tdb_wrap_open(). Note that we handle $TDB_NO_FSYNC here, since ntdb doesn't do that hack (and it's great for speeding up testing!). Signed-off-by: Rusty Russell --- lib/util/util_ntdb.h | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 lib/util/util_ntdb.h (limited to 'lib/util/util_ntdb.h') diff --git a/lib/util/util_ntdb.h b/lib/util/util_ntdb.h new file mode 100644 index 0000000000..a5eab7f436 --- /dev/null +++ b/lib/util/util_ntdb.h @@ -0,0 +1,47 @@ +/* + Unix SMB/CIFS implementation. + + tdb utility functions + + Copyright (C) Rusty Russell 2012 + + 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 3 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. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#ifndef _____LIB_UTIL_UTIL_NTDB_H__ +#define _____LIB_UTIL_UTIL_NTDB_H__ +#include +#include + +struct loadparm_context; +union ntdb_attribute; + +/*************************************************************** + Open an NTDB using talloc: it will be allocated off the context, and + all NTDB_DATA.dptr are allocated as children of the ntdb context. + Sets up a logging function for you, and uses lp_ctx to decide whether + to disable mmap. + + Any extra ntdb attributes can be handed through attr; usually it's + NULL, ntdb_new provides logging and allocator attributes. + + The destructor for the struct ntdb_context will do ntdb_close() + for you. +****************************************************************/ +struct ntdb_context *ntdb_new(TALLOC_CTX *ctx, + const char *name, int ntdb_flags, + int open_flags, mode_t mode, + union ntdb_attribute *attr, + struct loadparm_context *lp_ctx); +#endif /* _____LIB_UTIL_UTIL_NTDB_H__ */ -- cgit