2 Unix SMB/CIFS implementation.
4 Copyright (C) Andrew Tridgell 1992-1998
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 /* these are little tdb utility functions that are meant to make
25 dealing with a tdb database a little less cumbersome in Samba */
28 /****************************************************************************
29 Log tdb messages via DEBUG().
30 ****************************************************************************/
32 static void tdb_log(TDB_CONTEXT *tdb, int level, const char *format, ...) PRINTF_ATTRIBUTE(3,4);
34 static void tdb_log(TDB_CONTEXT *tdb, int level, const char *format, ...)
40 vasprintf(&ptr, format, ap);
46 DEBUG(level, ("tdb(%s): %s", tdb->name ? tdb->name : "unnamed", ptr));
50 /****************************************************************************
51 Like tdb_open() but also setup a logging function that redirects to
52 the samba DEBUG() system.
53 ****************************************************************************/
55 TDB_CONTEXT *tdb_open_log(const char *name, int hash_size, int tdb_flags,
56 int open_flags, mode_t mode)
61 tdb_flags |= TDB_NOMMAP;
63 tdb = tdb_open_ex(name, hash_size, tdb_flags,
64 open_flags, mode, tdb_log, NULL);