diff options
author | Volker Lendecke <vl@samba.org> | 2014-03-26 14:41:03 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2014-03-31 22:52:14 +0200 |
commit | d6db35d7a564ee556b74131ef4c3a3cdb8097e14 (patch) | |
tree | 1576430f97d46752b41efedbc8970d2eddf79f8e | |
parent | f995c6e6d4bfe4a50ca0017c722bdfb329121958 (diff) | |
download | samba-d6db35d7a564ee556b74131ef4c3a3cdb8097e14.tar.gz samba-d6db35d7a564ee556b74131ef4c3a3cdb8097e14.tar.xz samba-d6db35d7a564ee556b74131ef4c3a3cdb8097e14.zip |
tdb_wrap: Remove tdb_wrap_open_ again
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
-rw-r--r-- | lib/dbwrap/dbwrap_tdb.c | 6 | ||||
-rw-r--r-- | lib/tdb_wrap/tdb_wrap.c | 32 | ||||
-rw-r--r-- | lib/tdb_wrap/tdb_wrap.h | 6 | ||||
-rw-r--r-- | source3/lib/dbwrap/dbwrap_ctdb.c | 6 | ||||
-rw-r--r-- | source3/lib/messages_local.c | 4 | ||||
-rw-r--r-- | source3/lib/server_mutex.c | 14 | ||||
-rw-r--r-- | source3/lib/serverid.c | 12 | ||||
-rw-r--r-- | source3/modules/vfs_posix_eadb.c | 6 | ||||
-rw-r--r-- | source4/dsdb/samdb/ldb_modules/partition_metadata.c | 2 | ||||
-rw-r--r-- | source4/dsdb/samdb/ldb_modules/schema_load.c | 6 | ||||
-rw-r--r-- | source4/lib/messaging/messaging.c | 8 | ||||
-rw-r--r-- | source4/ntvfs/posix/python/pyposix_eadb.c | 4 | ||||
-rw-r--r-- | source4/ntvfs/posix/vfs_posix.c | 2 | ||||
-rw-r--r-- | source4/param/secrets.c | 8 | ||||
-rw-r--r-- | source4/torture/local/dbspeed.c | 6 |
15 files changed, 46 insertions, 76 deletions
diff --git a/lib/dbwrap/dbwrap_tdb.c b/lib/dbwrap/dbwrap_tdb.c index 82a9916e2f..a76d90f10b 100644 --- a/lib/dbwrap/dbwrap_tdb.c +++ b/lib/dbwrap/dbwrap_tdb.c @@ -432,9 +432,9 @@ struct db_context *db_open_tdb(TALLOC_CTX *mem_ctx, hash_size = lpcfg_tdb_hash_size(lp_ctx, name); } - db_tdb->wtdb = tdb_wrap_open_(db_tdb, name, hash_size, - lpcfg_tdb_flags(lp_ctx, tdb_flags), - open_flags, mode); + db_tdb->wtdb = tdb_wrap_open(db_tdb, name, hash_size, + lpcfg_tdb_flags(lp_ctx, tdb_flags), + open_flags, mode); if (db_tdb->wtdb == NULL) { DEBUG(3, ("Could not open tdb: %s\n", strerror(errno))); goto fail; diff --git a/lib/tdb_wrap/tdb_wrap.c b/lib/tdb_wrap/tdb_wrap.c index cf24b97e79..970c91f1c7 100644 --- a/lib/tdb_wrap/tdb_wrap.c +++ b/lib/tdb_wrap/tdb_wrap.c @@ -123,9 +123,9 @@ fail: wrapped connection to a tdb database to close just talloc_free() the tdb_wrap pointer */ -struct tdb_wrap *tdb_wrap_open_(TALLOC_CTX *mem_ctx, - const char *name, int hash_size, int tdb_flags, - int open_flags, mode_t mode) +struct tdb_wrap *tdb_wrap_open(TALLOC_CTX *mem_ctx, + const char *name, int hash_size, int tdb_flags, + int open_flags, mode_t mode) { struct tdb_wrap *result; struct tdb_wrap_private *w; @@ -175,29 +175,3 @@ fail: TALLOC_FREE(result); return NULL; } - -struct tdb_wrap *tdb_wrap_open(TALLOC_CTX *mem_ctx, - const char *name, int hash_size, int tdb_flags, - int open_flags, mode_t mode, - struct loadparm_context *lp_ctx) -{ - if (!lpcfg_use_mmap(lp_ctx)) { - tdb_flags |= TDB_NOMMAP; - } - - if ((hash_size == 0) && (name != NULL)) { - const char *base; - base = strrchr_m(name, '/'); - - if (base != NULL) { - base += 1; - } else { - base = name; - } - hash_size = lpcfg_parm_int(lp_ctx, NULL, - "tdb_hashsize", base, 0); - } - - return tdb_wrap_open_(mem_ctx, name, hash_size, tdb_flags, open_flags, - mode); -} diff --git a/lib/tdb_wrap/tdb_wrap.h b/lib/tdb_wrap/tdb_wrap.h index 54d9a0a72e..e44aed684f 100644 --- a/lib/tdb_wrap/tdb_wrap.h +++ b/lib/tdb_wrap/tdb_wrap.h @@ -37,12 +37,8 @@ struct tdb_wrap { struct loadparm_context; -struct tdb_wrap *tdb_wrap_open_(TALLOC_CTX *mem_ctx, - const char *name, int hash_size, int tdb_flags, - int open_flags, mode_t mode); struct tdb_wrap *tdb_wrap_open(TALLOC_CTX *mem_ctx, const char *name, int hash_size, int tdb_flags, - int open_flags, mode_t mode, - struct loadparm_context *lp_ctx); + int open_flags, mode_t mode); #endif /* _TDB_WRAP_H_ */ diff --git a/source3/lib/dbwrap/dbwrap_ctdb.c b/source3/lib/dbwrap/dbwrap_ctdb.c index 32d044628d..7cf90cebdf 100644 --- a/source3/lib/dbwrap/dbwrap_ctdb.c +++ b/source3/lib/dbwrap/dbwrap_ctdb.c @@ -1665,9 +1665,9 @@ struct db_context *db_open_ctdb(TALLOC_CTX *mem_ctx, hash_size = lpcfg_tdb_hash_size(lp_ctx, db_path); } - db_ctdb->wtdb = tdb_wrap_open_(db_ctdb, db_path, hash_size, - lpcfg_tdb_flags(lp_ctx, tdb_flags), - O_RDWR, 0); + db_ctdb->wtdb = tdb_wrap_open(db_ctdb, db_path, hash_size, + lpcfg_tdb_flags(lp_ctx, tdb_flags), + O_RDWR, 0); talloc_unlink(db_path, lp_ctx); if (db_ctdb->wtdb == NULL) { DEBUG(0, ("Could not open tdb %s: %s\n", db_path, strerror(errno))); diff --git a/source3/lib/messages_local.c b/source3/lib/messages_local.c index 1a3f3b27f2..1fe89c3bfa 100644 --- a/source3/lib/messages_local.c +++ b/source3/lib/messages_local.c @@ -125,7 +125,7 @@ NTSTATUS messaging_tdb_init(struct messaging_context *msg_ctx, fname = lock_path("messages.tdb"); - ctx->tdb = tdb_wrap_open_( + ctx->tdb = tdb_wrap_open( ctx, fname, lpcfg_tdb_hash_size(lp_ctx, fname), lpcfg_tdb_flags(lp_ctx, TDB_CLEAR_IF_FIRST|TDB_DEFAULT| TDB_VOLATILE| TDB_INCOMPATIBLE_HASH), @@ -189,7 +189,7 @@ bool messaging_tdb_parent_init(TALLOC_CTX *mem_ctx) */ fname = lock_path("messages.tdb"); - db = tdb_wrap_open_( + db = tdb_wrap_open( mem_ctx, fname, lpcfg_tdb_hash_size(lp_ctx, fname), lpcfg_tdb_flags(lp_ctx, TDB_CLEAR_IF_FIRST|TDB_DEFAULT| TDB_VOLATILE|TDB_INCOMPATIBLE_HASH), diff --git a/source3/lib/server_mutex.c b/source3/lib/server_mutex.c index 24a301bde9..43cf77b94d 100644 --- a/source3/lib/server_mutex.c +++ b/source3/lib/server_mutex.c @@ -72,13 +72,13 @@ struct named_mutex *grab_named_mutex(TALLOC_CTX *mem_ctx, const char *name, fname = lock_path("mutex.tdb"); - result->tdb = tdb_wrap_open_(result, fname, - lpcfg_tdb_hash_size(lp_ctx, fname), - lpcfg_tdb_flags(lp_ctx, - TDB_DEFAULT | - TDB_CLEAR_IF_FIRST | - TDB_INCOMPATIBLE_HASH), - O_RDWR|O_CREAT, 0600); + result->tdb = tdb_wrap_open(result, fname, + lpcfg_tdb_hash_size(lp_ctx, fname), + lpcfg_tdb_flags(lp_ctx, + TDB_DEFAULT | + TDB_CLEAR_IF_FIRST | + TDB_INCOMPATIBLE_HASH), + O_RDWR|O_CREAT, 0600); talloc_unlink(result, lp_ctx); if (result->tdb == NULL) { DEBUG(1, ("Could not open mutex.tdb: %s\n", diff --git a/source3/lib/serverid.c b/source3/lib/serverid.c index 4253da6378..48b09f71f5 100644 --- a/source3/lib/serverid.c +++ b/source3/lib/serverid.c @@ -59,12 +59,12 @@ bool serverid_parent_init(TALLOC_CTX *mem_ctx) fname = lock_path("serverid.tdb"); - db = tdb_wrap_open_(mem_ctx, fname, - lpcfg_tdb_hash_size(lp_ctx, fname), - lpcfg_tdb_flags(lp_ctx, - TDB_DEFAULT|TDB_CLEAR_IF_FIRST| - TDB_INCOMPATIBLE_HASH), - O_RDWR|O_CREAT, 0644); + db = tdb_wrap_open(mem_ctx, fname, + lpcfg_tdb_hash_size(lp_ctx, fname), + lpcfg_tdb_flags(lp_ctx, + TDB_DEFAULT|TDB_CLEAR_IF_FIRST| + TDB_INCOMPATIBLE_HASH), + O_RDWR|O_CREAT, 0644); talloc_unlink(mem_ctx, lp_ctx); if (db == NULL) { DEBUG(1, ("could not open serverid.tdb: %s\n", diff --git a/source3/modules/vfs_posix_eadb.c b/source3/modules/vfs_posix_eadb.c index 7f65beafc4..27996db73d 100644 --- a/source3/modules/vfs_posix_eadb.c +++ b/source3/modules/vfs_posix_eadb.c @@ -256,9 +256,9 @@ static bool posix_eadb_init(int snum, struct tdb_wrap **p_db) lp_ctx = loadparm_init_s3(NULL, loadparm_s3_helpers()); become_root(); - db = tdb_wrap_open_(NULL, eadb, 50000, - lpcfg_tdb_flags(lp_ctx, TDB_DEFAULT), - O_RDWR|O_CREAT, 0600); + db = tdb_wrap_open(NULL, eadb, 50000, + lpcfg_tdb_flags(lp_ctx, TDB_DEFAULT), + O_RDWR|O_CREAT, 0600); unbecome_root(); talloc_unlink(NULL, lp_ctx); diff --git a/source4/dsdb/samdb/ldb_modules/partition_metadata.c b/source4/dsdb/samdb/ldb_modules/partition_metadata.c index 8441b13d47..1db800ec6a 100644 --- a/source4/dsdb/samdb/ldb_modules/partition_metadata.c +++ b/source4/dsdb/samdb/ldb_modules/partition_metadata.c @@ -240,7 +240,7 @@ static int partition_metadata_open(struct ldb_module *module, bool create) lp_ctx = talloc_get_type_abort(ldb_get_opaque(ldb, "loadparm"), struct loadparm_context); - data->metadata->db = tdb_wrap_open_( + data->metadata->db = tdb_wrap_open( data->metadata, filename, 10, lpcfg_tdb_flags(lp_ctx, TDB_DEFAULT), open_flags, 0660); if (data->metadata->db == NULL) { diff --git a/source4/dsdb/samdb/ldb_modules/schema_load.c b/source4/dsdb/samdb/ldb_modules/schema_load.c index 2e9eb5cad6..25a780150a 100644 --- a/source4/dsdb/samdb/ldb_modules/schema_load.c +++ b/source4/dsdb/samdb/ldb_modules/schema_load.c @@ -90,9 +90,9 @@ static int schema_metadata_open(struct ldb_module *module) lp_ctx = talloc_get_type_abort(ldb_get_opaque(ldb, "loadparm"), struct loadparm_context); - data->metadata = tdb_wrap_open_(data, filename, 10, - lpcfg_tdb_flags(lp_ctx, TDB_DEFAULT), - open_flags, 0660); + data->metadata = tdb_wrap_open(data, filename, 10, + lpcfg_tdb_flags(lp_ctx, TDB_DEFAULT), + open_flags, 0660); if (data->metadata == NULL) { talloc_free(tmp_ctx); return LDB_ERR_OPERATIONS_ERROR; diff --git a/source4/lib/messaging/messaging.c b/source4/lib/messaging/messaging.c index e182acd83c..ba1c5bd727 100644 --- a/source4/lib/messaging/messaging.c +++ b/source4/lib/messaging/messaging.c @@ -899,10 +899,10 @@ static struct tdb_wrap *irpc_namedb_open(struct imessaging_context *msg_ctx) if (path == NULL) { return NULL; } - t = tdb_wrap_open_(msg_ctx, path, - lpcfg_tdb_hash_size(msg_ctx->lp_ctx, path), - lpcfg_tdb_flags(msg_ctx->lp_ctx, 0), - O_RDWR|O_CREAT, 0660); + t = tdb_wrap_open(msg_ctx, path, + lpcfg_tdb_hash_size(msg_ctx->lp_ctx, path), + lpcfg_tdb_flags(msg_ctx->lp_ctx, 0), + O_RDWR|O_CREAT, 0660); talloc_free(path); return t; } diff --git a/source4/ntvfs/posix/python/pyposix_eadb.c b/source4/ntvfs/posix/python/pyposix_eadb.c index c04d329f14..9db0ddb770 100644 --- a/source4/ntvfs/posix/python/pyposix_eadb.c +++ b/source4/ntvfs/posix/python/pyposix_eadb.c @@ -50,7 +50,7 @@ static PyObject *py_wrap_setxattr(PyObject *self, PyObject *args) blob.length = blobsize; mem_ctx = talloc_new(NULL); - eadb = tdb_wrap_open_( + eadb = tdb_wrap_open( mem_ctx, tdbname, 50000, lpcfg_tdb_flags(py_default_loadparm_context(mem_ctx), TDB_DEFAULT), @@ -85,7 +85,7 @@ static PyObject *py_wrap_getxattr(PyObject *self, PyObject *args) return NULL; mem_ctx = talloc_new(NULL); - eadb = tdb_wrap_open_( + eadb = tdb_wrap_open( mem_ctx, tdbname, 50000, lpcfg_tdb_flags(py_default_loadparm_context(mem_ctx), TDB_DEFAULT), diff --git a/source4/ntvfs/posix/vfs_posix.c b/source4/ntvfs/posix/vfs_posix.c index a9ba44f20b..304a9ff8fe 100644 --- a/source4/ntvfs/posix/vfs_posix.c +++ b/source4/ntvfs/posix/vfs_posix.c @@ -120,7 +120,7 @@ static void pvfs_setup_options(struct pvfs_state *pvfs) /* allow xattrs to be stored in a external tdb */ eadb = share_string_option(pvfs, scfg, PVFS_EADB, NULL); if (eadb != NULL) { - pvfs->ea_db = tdb_wrap_open_( + pvfs->ea_db = tdb_wrap_open( pvfs, eadb, 50000, lpcfg_tdb_flags(pvfs->ntvfs->ctx->lp_ctx, TDB_DEFAULT), O_RDWR|O_CREAT, 0600); diff --git a/source4/param/secrets.c b/source4/param/secrets.c index e27524e231..92e338a6ba 100644 --- a/source4/param/secrets.c +++ b/source4/param/secrets.c @@ -59,10 +59,10 @@ bool randseed_init(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx) fname = lpcfg_private_path(mem_ctx, lp_ctx, "randseed.tdb"); - tdb = tdb_wrap_open_(mem_ctx, fname, - lpcfg_tdb_hash_size(lp_ctx, fname), - lpcfg_tdb_flags(lp_ctx, TDB_DEFAULT), - O_RDWR|O_CREAT, 0600); + tdb = tdb_wrap_open(mem_ctx, fname, + lpcfg_tdb_hash_size(lp_ctx, fname), + lpcfg_tdb_flags(lp_ctx, TDB_DEFAULT), + O_RDWR|O_CREAT, 0600); if (!tdb) { DEBUG(0,("Failed to open %s\n", fname)); diff --git a/source4/torture/local/dbspeed.c b/source4/torture/local/dbspeed.c index 27d1e0ce15..185faecd96 100644 --- a/source4/torture/local/dbspeed.c +++ b/source4/torture/local/dbspeed.c @@ -64,9 +64,9 @@ static bool test_tdb_speed(struct torture_context *torture, const void *_data) torture_comment(torture, "Testing tdb speed for sidmap\n"); - tdbw = tdb_wrap_open_(tmp_ctx, "test.tdb", 10000, - lpcfg_tdb_flags(torture->lp_ctx, 0), - O_RDWR|O_CREAT|O_TRUNC, 0600); + tdbw = tdb_wrap_open(tmp_ctx, "test.tdb", 10000, + lpcfg_tdb_flags(torture->lp_ctx, 0), + O_RDWR|O_CREAT|O_TRUNC, 0600); if (!tdbw) { torture_result(torture, TORTURE_FAIL, "Failed to open test.tdb"); goto failed; |