mirror of
https://github.com/samba-team/samba.git
synced 2025-01-11 05:18:09 +03:00
lib: Remove tdb_open_compat
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
This commit is contained in:
parent
e3e0af14e1
commit
47795aef9d
@ -29,23 +29,6 @@
|
||||
#include <ccan/typesafe_cb/typesafe_cb.h>
|
||||
#include <tdb.h>
|
||||
|
||||
/* FIXME: Inlining this is a bit lazy, but eases S3 build. */
|
||||
static inline struct tdb_context *
|
||||
tdb_open_compat(const char *name, int hash_size,
|
||||
int tdb_flags, int open_flags, mode_t mode,
|
||||
tdb_log_func log_fn, void *log_private)
|
||||
{
|
||||
struct tdb_logging_context lctx;
|
||||
lctx.log_fn = log_fn;
|
||||
lctx.log_private = log_private;
|
||||
|
||||
if (log_fn)
|
||||
return tdb_open_ex(name, hash_size, tdb_flags, open_flags,
|
||||
mode, &lctx, NULL);
|
||||
else
|
||||
return tdb_open(name, hash_size, tdb_flags, open_flags, mode);
|
||||
}
|
||||
|
||||
#define tdb_firstkey_compat tdb_firstkey
|
||||
/* Note: this frees the old key.dptr. */
|
||||
static inline TDB_DATA tdb_nextkey_compat(struct tdb_context *tdb, TDB_DATA k)
|
||||
|
@ -323,6 +323,7 @@ TDB_CONTEXT *tdb_open_log(const char *name, int hash_size, int tdb_flags,
|
||||
int open_flags, mode_t mode)
|
||||
{
|
||||
TDB_CONTEXT *tdb;
|
||||
struct tdb_logging_context log_ctx = { .log_fn = tdb_log };
|
||||
|
||||
if (!lp_use_mmap())
|
||||
tdb_flags |= TDB_NOMMAP;
|
||||
@ -338,8 +339,8 @@ TDB_CONTEXT *tdb_open_log(const char *name, int hash_size, int tdb_flags,
|
||||
hash_size = lp_parm_int(-1, "tdb_hashsize", base, 0);
|
||||
}
|
||||
|
||||
tdb = tdb_open_compat(name, hash_size, tdb_flags,
|
||||
open_flags, mode, tdb_log, NULL);
|
||||
tdb = tdb_open_ex(name, hash_size, tdb_flags,
|
||||
open_flags, mode, &log_ctx, NULL);
|
||||
if (!tdb)
|
||||
return NULL;
|
||||
|
||||
|
@ -108,11 +108,10 @@ struct smbdb_ctx *smb_share_mode_db_open(const char *db_path)
|
||||
memset(smb_db, '\0', sizeof(struct smbdb_ctx));
|
||||
|
||||
/* FIXME: We should *never* open a tdb without logging! */
|
||||
smb_db->smb_tdb = tdb_open_compat(db_path,
|
||||
0, TDB_DEFAULT|TDB_CLEAR_IF_FIRST|TDB_INCOMPATIBLE_HASH,
|
||||
O_RDWR|O_CREAT,
|
||||
0644,
|
||||
NULL, NULL);
|
||||
smb_db->smb_tdb = tdb_open(db_path,
|
||||
0, TDB_DEFAULT|TDB_CLEAR_IF_FIRST|TDB_INCOMPATIBLE_HASH,
|
||||
O_RDWR|O_CREAT,
|
||||
0644);
|
||||
|
||||
if (!smb_db->smb_tdb) {
|
||||
free(smb_db);
|
||||
|
@ -394,8 +394,8 @@ int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
/* FIXME: We should *never* open a tdb without logging! */
|
||||
if (!(tdb = tdb_open_compat(printdb_path, 0, 0, O_RDWR | O_CREAT,
|
||||
0666, NULL, NULL))) {
|
||||
if (!(tdb = tdb_open(printdb_path, 0, 0, O_RDWR | O_CREAT,
|
||||
0666))) {
|
||||
printf("%s: unable to open %s\n", argv[0], printdb_path);
|
||||
return 1;
|
||||
}
|
||||
|
@ -181,7 +181,7 @@ bool torture_mangle(int dummy)
|
||||
}
|
||||
|
||||
/* we will use an internal tdb to store the names we have used */
|
||||
tdb = tdb_open_compat(NULL, 100000, TDB_INTERNAL, 0, 0, NULL, NULL);
|
||||
tdb = tdb_open(NULL, 100000, TDB_INTERNAL, 0, 0);
|
||||
if (!tdb) {
|
||||
printf("ERROR: Failed to open tdb\n");
|
||||
return False;
|
||||
|
@ -167,7 +167,7 @@ bool torture_mangle(struct torture_context *torture,
|
||||
int i;
|
||||
|
||||
/* we will use an internal tdb to store the names we have used */
|
||||
tdb = tdb_open_compat(NULL, 100000, TDB_INTERNAL, 0, 0, NULL, NULL);
|
||||
tdb = tdb_open(NULL, 100000, TDB_INTERNAL, 0, 0);
|
||||
if (!tdb) {
|
||||
printf("ERROR: Failed to open tdb\n");
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user