summaryrefslogtreecommitdiff
path: root/source4/lib/tdb/include/tdbutil.h
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-09-16 03:52:42 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:38:12 -0500
commit0868b7c77d42efd5f361f605bfc0d8d46841db95 (patch)
treee73b6ca6bb895ff3b9af1006ffd566e7f2ee7ea8 /source4/lib/tdb/include/tdbutil.h
parent95040e934175eb877ce6d83690fd06ce5d2b028c (diff)
downloadsamba-0868b7c77d42efd5f361f605bfc0d8d46841db95.tar.gz
samba-0868b7c77d42efd5f361f605bfc0d8d46841db95.tar.bz2
samba-0868b7c77d42efd5f361f605bfc0d8d46841db95.zip
r10253: a fairly large tdb cleanup and re-organise. Nearly all of this change
just involves splitting up the core tdb.c code into separate files on logical boundaries, but there are some minor functional changes as well: - move the 'struct tdb_context' into tdb_private.h, hiding it from users. This was done to allow the structure to change without breaking code that uses tdb. - added accessor functions tdb_fd(), tdb_name(), and tdb_log_fn() to access the elements of struct tdb_context that were used by external code but are no longer visible - simplied tdb_append() to use tdb_fetch()/tdb_store(), which is just as good due to the way tdb locks work - changed some of the types (such as tdb_off to tdb_off_t) to make syntax highlighting work better - removed the old optional spinlock code. It was a bad idea. - fixed a bug in tdb_reopen_all() that caused tdbtorture to sometimes fail or report nasty looking errors. This is the only real bug fixed in this commit. Jeremy/Jerry, you might like to pickup this change for Samba3, as that could definately affect smbd in Samba3. The aim of all of these changes is to make the tdb transactions/journaling code I am working on easier to write. I started to write it on top of the existing tdb.c code and it got very messy. Splitting up the code makes it much easier to follow. There are more cleanups we could do in tdb, such as using uint32_t instead of u32 (suggested by metze). I'll leave those for another day. (This used to be commit 4673cdd0d261614e707b72a7a348bb0e7dbb2482)
Diffstat (limited to 'source4/lib/tdb/include/tdbutil.h')
-rw-r--r--source4/lib/tdb/include/tdbutil.h27
1 files changed, 13 insertions, 14 deletions
diff --git a/source4/lib/tdb/include/tdbutil.h b/source4/lib/tdb/include/tdbutil.h
index 2f7c0ec234..02802c958d 100644
--- a/source4/lib/tdb/include/tdbutil.h
+++ b/source4/lib/tdb/include/tdbutil.h
@@ -23,7 +23,6 @@
#include "tdb.h"
-
/* single node of a list returned by tdb_search_keys */
typedef struct keys_node
{
@@ -32,20 +31,20 @@ typedef struct keys_node
} TDB_LIST_NODE;
-TDB_LIST_NODE *tdb_search_keys(TDB_CONTEXT*, const char*);
+TDB_LIST_NODE *tdb_search_keys(struct tdb_context*, const char*);
void tdb_search_list_free(TDB_LIST_NODE*);
-int32_t tdb_change_int32_atomic(TDB_CONTEXT *tdb, const char *keystr, int32_t *oldval, int32_t change_val);
-int tdb_lock_bystring(TDB_CONTEXT *tdb, const char *keyval);
-void tdb_unlock_bystring(TDB_CONTEXT *tdb, const char *keyval);
-int32_t tdb_fetch_int32(TDB_CONTEXT *tdb, const char *keystr);
-BOOL tdb_store_uint32(TDB_CONTEXT *tdb, const char *keystr, uint32_t value);
-int tdb_store_int32(TDB_CONTEXT *tdb, const char *keystr, int32_t v);
-BOOL tdb_fetch_uint32(TDB_CONTEXT *tdb, const char *keystr, uint32_t *value);
-int tdb_traverse_delete_fn(TDB_CONTEXT *the_tdb, TDB_DATA key, TDB_DATA dbuf,
+int32_t tdb_change_int32_atomic(struct tdb_context *tdb, const char *keystr, int32_t *oldval, int32_t change_val);
+int tdb_lock_bystring(struct tdb_context *tdb, const char *keyval);
+void tdb_unlock_bystring(struct tdb_context *tdb, const char *keyval);
+int32_t tdb_fetch_int32(struct tdb_context *tdb, const char *keystr);
+BOOL tdb_store_uint32(struct tdb_context *tdb, const char *keystr, uint32_t value);
+int tdb_store_int32(struct tdb_context *tdb, const char *keystr, int32_t v);
+BOOL tdb_fetch_uint32(struct tdb_context *tdb, const char *keystr, uint32_t *value);
+int tdb_traverse_delete_fn(struct tdb_context *the_tdb, TDB_DATA key, TDB_DATA dbuf,
void *state);
-int tdb_store_bystring(TDB_CONTEXT *tdb, const char *keystr, TDB_DATA data, int flags);
-TDB_DATA tdb_fetch_bystring(TDB_CONTEXT *tdb, const char *keystr);
-int tdb_unpack(TDB_CONTEXT *tdb, char *buf, int bufsize, const char *fmt, ...);
-size_t tdb_pack(TDB_CONTEXT *tdb, char *buf, int bufsize, const char *fmt, ...);
+int tdb_store_bystring(struct tdb_context *tdb, const char *keystr, TDB_DATA data, int flags);
+TDB_DATA tdb_fetch_bystring(struct tdb_context *tdb, const char *keystr);
+int tdb_unpack(struct tdb_context *tdb, char *buf, int bufsize, const char *fmt, ...);
+size_t tdb_pack(struct tdb_context *tdb, char *buf, int bufsize, const char *fmt, ...);
#endif /* __TDBUTIL_H__ */