param: Rename variable used for lp_cluster_addresses szClusterAddresses
[Samba.git] / lib / tdb_compat / tdb_compat.h
blob98bccf413739bf5b7edee7e5dd52efa94b7fa980
1 /*
2 Unix SMB/CIFS implementation.
4 Compatibility layer for TDB1 vs TDB2.
6 Copyright (C) Rusty Russell 2011
8 ** NOTE! The following LGPL license applies to the tdb_compat
9 ** library. This does NOT imply that all of Samba is released
10 ** under the LGPL
12 This library is free software; you can redistribute it and/or
13 modify it under the terms of the GNU Lesser General Public
14 License as published by the Free Software Foundation; either
15 version 3 of the License, or (at your option) any later version.
17 This library is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 Lesser General Public License for more details.
22 You should have received a copy of the GNU Lesser General Public
23 License along with this library; if not, see <http://www.gnu.org/licenses/>.
25 #ifndef TDB_COMPAT_H
26 #define TDB_COMPAT_H
28 #include "replace.h"
29 #include <ccan/typesafe_cb/typesafe_cb.h>
30 #include <tdb.h>
32 /* FIXME: Inlining this is a bit lazy, but eases S3 build. */
33 static inline struct tdb_context *
34 tdb_open_compat(const char *name, int hash_size,
35 int tdb_flags, int open_flags, mode_t mode,
36 tdb_log_func log_fn, void *log_private)
38 struct tdb_logging_context lctx;
39 lctx.log_fn = log_fn;
40 lctx.log_private = log_private;
42 if (log_fn)
43 return tdb_open_ex(name, hash_size, tdb_flags, open_flags,
44 mode, &lctx, NULL);
45 else
46 return tdb_open(name, hash_size, tdb_flags, open_flags, mode);
49 #define tdb_firstkey_compat tdb_firstkey
50 /* Note: this frees the old key.dptr. */
51 static inline TDB_DATA tdb_nextkey_compat(struct tdb_context *tdb, TDB_DATA k)
53 TDB_DATA next = tdb_nextkey(tdb, k);
54 free(k.dptr);
55 return next;
57 #define tdb_errorstr_compat(tdb) tdb_errorstr(tdb)
58 #define tdb_fetch_compat tdb_fetch
60 #endif /* TDB_COMPAT_H */