They'll all be accessed via the tdb2 API.
-_PUBLIC_ int tdb1_check(struct tdb1_context *tdb,
+int tdb1_check(struct tdb1_context *tdb,
int (*check)(TDB1_DATA key, TDB1_DATA data, void *private_data),
void *private_data)
{
int (*check)(TDB1_DATA key, TDB1_DATA data, void *private_data),
void *private_data)
{
-_PUBLIC_ unsigned int tdb1_jenkins_hash(TDB1_DATA *key)
+unsigned int tdb1_jenkins_hash(TDB1_DATA *key)
{
return hashlittle(key->dptr, key->dsize);
}
{
return hashlittle(key->dptr, key->dsize);
}
}
/* lock entire database with write lock */
}
/* lock entire database with write lock */
-_PUBLIC_ int tdb1_lockall(struct tdb1_context *tdb)
+int tdb1_lockall(struct tdb1_context *tdb)
{
return tdb1_allrecord_lock(tdb, F_WRLCK, TDB1_LOCK_WAIT, false);
}
/* unlock entire database with write lock */
{
return tdb1_allrecord_lock(tdb, F_WRLCK, TDB1_LOCK_WAIT, false);
}
/* unlock entire database with write lock */
-_PUBLIC_ int tdb1_unlockall(struct tdb1_context *tdb)
+int tdb1_unlockall(struct tdb1_context *tdb)
{
return tdb1_allrecord_unlock(tdb, F_WRLCK, false);
}
/* lock entire database with read lock */
{
return tdb1_allrecord_unlock(tdb, F_WRLCK, false);
}
/* lock entire database with read lock */
-_PUBLIC_ int tdb1_lockall_read(struct tdb1_context *tdb)
+int tdb1_lockall_read(struct tdb1_context *tdb)
{
return tdb1_allrecord_lock(tdb, F_RDLCK, TDB1_LOCK_WAIT, false);
}
/* unlock entire database with read lock */
{
return tdb1_allrecord_lock(tdb, F_RDLCK, TDB1_LOCK_WAIT, false);
}
/* unlock entire database with read lock */
-_PUBLIC_ int tdb1_unlockall_read(struct tdb1_context *tdb)
+int tdb1_unlockall_read(struct tdb1_context *tdb)
{
return tdb1_allrecord_unlock(tdb, F_RDLCK, false);
}
/* lock/unlock one hash chain. This is meant to be used to reduce
contention - it cannot guarantee how many records will be locked */
{
return tdb1_allrecord_unlock(tdb, F_RDLCK, false);
}
/* lock/unlock one hash chain. This is meant to be used to reduce
contention - it cannot guarantee how many records will be locked */
-_PUBLIC_ int tdb1_chainlock(struct tdb1_context *tdb, TDB1_DATA key)
+int tdb1_chainlock(struct tdb1_context *tdb, TDB1_DATA key)
{
int ret = tdb1_lock(tdb, TDB1_BUCKET(tdb->hash_fn(&key)), F_WRLCK);
return ret;
}
{
int ret = tdb1_lock(tdb, TDB1_BUCKET(tdb->hash_fn(&key)), F_WRLCK);
return ret;
}
-_PUBLIC_ int tdb1_chainunlock(struct tdb1_context *tdb, TDB1_DATA key)
+int tdb1_chainunlock(struct tdb1_context *tdb, TDB1_DATA key)
{
return tdb1_unlock(tdb, TDB1_BUCKET(tdb->hash_fn(&key)), F_WRLCK);
}
{
return tdb1_unlock(tdb, TDB1_BUCKET(tdb->hash_fn(&key)), F_WRLCK);
}
-_PUBLIC_ int tdb1_chainlock_read(struct tdb1_context *tdb, TDB1_DATA key)
+int tdb1_chainlock_read(struct tdb1_context *tdb, TDB1_DATA key)
{
int ret;
ret = tdb1_lock(tdb, TDB1_BUCKET(tdb->hash_fn(&key)), F_RDLCK);
return ret;
}
{
int ret;
ret = tdb1_lock(tdb, TDB1_BUCKET(tdb->hash_fn(&key)), F_RDLCK);
return ret;
}
-_PUBLIC_ int tdb1_chainunlock_read(struct tdb1_context *tdb, TDB1_DATA key)
+int tdb1_chainunlock_read(struct tdb1_context *tdb, TDB1_DATA key)
{
return tdb1_unlock(tdb, TDB1_BUCKET(tdb->hash_fn(&key)), F_RDLCK);
}
{
return tdb1_unlock(tdb, TDB1_BUCKET(tdb->hash_fn(&key)), F_RDLCK);
}
try to call tdb1_error or tdb1_errname, just do strerror(errno).
@param name may be NULL for internal databases. */
try to call tdb1_error or tdb1_errname, just do strerror(errno).
@param name may be NULL for internal databases. */
-_PUBLIC_ struct tdb1_context *tdb1_open(const char *name, int hash_size, int tdb1_flags,
+struct tdb1_context *tdb1_open(const char *name, int hash_size, int tdb1_flags,
int open_flags, mode_t mode)
{
return tdb1_open_ex(name, hash_size, tdb1_flags, open_flags, mode, NULL, NULL);
int open_flags, mode_t mode)
{
return tdb1_open_ex(name, hash_size, tdb1_flags, open_flags, mode, NULL, NULL);
return check_header_hash(tdb, false, m1, m2);
}
return check_header_hash(tdb, false, m1, m2);
}
-_PUBLIC_ struct tdb1_context *tdb1_open_ex(const char *name, int hash_size, int tdb1_flags,
+struct tdb1_context *tdb1_open_ex(const char *name, int hash_size, int tdb1_flags,
int open_flags, mode_t mode,
const struct tdb1_logging_context *log_ctx,
tdb1_hash_func hash_fn)
int open_flags, mode_t mode,
const struct tdb1_logging_context *log_ctx,
tdb1_hash_func hash_fn)
* Set the maximum number of dead records per hash chain
*/
* Set the maximum number of dead records per hash chain
*/
-_PUBLIC_ void tdb1_set_max_dead(struct tdb1_context *tdb, int max_dead)
+void tdb1_set_max_dead(struct tdb1_context *tdb, int max_dead)
{
tdb->max_dead_records = max_dead;
}
{
tdb->max_dead_records = max_dead;
}
*
* @returns -1 for error; 0 for success.
**/
*
* @returns -1 for error; 0 for success.
**/
-_PUBLIC_ int tdb1_close(struct tdb1_context *tdb)
+int tdb1_close(struct tdb1_context *tdb)
{
struct tdb1_context **i;
int ret = 0;
{
struct tdb1_context **i;
int ret = 0;
#include <limits.h>
#include <stdio.h>
#include <utime.h>
#include <limits.h>
#include <stdio.h>
#include <utime.h>
-
-#ifndef _PUBLIC_
-#define _PUBLIC_
-#endif
-
#else
#include "replace.h"
#include "system/filesys.h"
#else
#include "replace.h"
#include "system/filesys.h"
-_PUBLIC_ char *tdb1_summary(struct tdb1_context *tdb)
+char *tdb1_summary(struct tdb1_context *tdb)
{
tdb1_off_t off, rec_off;
struct tally freet, keys, data, dead, extra, hash, uncoal;
{
tdb1_off_t off, rec_off;
struct tally freet, keys, data, dead, extra, hash, uncoal;
#include "tdb1_private.h"
#include "tdb1_private.h"
-_PUBLIC_ TDB1_DATA tdb1_null;
/*
non-blocking increment of the tdb sequence number if the tdb has been opened using
the TDB1_SEQNUM flag
*/
/*
non-blocking increment of the tdb sequence number if the tdb has been opened using
the TDB1_SEQNUM flag
*/
-_PUBLIC_ void tdb1_increment_seqnum_nonblock(struct tdb1_context *tdb)
+void tdb1_increment_seqnum_nonblock(struct tdb1_context *tdb)
-_PUBLIC_ TDB1_DATA tdb1_fetch(struct tdb1_context *tdb, TDB1_DATA key)
+TDB1_DATA tdb1_fetch(struct tdb1_context *tdb, TDB1_DATA key)
{
TDB1_DATA ret = _tdb1_fetch(tdb, key);
{
TDB1_DATA ret = _tdb1_fetch(tdb, key);
* Return -1 if the record was not found.
*/
* Return -1 if the record was not found.
*/
-_PUBLIC_ int tdb1_parse_record(struct tdb1_context *tdb, TDB1_DATA key,
+int tdb1_parse_record(struct tdb1_context *tdb, TDB1_DATA key,
int (*parser)(TDB1_DATA key, TDB1_DATA data,
void *private_data),
void *private_data)
int (*parser)(TDB1_DATA key, TDB1_DATA data,
void *private_data),
void *private_data)
-_PUBLIC_ int tdb1_exists(struct tdb1_context *tdb, TDB1_DATA key)
+int tdb1_exists(struct tdb1_context *tdb, TDB1_DATA key)
{
uint32_t hash = tdb->hash_fn(&key);
int ret;
{
uint32_t hash = tdb->hash_fn(&key);
int ret;
-_PUBLIC_ int tdb1_delete(struct tdb1_context *tdb, TDB1_DATA key)
+int tdb1_delete(struct tdb1_context *tdb, TDB1_DATA key)
{
uint32_t hash = tdb->hash_fn(&key);
int ret;
{
uint32_t hash = tdb->hash_fn(&key);
int ret;
return 0 on success, -1 on failure
*/
return 0 on success, -1 on failure
*/
-_PUBLIC_ int tdb1_store(struct tdb1_context *tdb, TDB1_DATA key, TDB1_DATA dbuf, int flag)
+int tdb1_store(struct tdb1_context *tdb, TDB1_DATA key, TDB1_DATA dbuf, int flag)
{
uint32_t hash;
int ret;
{
uint32_t hash;
int ret;
}
/* Append to an entry. Create if not exist. */
}
/* Append to an entry. Create if not exist. */
-_PUBLIC_ int tdb1_append(struct tdb1_context *tdb, TDB1_DATA key, TDB1_DATA new_dbuf)
+int tdb1_append(struct tdb1_context *tdb, TDB1_DATA key, TDB1_DATA new_dbuf)
{
uint32_t hash;
TDB1_DATA dbuf;
{
uint32_t hash;
TDB1_DATA dbuf;
return the current logging function
useful for external tdb routines that wish to log tdb errors
*/
return the current logging function
useful for external tdb routines that wish to log tdb errors
*/
-_PUBLIC_ tdb1_log_func tdb1_log_fn(struct tdb1_context *tdb)
+tdb1_log_func tdb1_log_fn(struct tdb1_context *tdb)
{
return tdb->log.log_fn;
}
{
return tdb->log.log_fn;
}
The aim of this sequence number is to allow for a very lightweight
test of a possible tdb change.
*/
The aim of this sequence number is to allow for a very lightweight
test of a possible tdb change.
*/
-_PUBLIC_ int tdb1_get_seqnum(struct tdb1_context *tdb)
+int tdb1_get_seqnum(struct tdb1_context *tdb)
-_PUBLIC_ int tdb1_hash_size(struct tdb1_context *tdb)
+int tdb1_hash_size(struct tdb1_context *tdb)
{
return tdb->header.hash_size;
}
{
return tdb->header.hash_size;
}
This code carefully steps around the recovery area, leaving it alone
*/
This code carefully steps around the recovery area, leaving it alone
*/
-_PUBLIC_ int tdb1_wipe_all(struct tdb1_context *tdb)
+int tdb1_wipe_all(struct tdb1_context *tdb)
{
int i;
tdb1_off_t offset = 0;
{
int i;
tdb1_off_t offset = 0;
-_PUBLIC_ int tdb1_repack(struct tdb1_context *tdb)
+int tdb1_repack(struct tdb1_context *tdb)
{
struct tdb1_context *tmp_db;
struct traverse_state state;
{
struct tdb1_context *tmp_db;
struct traverse_state state;
-_PUBLIC_ int tdb1_transaction_start(struct tdb1_context *tdb)
+int tdb1_transaction_start(struct tdb1_context *tdb)
{
return _tdb1_transaction_start(tdb, TDB1_LOCK_WAIT);
}
{
return _tdb1_transaction_start(tdb, TDB1_LOCK_WAIT);
}
/*
cancel the current transaction
*/
/*
cancel the current transaction
*/
-_PUBLIC_ int tdb1_transaction_cancel(struct tdb1_context *tdb)
+int tdb1_transaction_cancel(struct tdb1_context *tdb)
{
return _tdb1_transaction_cancel(tdb);
}
{
return _tdb1_transaction_cancel(tdb);
}
/*
prepare to commit the current transaction
*/
/*
prepare to commit the current transaction
*/
-_PUBLIC_ int tdb1_transaction_prepare_commit(struct tdb1_context *tdb)
+int tdb1_transaction_prepare_commit(struct tdb1_context *tdb)
{
return _tdb1_transaction_prepare_commit(tdb);
}
{
return _tdb1_transaction_prepare_commit(tdb);
}
/*
commit the current transaction
*/
/*
commit the current transaction
*/
-_PUBLIC_ int tdb1_transaction_commit(struct tdb1_context *tdb)
+int tdb1_transaction_commit(struct tdb1_context *tdb)
{
const struct tdb1_methods *methods;
int i;
{
const struct tdb1_methods *methods;
int i;
/*
a write style traverse - temporarily marks the db read only
*/
/*
a write style traverse - temporarily marks the db read only
*/
-_PUBLIC_ int tdb1_traverse_read(struct tdb1_context *tdb,
+int tdb1_traverse_read(struct tdb1_context *tdb,
tdb1_traverse_func fn, void *private_data)
{
struct tdb1_traverse_lock tl = { NULL, 0, 0, F_RDLCK };
tdb1_traverse_func fn, void *private_data)
{
struct tdb1_traverse_lock tl = { NULL, 0, 0, F_RDLCK };
WARNING: The data buffer given to the callback fn does NOT meet the
alignment restrictions malloc gives you.
*/
WARNING: The data buffer given to the callback fn does NOT meet the
alignment restrictions malloc gives you.
*/
-_PUBLIC_ int tdb1_traverse(struct tdb1_context *tdb,
+int tdb1_traverse(struct tdb1_context *tdb,
tdb1_traverse_func fn, void *private_data)
{
struct tdb1_traverse_lock tl = { NULL, 0, 0, F_WRLCK };
tdb1_traverse_func fn, void *private_data)
{
struct tdb1_traverse_lock tl = { NULL, 0, 0, F_WRLCK };
/* find the first entry in the database and return its key */
/* find the first entry in the database and return its key */
-_PUBLIC_ TDB1_DATA tdb1_firstkey(struct tdb1_context *tdb)
+TDB1_DATA tdb1_firstkey(struct tdb1_context *tdb)
{
TDB1_DATA key;
struct tdb1_record rec;
{
TDB1_DATA key;
struct tdb1_record rec;
}
/* find the next entry in the database, returning its key */
}
/* find the next entry in the database, returning its key */
-_PUBLIC_ TDB1_DATA tdb1_nextkey(struct tdb1_context *tdb, TDB1_DATA oldkey)
+TDB1_DATA tdb1_nextkey(struct tdb1_context *tdb, TDB1_DATA oldkey)
{
uint32_t oldhash;
TDB1_DATA key = tdb1_null;
{
uint32_t oldhash;
TDB1_DATA key = tdb1_null;