diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2010-10-21 11:51:37 +0200 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2010-10-21 11:47:22 +0000 |
commit | 62c4af99428abb2d4ac1b18454d72e0c8cbb67e8 (patch) | |
tree | 8fcf54dce83778d5413a60799d9a540a6d4320fc | |
parent | 2c0ff5113cd9ef966f9ee3bcc723a6a28f1197da (diff) | |
download | samba-62c4af99428abb2d4ac1b18454d72e0c8cbb67e8.tar.gz samba-62c4af99428abb2d4ac1b18454d72e0c8cbb67e8.tar.bz2 samba-62c4af99428abb2d4ac1b18454d72e0c8cbb67e8.zip |
tdb: Set _PUBLIC_ in C file rather than header files (Debian bug 600898)
Autobuild-User: Jelmer Vernooij <jelmer@samba.org>
Autobuild-Date: Thu Oct 21 11:47:22 UTC 2010 on sn-devel-104
-rw-r--r-- | lib/tdb/common/check.c | 2 | ||||
-rw-r--r-- | lib/tdb/common/dump.c | 4 | ||||
-rw-r--r-- | lib/tdb/common/error.c | 4 | ||||
-rw-r--r-- | lib/tdb/common/freelist.c | 2 | ||||
-rw-r--r-- | lib/tdb/common/freelistcheck.c | 2 | ||||
-rw-r--r-- | lib/tdb/common/hash.c | 2 | ||||
-rw-r--r-- | lib/tdb/common/lock.c | 34 | ||||
-rw-r--r-- | lib/tdb/common/open.c | 18 | ||||
-rw-r--r-- | lib/tdb/common/tdb.c | 40 | ||||
-rw-r--r-- | lib/tdb/common/transaction.c | 14 | ||||
-rw-r--r-- | lib/tdb/common/traverse.c | 8 | ||||
-rw-r--r-- | lib/tdb/include/tdb.h | 124 |
12 files changed, 126 insertions, 128 deletions
diff --git a/lib/tdb/common/check.c b/lib/tdb/common/check.c index 58c9c26540..bbb566c6f7 100644 --- a/lib/tdb/common/check.c +++ b/lib/tdb/common/check.c @@ -322,7 +322,7 @@ static size_t dead_space(struct tdb_context *tdb, tdb_off_t off) return len; } -int tdb_check(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) { diff --git a/lib/tdb/common/dump.c b/lib/tdb/common/dump.c index 9f770f81a5..67de04e37c 100644 --- a/lib/tdb/common/dump.c +++ b/lib/tdb/common/dump.c @@ -80,7 +80,7 @@ static int tdb_dump_chain(struct tdb_context *tdb, int i) return tdb_unlock(tdb, i, F_WRLCK); } -void tdb_dump_all(struct tdb_context *tdb) +_PUBLIC_ void tdb_dump_all(struct tdb_context *tdb) { int i; for (i=0;i<tdb->header.hash_size;i++) { @@ -90,7 +90,7 @@ void tdb_dump_all(struct tdb_context *tdb) tdb_dump_chain(tdb, -1); } -int tdb_printfreelist(struct tdb_context *tdb) +_PUBLIC_ int tdb_printfreelist(struct tdb_context *tdb) { int ret; long total_free = 0; diff --git a/lib/tdb/common/error.c b/lib/tdb/common/error.c index 9197918dde..2aaaa8134e 100644 --- a/lib/tdb/common/error.c +++ b/lib/tdb/common/error.c @@ -27,7 +27,7 @@ #include "tdb_private.h" -enum TDB_ERROR tdb_error(struct tdb_context *tdb) +_PUBLIC_ enum TDB_ERROR tdb_error(struct tdb_context *tdb) { return tdb->ecode; } @@ -46,7 +46,7 @@ static struct tdb_errname { {TDB_ERR_RDONLY, "write not permitted"} }; /* Error string for the last tdb error */ -const char *tdb_errorstr(struct tdb_context *tdb) +_PUBLIC_ const char *tdb_errorstr(struct tdb_context *tdb) { uint32_t i; for (i = 0; i < sizeof(emap) / sizeof(struct tdb_errname); i++) diff --git a/lib/tdb/common/freelist.c b/lib/tdb/common/freelist.c index 79e3c344b8..927078a7aa 100644 --- a/lib/tdb/common/freelist.c +++ b/lib/tdb/common/freelist.c @@ -367,7 +367,7 @@ tdb_off_t tdb_allocate(struct tdb_context *tdb, tdb_len_t length, struct tdb_rec /* return the size of the freelist - used to decide if we should repack */ -int tdb_freelist_size(struct tdb_context *tdb) +_PUBLIC_ int tdb_freelist_size(struct tdb_context *tdb) { tdb_off_t ptr; int count=0; diff --git a/lib/tdb/common/freelistcheck.c b/lib/tdb/common/freelistcheck.c index 8d1ebabe04..ab6e78f02d 100644 --- a/lib/tdb/common/freelistcheck.c +++ b/lib/tdb/common/freelistcheck.c @@ -43,7 +43,7 @@ static int seen_insert(struct tdb_context *mem_tdb, tdb_off_t rec_ptr) return tdb_store(mem_tdb, key, data, TDB_INSERT); } -int tdb_validate_freelist(struct tdb_context *tdb, int *pnum_entries) +_PUBLIC_ int tdb_validate_freelist(struct tdb_context *tdb, int *pnum_entries) { struct tdb_context *mem_tdb = NULL; struct tdb_record rec; diff --git a/lib/tdb/common/hash.c b/lib/tdb/common/hash.c index c07297ec19..2472ed1ace 100644 --- a/lib/tdb/common/hash.c +++ b/lib/tdb/common/hash.c @@ -374,7 +374,7 @@ static uint32_t hashlittle( const void *key, size_t length ) return c; } -unsigned int tdb_jenkins_hash(TDB_DATA *key) +_PUBLIC_ unsigned int tdb_jenkins_hash(TDB_DATA *key) { return hashlittle(key->dptr, key->dsize); } diff --git a/lib/tdb/common/lock.c b/lib/tdb/common/lock.c index 803feeecbb..c6a2485171 100644 --- a/lib/tdb/common/lock.c +++ b/lib/tdb/common/lock.c @@ -27,7 +27,7 @@ #include "tdb_private.h" -void tdb_setalarm_sigptr(struct tdb_context *tdb, volatile sig_atomic_t *ptr) +_PUBLIC_ void tdb_setalarm_sigptr(struct tdb_context *tdb, volatile sig_atomic_t *ptr) { tdb->interrupt_sig_ptr = ptr; } @@ -644,28 +644,28 @@ int tdb_allrecord_unlock(struct tdb_context *tdb, int ltype, bool mark_lock) } /* lock entire database with write lock */ -int tdb_lockall(struct tdb_context *tdb) +_PUBLIC_ int tdb_lockall(struct tdb_context *tdb) { tdb_trace(tdb, "tdb_lockall"); return tdb_allrecord_lock(tdb, F_WRLCK, TDB_LOCK_WAIT, false); } /* lock entire database with write lock - mark only */ -int tdb_lockall_mark(struct tdb_context *tdb) +_PUBLIC_ int tdb_lockall_mark(struct tdb_context *tdb) { tdb_trace(tdb, "tdb_lockall_mark"); return tdb_allrecord_lock(tdb, F_WRLCK, TDB_LOCK_MARK_ONLY, false); } /* unlock entire database with write lock - unmark only */ -int tdb_lockall_unmark(struct tdb_context *tdb) +_PUBLIC_ int tdb_lockall_unmark(struct tdb_context *tdb) { tdb_trace(tdb, "tdb_lockall_unmark"); return tdb_allrecord_unlock(tdb, F_WRLCK, true); } /* lock entire database with write lock - nonblocking varient */ -int tdb_lockall_nonblock(struct tdb_context *tdb) +_PUBLIC_ int tdb_lockall_nonblock(struct tdb_context *tdb) { int ret = tdb_allrecord_lock(tdb, F_WRLCK, TDB_LOCK_NOWAIT, false); tdb_trace_ret(tdb, "tdb_lockall_nonblock", ret); @@ -673,21 +673,21 @@ int tdb_lockall_nonblock(struct tdb_context *tdb) } /* unlock entire database with write lock */ -int tdb_unlockall(struct tdb_context *tdb) +_PUBLIC_ int tdb_unlockall(struct tdb_context *tdb) { tdb_trace(tdb, "tdb_unlockall"); return tdb_allrecord_unlock(tdb, F_WRLCK, false); } /* lock entire database with read lock */ -int tdb_lockall_read(struct tdb_context *tdb) +_PUBLIC_ int tdb_lockall_read(struct tdb_context *tdb) { tdb_trace(tdb, "tdb_lockall_read"); return tdb_allrecord_lock(tdb, F_RDLCK, TDB_LOCK_WAIT, false); } /* lock entire database with read lock - nonblock varient */ -int tdb_lockall_read_nonblock(struct tdb_context *tdb) +_PUBLIC_ int tdb_lockall_read_nonblock(struct tdb_context *tdb) { int ret = tdb_allrecord_lock(tdb, F_RDLCK, TDB_LOCK_NOWAIT, false); tdb_trace_ret(tdb, "tdb_lockall_read_nonblock", ret); @@ -695,7 +695,7 @@ int tdb_lockall_read_nonblock(struct tdb_context *tdb) } /* unlock entire database with read lock */ -int tdb_unlockall_read(struct tdb_context *tdb) +_PUBLIC_ int tdb_unlockall_read(struct tdb_context *tdb) { tdb_trace(tdb, "tdb_unlockall_read"); return tdb_allrecord_unlock(tdb, F_RDLCK, false); @@ -703,7 +703,7 @@ int tdb_unlockall_read(struct tdb_context *tdb) /* lock/unlock one hash chain. This is meant to be used to reduce contention - it cannot guarantee how many records will be locked */ -int tdb_chainlock(struct tdb_context *tdb, TDB_DATA key) +_PUBLIC_ int tdb_chainlock(struct tdb_context *tdb, TDB_DATA key) { int ret = tdb_lock(tdb, BUCKET(tdb->hash_fn(&key)), F_WRLCK); tdb_trace_1rec(tdb, "tdb_chainlock", key); @@ -713,7 +713,7 @@ int tdb_chainlock(struct tdb_context *tdb, TDB_DATA key) /* lock/unlock one hash chain, non-blocking. This is meant to be used to reduce contention - it cannot guarantee how many records will be locked */ -int tdb_chainlock_nonblock(struct tdb_context *tdb, TDB_DATA key) +_PUBLIC_ int tdb_chainlock_nonblock(struct tdb_context *tdb, TDB_DATA key) { int ret = tdb_lock_nonblock(tdb, BUCKET(tdb->hash_fn(&key)), F_WRLCK); tdb_trace_1rec_ret(tdb, "tdb_chainlock_nonblock", key, ret); @@ -721,7 +721,7 @@ int tdb_chainlock_nonblock(struct tdb_context *tdb, TDB_DATA key) } /* mark a chain as locked without actually locking it. Warning! use with great caution! */ -int tdb_chainlock_mark(struct tdb_context *tdb, TDB_DATA key) +_PUBLIC_ int tdb_chainlock_mark(struct tdb_context *tdb, TDB_DATA key) { int ret = tdb_nest_lock(tdb, lock_offset(BUCKET(tdb->hash_fn(&key))), F_WRLCK, TDB_LOCK_MARK_ONLY); @@ -730,20 +730,20 @@ int tdb_chainlock_mark(struct tdb_context *tdb, TDB_DATA key) } /* unmark a chain as locked without actually locking it. Warning! use with great caution! */ -int tdb_chainlock_unmark(struct tdb_context *tdb, TDB_DATA key) +_PUBLIC_ int tdb_chainlock_unmark(struct tdb_context *tdb, TDB_DATA key) { tdb_trace_1rec(tdb, "tdb_chainlock_unmark", key); return tdb_nest_unlock(tdb, lock_offset(BUCKET(tdb->hash_fn(&key))), F_WRLCK, true); } -int tdb_chainunlock(struct tdb_context *tdb, TDB_DATA key) +_PUBLIC_ int tdb_chainunlock(struct tdb_context *tdb, TDB_DATA key) { tdb_trace_1rec(tdb, "tdb_chainunlock", key); return tdb_unlock(tdb, BUCKET(tdb->hash_fn(&key)), F_WRLCK); } -int tdb_chainlock_read(struct tdb_context *tdb, TDB_DATA key) +_PUBLIC_ int tdb_chainlock_read(struct tdb_context *tdb, TDB_DATA key) { int ret; ret = tdb_lock(tdb, BUCKET(tdb->hash_fn(&key)), F_RDLCK); @@ -751,14 +751,12 @@ int tdb_chainlock_read(struct tdb_context *tdb, TDB_DATA key) return ret; } -int tdb_chainunlock_read(struct tdb_context *tdb, TDB_DATA key) +_PUBLIC_ int tdb_chainunlock_read(struct tdb_context *tdb, TDB_DATA key) { tdb_trace_1rec(tdb, "tdb_chainunlock_read", key); return tdb_unlock(tdb, BUCKET(tdb->hash_fn(&key)), F_RDLCK); } - - /* record lock stops delete underneath */ int tdb_lock_record(struct tdb_context *tdb, tdb_off_t off) { diff --git a/lib/tdb/common/open.c b/lib/tdb/common/open.c index 66539c3f6c..f13df2c0d5 100644 --- a/lib/tdb/common/open.c +++ b/lib/tdb/common/open.c @@ -129,7 +129,7 @@ static int tdb_already_open(dev_t device, try to call tdb_error or tdb_errname, just do strerror(errno). @param name may be NULL for internal databases. */ -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) { return tdb_open_ex(name, hash_size, tdb_flags, open_flags, mode, NULL, NULL); @@ -162,7 +162,7 @@ static bool check_header_hash(struct tdb_context *tdb, return check_header_hash(tdb, false, m1, m2); } -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) @@ -451,7 +451,7 @@ struct tdb_context *tdb_open_ex(const char *name, int hash_size, int tdb_flags, * Set the maximum number of dead records per hash chain */ -void tdb_set_max_dead(struct tdb_context *tdb, int max_dead) +_PUBLIC_ void tdb_set_max_dead(struct tdb_context *tdb, int max_dead) { tdb->max_dead_records = max_dead; } @@ -461,7 +461,7 @@ void tdb_set_max_dead(struct tdb_context *tdb, int max_dead) * * @returns -1 for error; 0 for success. **/ -int tdb_close(struct tdb_context *tdb) +_PUBLIC_ int tdb_close(struct tdb_context *tdb) { struct tdb_context **i; int ret = 0; @@ -502,13 +502,13 @@ int tdb_close(struct tdb_context *tdb) } /* register a loging function */ -void tdb_set_logging_function(struct tdb_context *tdb, - const struct tdb_logging_context *log_ctx) +_PUBLIC_ void tdb_set_logging_function(struct tdb_context *tdb, + const struct tdb_logging_context *log_ctx) { tdb->log = *log_ctx; } -void *tdb_get_logging_private(struct tdb_context *tdb) +_PUBLIC_ void *tdb_get_logging_private(struct tdb_context *tdb) { return tdb->log.log_private; } @@ -577,13 +577,13 @@ fail: /* reopen a tdb - this can be used after a fork to ensure that we have an independent seek pointer from our parent and to re-establish locks */ -int tdb_reopen(struct tdb_context *tdb) +_PUBLIC_ int tdb_reopen(struct tdb_context *tdb) { return tdb_reopen_internal(tdb, tdb->flags & TDB_CLEAR_IF_FIRST); } /* reopen all tdb's */ -int tdb_reopen_all(int parent_longlived) +_PUBLIC_ int tdb_reopen_all(int parent_longlived) { struct tdb_context *tdb; diff --git a/lib/tdb/common/tdb.c b/lib/tdb/common/tdb.c index 4d8c5fc59c..a28e8837c8 100644 --- a/lib/tdb/common/tdb.c +++ b/lib/tdb/common/tdb.c @@ -27,13 +27,13 @@ #include "tdb_private.h" -TDB_DATA tdb_null; +_PUBLIC_ TDB_DATA tdb_null; /* non-blocking increment of the tdb sequence number if the tdb has been opened using the TDB_SEQNUM flag */ -void tdb_increment_seqnum_nonblock(struct tdb_context *tdb) +_PUBLIC_ void tdb_increment_seqnum_nonblock(struct tdb_context *tdb) { tdb_off_t seqnum=0; @@ -199,7 +199,7 @@ static TDB_DATA _tdb_fetch(struct tdb_context *tdb, TDB_DATA key) return ret; } -TDB_DATA tdb_fetch(struct tdb_context *tdb, TDB_DATA key) +_PUBLIC_ TDB_DATA tdb_fetch(struct tdb_context *tdb, TDB_DATA key) { TDB_DATA ret = _tdb_fetch(tdb, key); @@ -225,7 +225,7 @@ TDB_DATA tdb_fetch(struct tdb_context *tdb, TDB_DATA key) * Return -1 if the record was not found. */ -int tdb_parse_record(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) @@ -270,7 +270,7 @@ static int tdb_exists_hash(struct tdb_context *tdb, TDB_DATA key, uint32_t hash) return 1; } -int tdb_exists(struct tdb_context *tdb, TDB_DATA key) +_PUBLIC_ int tdb_exists(struct tdb_context *tdb, TDB_DATA key) { uint32_t hash = tdb->hash_fn(&key); int ret; @@ -429,7 +429,7 @@ static int tdb_delete_hash(struct tdb_context *tdb, TDB_DATA key, uint32_t hash) return ret; } -int tdb_delete(struct tdb_context *tdb, TDB_DATA key) +_PUBLIC_ int tdb_delete(struct tdb_context *tdb, TDB_DATA key) { uint32_t hash = tdb->hash_fn(&key); int ret; @@ -599,7 +599,7 @@ static int _tdb_store(struct tdb_context *tdb, TDB_DATA key, return 0 on success, -1 on failure */ -int tdb_store(struct tdb_context *tdb, TDB_DATA key, TDB_DATA dbuf, int flag) +_PUBLIC_ int tdb_store(struct tdb_context *tdb, TDB_DATA key, TDB_DATA dbuf, int flag) { uint32_t hash; int ret; @@ -622,7 +622,7 @@ int tdb_store(struct tdb_context *tdb, TDB_DATA key, TDB_DATA dbuf, int flag) } /* Append to an entry. Create if not exist. */ -int tdb_append(struct tdb_context *tdb, TDB_DATA key, TDB_DATA new_dbuf) +_PUBLIC_ int tdb_append(struct tdb_context *tdb, TDB_DATA key, TDB_DATA new_dbuf) { uint32_t hash; TDB_DATA dbuf; @@ -673,7 +673,7 @@ failed: return the name of the current tdb file useful for external logging functions */ -const char *tdb_name(struct tdb_context *tdb) +_PUBLIC_ const char *tdb_name(struct tdb_context *tdb) { return tdb->name; } @@ -683,7 +683,7 @@ const char *tdb_name(struct tdb_context *tdb) useful for external routines that want to check the device/inode of the fd */ -int tdb_fd(struct tdb_context *tdb) +_PUBLIC_ int tdb_fd(struct tdb_context *tdb) { return tdb->fd; } @@ -692,7 +692,7 @@ int tdb_fd(struct tdb_context *tdb) return the current logging function useful for external tdb routines that wish to log tdb errors */ -tdb_log_func tdb_log_fn(struct tdb_context *tdb) +_PUBLIC_ tdb_log_func tdb_log_fn(struct tdb_context *tdb) { return tdb->log.log_fn; } @@ -708,7 +708,7 @@ tdb_log_func tdb_log_fn(struct tdb_context *tdb) The aim of this sequence number is to allow for a very lightweight test of a possible tdb change. */ -int tdb_get_seqnum(struct tdb_context *tdb) +_PUBLIC_ int tdb_get_seqnum(struct tdb_context *tdb) { tdb_off_t seqnum=0; @@ -716,22 +716,22 @@ int tdb_get_seqnum(struct tdb_context *tdb) return seqnum; } -int tdb_hash_size(struct tdb_context *tdb) +_PUBLIC_ int tdb_hash_size(struct tdb_context *tdb) { return tdb->header.hash_size; } -size_t tdb_map_size(struct tdb_context *tdb) +_PUBLIC_ size_t tdb_map_size(struct tdb_context *tdb) { return tdb->map_size; } -int tdb_get_flags(struct tdb_context *tdb) +_PUBLIC_ int tdb_get_flags(struct tdb_context *tdb) { return tdb->flags; } -void tdb_add_flags(struct tdb_context *tdb, unsigned flags) +_PUBLIC_ void tdb_add_flags(struct tdb_context *tdb, unsigned flags) { if ((flags & TDB_ALLOW_NESTING) && (flags & TDB_DISALLOW_NESTING)) { @@ -751,7 +751,7 @@ void tdb_add_flags(struct tdb_context *tdb, unsigned flags) tdb->flags |= flags; } -void tdb_remove_flags(struct tdb_context *tdb, unsigned flags) +_PUBLIC_ void tdb_remove_flags(struct tdb_context *tdb, unsigned flags) { if ((flags & TDB_ALLOW_NESTING) && (flags & TDB_DISALLOW_NESTING)) { @@ -775,7 +775,7 @@ void tdb_remove_flags(struct tdb_context *tdb, unsigned flags) /* enable sequence number handling on an open tdb */ -void tdb_enable_seqnum(struct tdb_context *tdb) +_PUBLIC_ void tdb_enable_seqnum(struct tdb_context *tdb) { tdb->flags |= TDB_SEQNUM; } @@ -812,7 +812,7 @@ static int tdb_free_region(struct tdb_context *tdb, tdb_off_t offset, ssize_t le This code carefully steps around the recovery area, leaving it alone */ -int tdb_wipe_all(struct tdb_context *tdb) +_PUBLIC_ int tdb_wipe_all(struct tdb_context *tdb) { int i; tdb_off_t offset = 0; @@ -919,7 +919,7 @@ static int repack_traverse(struct tdb_context *tdb, TDB_DATA key, TDB_DATA data, /* repack a tdb */ -int tdb_repack(struct tdb_context *tdb) +_PUBLIC_ int tdb_repack(struct tdb_context *tdb) { struct tdb_context *tmp_db; struct traverse_state state; diff --git a/lib/tdb/common/transaction.c b/lib/tdb/common/transaction.c index ebf1cec5f2..c49de3877c 100644 --- a/lib/tdb/common/transaction.c +++ b/lib/tdb/common/transaction.c @@ -529,12 +529,12 @@ fail_allrecord_lock: return -1; } -int tdb_transaction_start(struct tdb_context *tdb) +_PUBLIC_ int tdb_transaction_start(struct tdb_context *tdb) { return _tdb_transaction_start(tdb, TDB_LOCK_WAIT); } -int tdb_transaction_start_nonblock(struct tdb_context *tdb) +_PUBLIC_ int tdb_transaction_start_nonblock(struct tdb_context *tdb) { return _tdb_transaction_start(tdb, TDB_LOCK_NOWAIT|TDB_LOCK_PROBE); } @@ -625,7 +625,7 @@ static int _tdb_transaction_cancel(struct tdb_context *tdb) /* cancel the current transaction */ -int tdb_transaction_cancel(struct tdb_context *tdb) +_PUBLIC_ int tdb_transaction_cancel(struct tdb_context *tdb) { tdb_trace(tdb, "tdb_transaction_cancel"); return _tdb_transaction_cancel(tdb); @@ -975,8 +975,8 @@ static int _tdb_transaction_prepare_commit(struct tdb_context *tdb) /* prepare to commit the current transaction */ -int tdb_transaction_prepare_commit(struct tdb_context *tdb) -{ +_PUBLIC_ int tdb_transaction_prepare_commit(struct tdb_context *tdb) +{ tdb_trace(tdb, "tdb_transaction_prepare_commit"); return _tdb_transaction_prepare_commit(tdb); } @@ -984,8 +984,8 @@ int tdb_transaction_prepare_commit(struct tdb_context *tdb) /* commit the current transaction */ -int tdb_transaction_commit(struct tdb_context *tdb) -{ +_PUBLIC_ int tdb_transaction_commit(struct tdb_context *tdb) +{ const struct tdb_methods *methods; int i; bool need_repack; diff --git a/lib/tdb/common/traverse.c b/lib/tdb/common/traverse.c index d77086a79a..517fecb4fc 100644 --- a/lib/tdb/common/traverse.c +++ b/lib/tdb/common/traverse.c @@ -212,7 +212,7 @@ out: /* a write style traverse - temporarily marks the db read only */ -int tdb_traverse_read(struct tdb_context *tdb, +_PUBLIC_ int tdb_traverse_read(struct tdb_context *tdb, tdb_traverse_func fn, void *private_data) { struct tdb_traverse_lock tl = { NULL, 0, 0, F_RDLCK }; @@ -241,7 +241,7 @@ int tdb_traverse_read(struct tdb_context *tdb, WARNING: The data buffer given to the callback fn does NOT meet the alignment restrictions malloc gives you. */ -int tdb_traverse(struct tdb_context *tdb, +_PUBLIC_ int tdb_traverse(struct tdb_context *tdb, tdb_traverse_func fn, void *private_data) { struct tdb_traverse_lock tl = { NULL, 0, 0, F_WRLCK }; @@ -267,7 +267,7 @@ int tdb_traverse(struct tdb_context *tdb, /* find the first entry in the database and return its key */ -TDB_DATA tdb_firstkey(struct tdb_context *tdb) +_PUBLIC_ TDB_DATA tdb_firstkey(struct tdb_context *tdb) { TDB_DATA key; struct tdb_record rec; @@ -298,7 +298,7 @@ TDB_DATA tdb_firstkey(struct tdb_context *tdb) } /* find the next entry in the database, returning its key */ -TDB_DATA tdb_nextkey(struct tdb_context *tdb, TDB_DATA oldkey) +_PUBLIC_ TDB_DATA tdb_nextkey(struct tdb_context *tdb, TDB_DATA oldkey) { uint32_t oldhash; TDB_DATA key = tdb_null; diff --git a/lib/tdb/include/tdb.h b/lib/tdb/include/tdb.h index 96fc157f68..115c6fada6 100644 --- a/lib/tdb/include/tdb.h +++ b/lib/tdb/include/tdb.h @@ -91,85 +91,85 @@ struct tdb_logging_context { void *log_private; }; -_PUBLIC_ struct tdb_context *tdb_open(const char *name, int hash_size, int tdb_flags, +struct tdb_context *tdb_open(const char *name, int hash_size, int tdb_flags, int open_flags, mode_t mode); -_PUBLIC_ struct tdb_context *tdb_open_ex(const char *name, int hash_size, int tdb_flags, +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); -_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, +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); -_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_ unsigned int tdb_jenkins_hash(TDB_DATA *key); -_PUBLIC_ int tdb_check(struct tdb_context *tdb, +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_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); +unsigned int tdb_jenkins_hash(TDB_DATA *key); +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 */ -_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); +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_ void tdb_setalarm_sigptr(struct tdb_context *tdb, volatile sig_atomic_t *sigptr); +void tdb_setalarm_sigptr(struct tdb_context *tdb, volatile sig_atomic_t *sigptr); /* wipe and repack */ -_PUBLIC_ int tdb_wipe_all(struct tdb_context *tdb); -_PUBLIC_ int tdb_repack(struct tdb_context *tdb); +int tdb_wipe_all(struct tdb_context *tdb); +int tdb_repack(struct tdb_context *tdb); /* Debug functions. Not used in production. */ -_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); +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_ extern TDB_DATA tdb_null; +extern TDB_DATA tdb_null; #ifdef __cplusplus } |