#include "tdb1_private.h"
-_PUBLIC_ TDB1_DATA tdb1_null;
+TDB1_DATA tdb1_null;
/*
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)
{
tdb1_off_t seqnum=0;
return ret;
}
-_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);
* 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)
return 1;
}
-_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;
return 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;
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;
}
/* 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;
}
-/*
- return the name of the current tdb file
- useful for external logging functions
-*/
-_PUBLIC_ const char *tdb1_name(struct tdb1_context *tdb)
-{
- return tdb->name;
-}
-
-/*
- return the underlying file descriptor being used by tdb, or -1
- useful for external routines that want to check the device/inode
- of the fd
-*/
-_PUBLIC_ int tdb1_fd(struct tdb1_context *tdb)
-{
- return tdb->fd;
-}
-
/*
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;
}
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)
{
tdb1_off_t seqnum=0;
return seqnum;
}
-_PUBLIC_ int tdb1_hash_size(struct tdb1_context *tdb)
+int tdb1_hash_size(struct tdb1_context *tdb)
{
return tdb->header.hash_size;
}
-_PUBLIC_ size_t tdb1_map_size(struct tdb1_context *tdb)
-{
- return tdb->map_size;
-}
-
-_PUBLIC_ int tdb1_get_flags(struct tdb1_context *tdb)
-{
- return tdb->flags;
-}
-
-_PUBLIC_ void tdb1_add_flags(struct tdb1_context *tdb, unsigned flags)
-{
- if ((flags & TDB1_ALLOW_NESTING) &&
- (flags & TDB1_DISALLOW_NESTING)) {
- tdb->ecode = TDB1_ERR_NESTING;
- TDB1_LOG((tdb, TDB1_DEBUG_FATAL, "tdb1_add_flags: "
- "allow_nesting and disallow_nesting are not allowed together!"));
- return;
- }
-
- if (flags & TDB1_ALLOW_NESTING) {
- tdb->flags &= ~TDB1_DISALLOW_NESTING;
- }
- if (flags & TDB1_DISALLOW_NESTING) {
- tdb->flags &= ~TDB1_ALLOW_NESTING;
- }
-
- tdb->flags |= flags;
-}
-
-_PUBLIC_ void tdb1_remove_flags(struct tdb1_context *tdb, unsigned flags)
-{
- if ((flags & TDB1_ALLOW_NESTING) &&
- (flags & TDB1_DISALLOW_NESTING)) {
- tdb->ecode = TDB1_ERR_NESTING;
- TDB1_LOG((tdb, TDB1_DEBUG_FATAL, "tdb1_remove_flags: "
- "allow_nesting and disallow_nesting are not allowed together!"));
- return;
- }
-
- if (flags & TDB1_ALLOW_NESTING) {
- tdb->flags |= TDB1_DISALLOW_NESTING;
- }
- if (flags & TDB1_DISALLOW_NESTING) {
- tdb->flags |= TDB1_ALLOW_NESTING;
- }
-
- tdb->flags &= ~flags;
-}
-
-
-/*
- enable sequence number handling on an open tdb
-*/
-_PUBLIC_ void tdb1_enable_seqnum(struct tdb1_context *tdb)
-{
- tdb->flags |= TDB1_SEQNUM;
-}
-
/*
add a region of the file to the freelist. Length is the size of the region in bytes,
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;
/*
repack a tdb
*/
-_PUBLIC_ int tdb1_repack(struct tdb1_context *tdb)
+int tdb1_repack(struct tdb1_context *tdb)
{
struct tdb1_context *tmp_db;
struct traverse_state state;