From 773a8afbba27a5e2e48577100f3ca9873b506615 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 20 Apr 2010 13:53:35 +1000 Subject: tdb: update tdb ABI to use hide_symbols=True We now use -fvisibilty=hidden to hide symbols from outside the tdb shared library. This also moved tdb_transaction_recover() into the tdb_private.h header, as it should never have been a public API. For that reason we are changing the version number. We're only doing a minor version increment as it is extremely unlikely that anyone was actually using tdb_transaction_recover() as its locking requirements were rather unusual. Pair-Programmed-With: Rusty Russell --- lib/tdb/common/tdb_private.h | 2 +- lib/tdb/include/tdb.h | 129 +++++++++++++++++++++---------------------- lib/tdb/pytdb.c | 10 ---- lib/tdb/tdb.exports | 1 - lib/tdb/wscript | 3 +- 5 files changed, 67 insertions(+), 78 deletions(-) diff --git a/lib/tdb/common/tdb_private.h b/lib/tdb/common/tdb_private.h index b23b76a416b..e2167132b48 100644 --- a/lib/tdb/common/tdb_private.h +++ b/lib/tdb/common/tdb_private.h @@ -267,4 +267,4 @@ int tdb_expand(struct tdb_context *tdb, tdb_off_t size); int tdb_rec_free_read(struct tdb_context *tdb, tdb_off_t off, struct tdb_record *rec); - +int tdb_transaction_recover(struct tdb_context *tdb); diff --git a/lib/tdb/include/tdb.h b/lib/tdb/include/tdb.h index c84a39863bf..050f398eec5 100644 --- a/lib/tdb/include/tdb.h +++ b/lib/tdb/include/tdb.h @@ -90,85 +90,84 @@ struct tdb_logging_context { void *log_private; }; -struct tdb_context *tdb_open(const char *name, int hash_size, int tdb_flags, +_PUBLIC_ struct tdb_context *tdb_open(const char *name, int hash_size, int tdb_flags, int open_flags, mode_t mode); -struct tdb_context *tdb_open_ex(const char *name, int hash_size, int tdb_flags, +_PUBLIC_ struct tdb_context *tdb_open_ex(const char *name, int hash_size, int tdb_flags, int open_flags, mode_t mode, const struct tdb_logging_context *log_ctx, tdb_hash_func hash_fn); -void tdb_set_max_dead(struct tdb_context *tdb, int max_dead); - -int tdb_reopen(struct tdb_context *tdb); -int tdb_reopen_all(int parent_longlived); -void tdb_set_logging_function(struct tdb_context *tdb, const struct tdb_logging_context *log_ctx); -enum TDB_ERROR tdb_error(struct tdb_context *tdb); -const char *tdb_errorstr(struct tdb_context *tdb); -TDB_DATA tdb_fetch(struct tdb_context *tdb, TDB_DATA key); -int tdb_parse_record(struct tdb_context *tdb, TDB_DATA key, - int (*parser)(TDB_DATA key, TDB_DATA data, - void *private_data), - void *private_data); -int tdb_delete(struct tdb_context *tdb, TDB_DATA key); -int tdb_store(struct tdb_context *tdb, TDB_DATA key, TDB_DATA dbuf, int flag); -int tdb_append(struct tdb_context *tdb, TDB_DATA key, TDB_DATA new_dbuf); -int tdb_close(struct tdb_context *tdb); -TDB_DATA tdb_firstkey(struct tdb_context *tdb); -TDB_DATA tdb_nextkey(struct tdb_context *tdb, TDB_DATA key); -int tdb_traverse(struct tdb_context *tdb, tdb_traverse_func fn, void *); -int tdb_traverse_read(struct tdb_context *tdb, tdb_traverse_func fn, void *); -int tdb_exists(struct tdb_context *tdb, TDB_DATA key); -int tdb_lockall(struct tdb_context *tdb); -int tdb_lockall_nonblock(struct tdb_context *tdb); -int tdb_unlockall(struct tdb_context *tdb); -int tdb_lockall_read(struct tdb_context *tdb); -int tdb_lockall_read_nonblock(struct tdb_context *tdb); -int tdb_unlockall_read(struct tdb_context *tdb); -int tdb_lockall_mark(struct tdb_context *tdb); -int tdb_lockall_unmark(struct tdb_context *tdb); -const char *tdb_name(struct tdb_context *tdb); -int tdb_fd(struct tdb_context *tdb); -tdb_log_func tdb_log_fn(struct tdb_context *tdb); -void *tdb_get_logging_private(struct tdb_context *tdb); -int tdb_transaction_start(struct tdb_context *tdb); -int tdb_transaction_start_nonblock(struct tdb_context *tdb); -int tdb_transaction_prepare_commit(struct tdb_context *tdb); -int tdb_transaction_commit(struct tdb_context *tdb); -int tdb_transaction_cancel(struct tdb_context *tdb); -int tdb_transaction_recover(struct tdb_context *tdb); -int tdb_get_seqnum(struct tdb_context *tdb); -int tdb_hash_size(struct tdb_context *tdb); -size_t tdb_map_size(struct tdb_context *tdb); -int tdb_get_flags(struct tdb_context *tdb); -void tdb_add_flags(struct tdb_context *tdb, unsigned flag); -void tdb_remove_flags(struct tdb_context *tdb, unsigned flag); -void tdb_enable_seqnum(struct tdb_context *tdb); -void tdb_increment_seqnum_nonblock(struct tdb_context *tdb); -int tdb_check(struct tdb_context *tdb, +_PUBLIC_ void tdb_set_max_dead(struct tdb_context *tdb, int max_dead); + +_PUBLIC_ int tdb_reopen(struct tdb_context *tdb); +_PUBLIC_ int tdb_reopen_all(int parent_longlived); +_PUBLIC_ void tdb_set_logging_function(struct tdb_context *tdb, const struct tdb_logging_context *log_ctx); +_PUBLIC_ enum TDB_ERROR tdb_error(struct tdb_context *tdb); +_PUBLIC_ const char *tdb_errorstr(struct tdb_context *tdb); +_PUBLIC_ TDB_DATA tdb_fetch(struct tdb_context *tdb, TDB_DATA key); +_PUBLIC_ int tdb_parse_record(struct tdb_context *tdb, TDB_DATA key, + int (*parser)(TDB_DATA key, TDB_DATA data, + void *private_data), + void *private_data); +_PUBLIC_ int tdb_delete(struct tdb_context *tdb, TDB_DATA key); +_PUBLIC_ int tdb_store(struct tdb_context *tdb, TDB_DATA key, TDB_DATA dbuf, int flag); +_PUBLIC_ int tdb_append(struct tdb_context *tdb, TDB_DATA key, TDB_DATA new_dbuf); +_PUBLIC_ int tdb_close(struct tdb_context *tdb); +_PUBLIC_ TDB_DATA tdb_firstkey(struct tdb_context *tdb); +_PUBLIC_ TDB_DATA tdb_nextkey(struct tdb_context *tdb, TDB_DATA key); +_PUBLIC_ int tdb_traverse(struct tdb_context *tdb, tdb_traverse_func fn, void *); +_PUBLIC_ int tdb_traverse_read(struct tdb_context *tdb, tdb_traverse_func fn, void *); +_PUBLIC_ int tdb_exists(struct tdb_context *tdb, TDB_DATA key); +_PUBLIC_ int tdb_lockall(struct tdb_context *tdb); +_PUBLIC_ int tdb_lockall_nonblock(struct tdb_context *tdb); +_PUBLIC_ int tdb_unlockall(struct tdb_context *tdb); +_PUBLIC_ int tdb_lockall_read(struct tdb_context *tdb); +_PUBLIC_ int tdb_lockall_read_nonblock(struct tdb_context *tdb); +_PUBLIC_ int tdb_unlockall_read(struct tdb_context *tdb); +_PUBLIC_ int tdb_lockall_mark(struct tdb_context *tdb); +_PUBLIC_ int tdb_lockall_unmark(struct tdb_context *tdb); +_PUBLIC_ const char *tdb_name(struct tdb_context *tdb); +_PUBLIC_ int tdb_fd(struct tdb_context *tdb); +_PUBLIC_ tdb_log_func tdb_log_fn(struct tdb_context *tdb); +_PUBLIC_ void *tdb_get_logging_private(struct tdb_context *tdb); +_PUBLIC_ int tdb_transaction_start(struct tdb_context *tdb); +_PUBLIC_ int tdb_transaction_start_nonblock(struct tdb_context *tdb); +_PUBLIC_ int tdb_transaction_prepare_commit(struct tdb_context *tdb); +_PUBLIC_ int tdb_transaction_commit(struct tdb_context *tdb); +_PUBLIC_ int tdb_transaction_cancel(struct tdb_context *tdb); +_PUBLIC_ int tdb_get_seqnum(struct tdb_context *tdb); +_PUBLIC_ int tdb_hash_size(struct tdb_context *tdb); +_PUBLIC_ size_t tdb_map_size(struct tdb_context *tdb); +_PUBLIC_ int tdb_get_flags(struct tdb_context *tdb); +_PUBLIC_ void tdb_add_flags(struct tdb_context *tdb, unsigned flag); +_PUBLIC_ void tdb_remove_flags(struct tdb_context *tdb, unsigned flag); +_PUBLIC_ void tdb_enable_seqnum(struct tdb_context *tdb); +_PUBLIC_ void tdb_increment_seqnum_nonblock(struct tdb_context *tdb); +_PUBLIC_ int tdb_check(struct tdb_context *tdb, int (*check) (TDB_DATA key, TDB_DATA data, void *private_data), void *private_data); /* Low level locking functions: use with care */ -int tdb_chainlock(struct tdb_context *tdb, TDB_DATA key); -int tdb_chainlock_nonblock(struct tdb_context *tdb, TDB_DATA key); -int tdb_chainunlock(struct tdb_context *tdb, TDB_DATA key); -int tdb_chainlock_read(struct tdb_context *tdb, TDB_DATA key); -int tdb_chainunlock_read(struct tdb_context *tdb, TDB_DATA key); -int tdb_chainlock_mark(struct tdb_context *tdb, TDB_DATA key); -int tdb_chainlock_unmark(struct tdb_context *tdb, TDB_DATA key); +_PUBLIC_ int tdb_chainlock(struct tdb_context *tdb, TDB_DATA key); +_PUBLIC_ int tdb_chainlock_nonblock(struct tdb_context *tdb, TDB_DATA key); +_PUBLIC_ int tdb_chainunlock(struct tdb_context *tdb, TDB_DATA key); +_PUBLIC_ int tdb_chainlock_read(struct tdb_context *tdb, TDB_DATA key); +_PUBLIC_ int tdb_chainunlock_read(struct tdb_context *tdb, TDB_DATA key); +_PUBLIC_ int tdb_chainlock_mark(struct tdb_context *tdb, TDB_DATA key); +_PUBLIC_ int tdb_chainlock_unmark(struct tdb_context *tdb, TDB_DATA key); -void tdb_setalarm_sigptr(struct tdb_context *tdb, volatile sig_atomic_t *sigptr); +_PUBLIC_ void tdb_setalarm_sigptr(struct tdb_context *tdb, volatile sig_atomic_t *sigptr); /* wipe and repack */ -int tdb_wipe_all(struct tdb_context *tdb); -int tdb_repack(struct tdb_context *tdb); +_PUBLIC_ int tdb_wipe_all(struct tdb_context *tdb); +_PUBLIC_ int tdb_repack(struct tdb_context *tdb); /* Debug functions. Not used in production. */ -void tdb_dump_all(struct tdb_context *tdb); -int tdb_printfreelist(struct tdb_context *tdb); -int tdb_validate_freelist(struct tdb_context *tdb, int *pnum_entries); -int tdb_freelist_size(struct tdb_context *tdb); +_PUBLIC_ void tdb_dump_all(struct tdb_context *tdb); +_PUBLIC_ int tdb_printfreelist(struct tdb_context *tdb); +_PUBLIC_ int tdb_validate_freelist(struct tdb_context *tdb, int *pnum_entries); +_PUBLIC_ int tdb_freelist_size(struct tdb_context *tdb); -extern TDB_DATA tdb_null; +_PUBLIC_ extern TDB_DATA tdb_null; #ifdef __cplusplus } diff --git a/lib/tdb/pytdb.c b/lib/tdb/pytdb.c index 202dca1571e..7a9205b815c 100644 --- a/lib/tdb/pytdb.c +++ b/lib/tdb/pytdb.c @@ -112,13 +112,6 @@ static PyObject *obj_transaction_commit(PyTdbObject *self) Py_RETURN_NONE; } -static PyObject *obj_transaction_recover(PyTdbObject *self) -{ - int ret = tdb_transaction_recover(self->ctx); - PyErr_TDB_ERROR_IS_ERR_RAISE(ret, self->ctx); - Py_RETURN_NONE; -} - static PyObject *obj_transaction_start(PyTdbObject *self) { int ret = tdb_transaction_start(self->ctx); @@ -325,9 +318,6 @@ static PyMethodDef tdb_object_methods[] = { { "transaction_commit", (PyCFunction)obj_transaction_commit, METH_NOARGS, "S.transaction_commit() -> None\n" "Commit the currently active transaction." }, - { "transaction_recover", (PyCFunction)obj_transaction_recover, METH_NOARGS, - "S.transaction_recover() -> None\n" - "Recover the currently active transaction." }, { "transaction_start", (PyCFunction)obj_transaction_start, METH_NOARGS, "S.transaction_start() -> None\n" "Start a new transaction." }, diff --git a/lib/tdb/tdb.exports b/lib/tdb/tdb.exports index df97eb58fd3..73b8fd634c3 100644 --- a/lib/tdb/tdb.exports +++ b/lib/tdb/tdb.exports @@ -51,7 +51,6 @@ tdb_transaction_cancel; tdb_transaction_commit; tdb_transaction_prepare_commit; - tdb_transaction_recover; tdb_transaction_start; tdb_transaction_start_nonblock; tdb_traverse; diff --git a/lib/tdb/wscript b/lib/tdb/wscript index 9b637cd3c8f..899fe794819 100644 --- a/lib/tdb/wscript +++ b/lib/tdb/wscript @@ -1,7 +1,7 @@ #!/usr/bin/env python APPNAME = 'tdb' -VERSION = '1.2.1' +VERSION = '1.2.2' blddir = 'bin' @@ -68,6 +68,7 @@ def build(bld): includes='include', abi_file='ABI/tdb-%s.sigs' % VERSION, abi_match='tdb_*', + hide_symbols=True, vnum=VERSION) bld.SAMBA_BINARY('tdbtorture', -- cgit v1.2.1