Commit 39f55294 authored by Rusty Russell's avatar Rusty Russell

tdb2: remove _PUBLIC_ in tdb1 functions.

They'll all be accessed via the tdb2 API.
parent b929638e
...@@ -322,7 +322,7 @@ size_t tdb1_dead_space(struct tdb1_context *tdb, tdb1_off_t off) ...@@ -322,7 +322,7 @@ size_t tdb1_dead_space(struct tdb1_context *tdb, tdb1_off_t off)
return len; return len;
} }
_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), int (*check)(TDB1_DATA key, TDB1_DATA data, void *private_data),
void *private_data) void *private_data)
{ {
......
...@@ -339,7 +339,7 @@ static uint32_t hashlittle( const void *key, size_t length ) ...@@ -339,7 +339,7 @@ static uint32_t hashlittle( const void *key, size_t length )
return c; return c;
} }
_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);
} }
...@@ -626,50 +626,50 @@ int tdb1_allrecord_unlock(struct tdb1_context *tdb, int ltype, bool mark_lock) ...@@ -626,50 +626,50 @@ int tdb1_allrecord_unlock(struct tdb1_context *tdb, int ltype, bool mark_lock)
} }
/* 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); return tdb1_allrecord_lock(tdb, F_WRLCK, TDB1_LOCK_WAIT, false);
} }
/* unlock entire database with write lock */ /* 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); return tdb1_allrecord_unlock(tdb, F_WRLCK, false);
} }
/* lock entire database with read lock */ /* 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); return tdb1_allrecord_lock(tdb, F_RDLCK, TDB1_LOCK_WAIT, false);
} }
/* unlock entire database with read lock */ /* 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); return tdb1_allrecord_unlock(tdb, F_RDLCK, false);
} }
/* lock/unlock one hash chain. This is meant to be used to reduce /* lock/unlock one hash chain. This is meant to be used to reduce
contention - it cannot guarantee how many records will be locked */ 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); int ret = tdb1_lock(tdb, TDB1_BUCKET(tdb->hash_fn(&key)), F_WRLCK);
return ret; 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; int ret;
ret = tdb1_lock(tdb, TDB1_BUCKET(tdb->hash_fn(&key)), F_RDLCK); ret = tdb1_lock(tdb, TDB1_BUCKET(tdb->hash_fn(&key)), F_RDLCK);
return ret; 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);
} }
......
...@@ -129,7 +129,7 @@ static int tdb1_already_open(dev_t device, ...@@ -129,7 +129,7 @@ static int tdb1_already_open(dev_t device,
try to call tdb1_error or tdb1_errname, just do strerror(errno). try to call tdb1_error or tdb1_errname, just do strerror(errno).
@param name may be NULL for internal databases. */ @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) int open_flags, mode_t mode)
{ {
return tdb1_open_ex(name, hash_size, tdb1_flags, open_flags, mode, NULL, NULL); return tdb1_open_ex(name, hash_size, tdb1_flags, open_flags, mode, NULL, NULL);
...@@ -162,7 +162,7 @@ static bool check_header_hash(struct tdb1_context *tdb, ...@@ -162,7 +162,7 @@ static bool check_header_hash(struct tdb1_context *tdb,
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, int open_flags, mode_t mode,
const struct tdb1_logging_context *log_ctx, const struct tdb1_logging_context *log_ctx,
tdb1_hash_func hash_fn) tdb1_hash_func hash_fn)
...@@ -450,7 +450,7 @@ _PUBLIC_ struct tdb1_context *tdb1_open_ex(const char *name, int hash_size, int ...@@ -450,7 +450,7 @@ _PUBLIC_ struct tdb1_context *tdb1_open_ex(const char *name, int hash_size, int
* 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;
} }
...@@ -460,7 +460,7 @@ _PUBLIC_ void tdb1_set_max_dead(struct tdb1_context *tdb, int max_dead) ...@@ -460,7 +460,7 @@ _PUBLIC_ void tdb1_set_max_dead(struct tdb1_context *tdb, int 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; struct tdb1_context **i;
int ret = 0; int ret = 0;
......
...@@ -45,11 +45,6 @@ ...@@ -45,11 +45,6 @@
#include <limits.h> #include <limits.h>
#include <stdio.h> #include <stdio.h>
#include <utime.h> #include <utime.h>
#ifndef _PUBLIC_
#define _PUBLIC_
#endif
#else #else
#include "replace.h" #include "replace.h"
#include "system/filesys.h" #include "system/filesys.h"
......
...@@ -84,7 +84,7 @@ static size_t get_hash_length(struct tdb1_context *tdb, unsigned int i) ...@@ -84,7 +84,7 @@ static size_t get_hash_length(struct tdb1_context *tdb, unsigned int i)
return count; return count;
} }
_PUBLIC_ char *tdb1_summary(struct tdb1_context *tdb) char *tdb1_summary(struct tdb1_context *tdb)
{ {
tdb1_off_t off, rec_off; tdb1_off_t off, rec_off;
struct tally freet, keys, data, dead, extra, hash, uncoal; struct tally freet, keys, data, dead, extra, hash, uncoal;
......
...@@ -27,13 +27,13 @@ ...@@ -27,13 +27,13 @@
#include "tdb1_private.h" #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 non-blocking increment of the tdb sequence number if the tdb has been opened using
the TDB1_SEQNUM flag 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; tdb1_off_t seqnum=0;
...@@ -199,7 +199,7 @@ static TDB1_DATA _tdb1_fetch(struct tdb1_context *tdb, TDB1_DATA key) ...@@ -199,7 +199,7 @@ static TDB1_DATA _tdb1_fetch(struct tdb1_context *tdb, TDB1_DATA key)
return ret; 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); TDB1_DATA ret = _tdb1_fetch(tdb, key);
...@@ -224,7 +224,7 @@ _PUBLIC_ TDB1_DATA tdb1_fetch(struct tdb1_context *tdb, TDB1_DATA key) ...@@ -224,7 +224,7 @@ _PUBLIC_ TDB1_DATA tdb1_fetch(struct tdb1_context *tdb, TDB1_DATA 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, int (*parser)(TDB1_DATA key, TDB1_DATA data,
void *private_data), void *private_data),
void *private_data) void *private_data)
...@@ -267,7 +267,7 @@ static int tdb1_exists_hash(struct tdb1_context *tdb, TDB1_DATA key, uint32_t ha ...@@ -267,7 +267,7 @@ static int tdb1_exists_hash(struct tdb1_context *tdb, TDB1_DATA key, uint32_t ha
return 1; 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); uint32_t hash = tdb->hash_fn(&key);
int ret; int ret;
...@@ -425,7 +425,7 @@ static int tdb1_delete_hash(struct tdb1_context *tdb, TDB1_DATA key, uint32_t ha ...@@ -425,7 +425,7 @@ static int tdb1_delete_hash(struct tdb1_context *tdb, TDB1_DATA key, uint32_t ha
return 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); uint32_t hash = tdb->hash_fn(&key);
int ret; int ret;
...@@ -594,7 +594,7 @@ static int _tdb1_store(struct tdb1_context *tdb, TDB1_DATA key, ...@@ -594,7 +594,7 @@ static int _tdb1_store(struct tdb1_context *tdb, TDB1_DATA key,
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; uint32_t hash;
int ret; int ret;
...@@ -615,7 +615,7 @@ _PUBLIC_ int tdb1_store(struct tdb1_context *tdb, TDB1_DATA key, TDB1_DATA dbuf, ...@@ -615,7 +615,7 @@ _PUBLIC_ int tdb1_store(struct tdb1_context *tdb, TDB1_DATA key, TDB1_DATA dbuf,
} }
/* 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; uint32_t hash;
TDB1_DATA dbuf; TDB1_DATA dbuf;
...@@ -665,7 +665,7 @@ failed: ...@@ -665,7 +665,7 @@ failed:
return the current logging function return the current logging function
useful for external tdb routines that wish to log tdb errors 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;
} }
...@@ -681,7 +681,7 @@ _PUBLIC_ tdb1_log_func tdb1_log_fn(struct tdb1_context *tdb) ...@@ -681,7 +681,7 @@ _PUBLIC_ tdb1_log_func tdb1_log_fn(struct tdb1_context *tdb)
The aim of this sequence number is to allow for a very lightweight The aim of this sequence number is to allow for a very lightweight
test of a possible tdb change. 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; tdb1_off_t seqnum=0;
...@@ -689,7 +689,7 @@ _PUBLIC_ int tdb1_get_seqnum(struct tdb1_context *tdb) ...@@ -689,7 +689,7 @@ _PUBLIC_ int tdb1_get_seqnum(struct tdb1_context *tdb)
return seqnum; return seqnum;
} }
_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;
} }
...@@ -726,7 +726,7 @@ static int tdb1_free_region(struct tdb1_context *tdb, tdb1_off_t offset, ssize_t ...@@ -726,7 +726,7 @@ static int tdb1_free_region(struct tdb1_context *tdb, tdb1_off_t offset, ssize_t
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; int i;
tdb1_off_t offset = 0; tdb1_off_t offset = 0;
...@@ -832,7 +832,7 @@ static int repack_traverse(struct tdb1_context *tdb, TDB1_DATA key, TDB1_DATA da ...@@ -832,7 +832,7 @@ static int repack_traverse(struct tdb1_context *tdb, TDB1_DATA key, TDB1_DATA da
/* /*
repack a tdb repack a tdb
*/ */
_PUBLIC_ int tdb1_repack(struct tdb1_context *tdb) int tdb1_repack(struct tdb1_context *tdb)
{ {
struct tdb1_context *tmp_db; struct tdb1_context *tmp_db;
struct traverse_state state; struct traverse_state state;
......
...@@ -527,7 +527,7 @@ fail_allrecord_lock: ...@@ -527,7 +527,7 @@ fail_allrecord_lock:
return -1; return -1;
} }
_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);
} }
...@@ -618,7 +618,7 @@ static int _tdb1_transaction_cancel(struct tdb1_context *tdb) ...@@ -618,7 +618,7 @@ static int _tdb1_transaction_cancel(struct tdb1_context *tdb)
/* /*
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);
} }
...@@ -983,7 +983,7 @@ static int _tdb1_transaction_prepare_commit(struct tdb1_context *tdb) ...@@ -983,7 +983,7 @@ static int _tdb1_transaction_prepare_commit(struct tdb1_context *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);
} }
...@@ -1013,7 +1013,7 @@ static bool repack_worthwhile(struct tdb1_context *tdb) ...@@ -1013,7 +1013,7 @@ static bool repack_worthwhile(struct tdb1_context *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; const struct tdb1_methods *methods;
int i; int i;
......
...@@ -208,7 +208,7 @@ out: ...@@ -208,7 +208,7 @@ out:
/* /*
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) tdb1_traverse_func fn, void *private_data)
{ {
struct tdb1_traverse_lock tl = { NULL, 0, 0, F_RDLCK }; struct tdb1_traverse_lock tl = { NULL, 0, 0, F_RDLCK };
...@@ -236,7 +236,7 @@ _PUBLIC_ int tdb1_traverse_read(struct tdb1_context *tdb, ...@@ -236,7 +236,7 @@ _PUBLIC_ int tdb1_traverse_read(struct tdb1_context *tdb,
WARNING: The data buffer given to the callback fn does NOT meet the WARNING: The data buffer given to the callback fn does NOT meet the
alignment restrictions malloc gives you. 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) tdb1_traverse_func fn, void *private_data)
{ {
struct tdb1_traverse_lock tl = { NULL, 0, 0, F_WRLCK }; struct tdb1_traverse_lock tl = { NULL, 0, 0, F_WRLCK };
...@@ -261,7 +261,7 @@ _PUBLIC_ int tdb1_traverse(struct tdb1_context *tdb, ...@@ -261,7 +261,7 @@ _PUBLIC_ int tdb1_traverse(struct tdb1_context *tdb,
/* 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; TDB1_DATA key;
struct tdb1_record rec; struct tdb1_record rec;
...@@ -289,7 +289,7 @@ _PUBLIC_ TDB1_DATA tdb1_firstkey(struct tdb1_context *tdb) ...@@ -289,7 +289,7 @@ _PUBLIC_ TDB1_DATA tdb1_firstkey(struct tdb1_context *tdb)
} }
/* 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; uint32_t oldhash;
TDB1_DATA key = tdb1_null; TDB1_DATA key = tdb1_null;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment