Commit 91ddc0b7 authored by Rusty Russell's avatar Rusty Russell

Use _ convention everywhere: lock.c uses it already.

parent aa83ea33
......@@ -393,7 +393,7 @@ int tdb_close(struct tdb_context *tdb)
tdb_trace(tdb, "tdb_close");
if (tdb->transaction) {
tdb_transaction_cancel_internal(tdb);
_tdb_transaction_cancel(tdb);
}
if (tdb->map_ptr) {
......
......@@ -160,7 +160,7 @@ static int tdb_update_hash(struct tdb_context *tdb, TDB_DATA key, uint32_t hash,
* then the TDB_DATA will have zero length but
* a non-zero pointer
*/
static TDB_DATA do_tdb_fetch(struct tdb_context *tdb, TDB_DATA key)
static TDB_DATA _tdb_fetch(struct tdb_context *tdb, TDB_DATA key)
{
tdb_off_t rec_ptr;
struct list_struct rec;
......@@ -181,7 +181,7 @@ static TDB_DATA do_tdb_fetch(struct tdb_context *tdb, TDB_DATA key)
TDB_DATA tdb_fetch(struct tdb_context *tdb, TDB_DATA key)
{
TDB_DATA ret = do_tdb_fetch(tdb, key);
TDB_DATA ret = _tdb_fetch(tdb, key);
tdb_trace_1rec_retrec(tdb, "tdb_fetch", key, ret);
return ret;
......@@ -446,8 +446,8 @@ static tdb_off_t tdb_find_dead(struct tdb_context *tdb, uint32_t hash,
return 0;
}
static int _tdb_store(struct tdb_context *tdb, TDB_DATA key, TDB_DATA dbuf,
int flag, uint32_t hash)
static int _tdb_store(struct tdb_context *tdb, TDB_DATA key,
TDB_DATA dbuf, int flag, uint32_t hash)
{
struct list_struct rec;
tdb_off_t rec_ptr;
......@@ -613,7 +613,7 @@ int tdb_append(struct tdb_context *tdb, TDB_DATA key, TDB_DATA new_dbuf)
if (tdb_lock(tdb, BUCKET(hash), F_WRLCK) == -1)
return -1;
dbuf = do_tdb_fetch(tdb, key);
dbuf = _tdb_fetch(tdb, key);
if (dbuf.dptr == NULL) {
dbuf.dptr = (unsigned char *)malloc(new_dbuf.dsize);
......
......@@ -250,7 +250,7 @@ int tdb_ofs_read(struct tdb_context *tdb, tdb_off_t offset, tdb_off_t *d);
int tdb_ofs_write(struct tdb_context *tdb, tdb_off_t offset, tdb_off_t *d);
int tdb_lock_record(struct tdb_context *tdb, tdb_off_t off);
int tdb_unlock_record(struct tdb_context *tdb, tdb_off_t off);
int tdb_transaction_cancel_internal(struct tdb_context *tdb);
int _tdb_transaction_cancel(struct tdb_context *tdb);
int tdb_rec_read(struct tdb_context *tdb, tdb_off_t offset, struct list_struct *rec);
int tdb_rec_write(struct tdb_context *tdb, tdb_off_t offset, struct list_struct *rec);
int tdb_do_delete(struct tdb_context *tdb, tdb_off_t rec_ptr, struct list_struct *rec);
......
......@@ -455,7 +455,7 @@ static int transaction_sync(struct tdb_context *tdb, tdb_off_t offset, tdb_len_t
return 0;
}
int tdb_transaction_cancel_internal(struct tdb_context *tdb)
int _tdb_transaction_cancel(struct tdb_context *tdb)
{
int i, ret = 0;
......@@ -636,7 +636,7 @@ fail:
int tdb_transaction_cancel(struct tdb_context *tdb)
{
tdb_trace(tdb, "tdb_transaction_cancel");
return tdb_transaction_cancel_internal(tdb);
return _tdb_transaction_cancel(tdb);
}
/*
......@@ -885,7 +885,7 @@ static int transaction_setup_recovery(struct tdb_context *tdb,
return 0;
}
static int tdb_transaction_prepare_commit_internal(struct tdb_context *tdb)
static int _tdb_transaction_prepare_commit(struct tdb_context *tdb)
{
const struct tdb_methods *methods;
......@@ -896,14 +896,14 @@ static int tdb_transaction_prepare_commit_internal(struct tdb_context *tdb)
if (tdb->transaction->prepared) {
tdb->ecode = TDB_ERR_EINVAL;
tdb_transaction_cancel(tdb);
_tdb_transaction_cancel(tdb);
TDB_LOG((tdb, TDB_DEBUG_ERROR, "tdb_transaction_prepare_commit: transaction already prepared\n"));
return -1;
}
if (tdb->transaction->transaction_error) {
tdb->ecode = TDB_ERR_IO;
tdb_transaction_cancel_internal(tdb);
_tdb_transaction_cancel(tdb);
TDB_LOG((tdb, TDB_DEBUG_ERROR, "tdb_transaction_prepare_commit: transaction error pending\n"));
return -1;
}
......@@ -931,7 +931,7 @@ static int tdb_transaction_prepare_commit_internal(struct tdb_context *tdb)
if (tdb->num_locks || tdb->global_lock.count) {
tdb->ecode = TDB_ERR_LOCK;
TDB_LOG((tdb, TDB_DEBUG_ERROR, "tdb_transaction_prepare_commit: locks pending on commit\n"));
tdb_transaction_cancel_internal(tdb);
_tdb_transaction_cancel(tdb);
return -1;
}
......@@ -939,7 +939,7 @@ static int tdb_transaction_prepare_commit_internal(struct tdb_context *tdb)
if (tdb_brlock_upgrade(tdb, FREELIST_TOP, 0) == -1) {
TDB_LOG((tdb, TDB_DEBUG_ERROR, "tdb_transaction_prepare_commit: failed to upgrade hash locks\n"));
tdb->ecode = TDB_ERR_LOCK;
tdb_transaction_cancel_internal(tdb);
_tdb_transaction_cancel(tdb);
return -1;
}
......@@ -948,7 +948,7 @@ static int tdb_transaction_prepare_commit_internal(struct tdb_context *tdb)
if (tdb_brlock(tdb, GLOBAL_LOCK, F_WRLCK, F_SETLKW, 0, 1) == -1) {
TDB_LOG((tdb, TDB_DEBUG_ERROR, "tdb_transaction_prepare_commit: failed to get global lock\n"));
tdb->ecode = TDB_ERR_LOCK;
tdb_transaction_cancel_internal(tdb);
_tdb_transaction_cancel(tdb);
return -1;
}
......@@ -957,7 +957,7 @@ static int tdb_transaction_prepare_commit_internal(struct tdb_context *tdb)
if (transaction_setup_recovery(tdb, &tdb->transaction->magic_offset) == -1) {
TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_transaction_prepare_commit: failed to setup recovery data\n"));
tdb_brlock(tdb, GLOBAL_LOCK, F_UNLCK, F_SETLKW, 0, 1);
tdb_transaction_cancel_internal(tdb);
_tdb_transaction_cancel(tdb);
return -1;
}
}
......@@ -972,7 +972,7 @@ static int tdb_transaction_prepare_commit_internal(struct tdb_context *tdb)
tdb->ecode = TDB_ERR_IO;
TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_transaction_prepare_commit: expansion failed\n"));
tdb_brlock(tdb, GLOBAL_LOCK, F_UNLCK, F_SETLKW, 0, 1);
tdb_transaction_cancel_internal(tdb);
_tdb_transaction_cancel(tdb);
return -1;
}
tdb->map_size = tdb->transaction->old_map_size;
......@@ -990,7 +990,7 @@ static int tdb_transaction_prepare_commit_internal(struct tdb_context *tdb)
int tdb_transaction_prepare_commit(struct tdb_context *tdb)
{
tdb_trace(tdb, "tdb_transaction_prepare_commit");
return tdb_transaction_prepare_commit_internal(tdb);
return _tdb_transaction_prepare_commit(tdb);
}
/*
......@@ -1030,12 +1030,12 @@ int tdb_transaction_commit(struct tdb_context *tdb)
/* check for a null transaction */
if (tdb->transaction->blocks == NULL) {
tdb_transaction_cancel_internal(tdb);
_tdb_transaction_cancel(tdb);
return 0;
}
if (!tdb->transaction->prepared) {
int ret = tdb_transaction_prepare_commit_internal(tdb);
int ret = _tdb_transaction_prepare_commit(tdb);
if (ret)
return ret;
}
......@@ -1066,7 +1066,7 @@ int tdb_transaction_commit(struct tdb_context *tdb)
tdb->methods = methods;
tdb_transaction_recover(tdb);
tdb_transaction_cancel_internal(tdb);
_tdb_transaction_cancel(tdb);
tdb_brlock(tdb, GLOBAL_LOCK, F_UNLCK, F_SETLKW, 0, 1);
TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_transaction_commit: write failed\n"));
......@@ -1104,7 +1104,7 @@ int tdb_transaction_commit(struct tdb_context *tdb)
/* use a transaction cancel to free memory and remove the
transaction locks */
tdb_transaction_cancel_internal(tdb);
_tdb_transaction_cancel(tdb);
if (need_repack) {
return tdb_repack(tdb);
......
......@@ -140,9 +140,9 @@ static tdb_off_t tdb_next_lock(struct tdb_context *tdb, struct tdb_traverse_lock
if fn is NULL then it is not called
a non-zero return value from fn() indicates that the traversal should stop
*/
static int tdb_traverse_internal(struct tdb_context *tdb,
tdb_traverse_func fn, void *private_data,
struct tdb_traverse_lock *tl)
static int _tdb_traverse(struct tdb_context *tdb,
tdb_traverse_func fn, void *private_data,
struct tdb_traverse_lock *tl)
{
TDB_DATA key, dbuf;
struct list_struct rec;
......@@ -226,7 +226,7 @@ int tdb_traverse_read(struct tdb_context *tdb,
tdb->traverse_read++;
tdb_trace(tdb, "tdb_traverse_read_start");
ret = tdb_traverse_internal(tdb, fn, private_data, &tl);
ret = _tdb_traverse(tdb, fn, private_data, &tl);
tdb->traverse_read--;
tdb_transaction_unlock(tdb);
......@@ -257,7 +257,7 @@ int tdb_traverse(struct tdb_context *tdb,
tdb->traverse_write++;
tdb_trace(tdb, "tdb_traverse_start");
ret = tdb_traverse_internal(tdb, fn, private_data, &tl);
ret = _tdb_traverse(tdb, fn, private_data, &tl);
tdb->traverse_write--;
tdb_transaction_unlock(tdb);
......
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