diff options
-rw-r--r-- | source3/Makefile.in | 5 | ||||
-rw-r--r-- | source3/include/dbwrap.h | 21 | ||||
-rw-r--r-- | source3/include/util_tdb.h | 17 |
3 files changed, 41 insertions, 2 deletions
diff --git a/source3/Makefile.in b/source3/Makefile.in index d9d0ea2d48..7b664d0605 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -327,7 +327,8 @@ LIB_WITHOUT_PROTO_OBJ = $(LIBSAMBAUTIL_OBJ) \ lib/messages.o librpc/gen_ndr/ndr_messaging.o lib/messages_local.o \ lib/messages_ctdbd.o lib/packet.o lib/ctdbd_conn.o lib/talloc_stack.o \ lib/interfaces.o lib/rbtree.o lib/memcache.o \ - lib/util_transfer_file.o lib/async_req.o + lib/util_transfer_file.o lib/async_req.o \ + $(TDB_OBJ) LIB_WITH_PROTO_OBJ = $(VERSION_OBJ) lib/charcnv.o lib/debug.o lib/fault.o \ lib/interface.o lib/md4.o \ @@ -345,7 +346,7 @@ LIB_WITH_PROTO_OBJ = $(VERSION_OBJ) lib/charcnv.o lib/debug.o lib/fault.o \ lib/tallocmsg.o lib/dmallocmsg.o libsmb/smb_signing.o \ lib/md5.o lib/hmacmd5.o lib/arc4.o lib/iconv.o \ lib/pam_errors.o intl/lang_tdb.o lib/conn_tdb.o \ - lib/adt_tree.o lib/gencache.o $(TDB_OBJ) \ + lib/adt_tree.o lib/gencache.o \ lib/module.o lib/events.o lib/ldap_escape.o @CHARSET_STATIC@ \ lib/secdesc.o lib/util_seaccess.o lib/secace.o lib/secacl.o \ libads/krb5_errs.o lib/system_smbd.o lib/audit.o $(LIBNDR_OBJ) \ diff --git a/source3/include/dbwrap.h b/source3/include/dbwrap.h index 5c824750d1..095719a01d 100644 --- a/source3/include/dbwrap.h +++ b/source3/include/dbwrap.h @@ -54,6 +54,27 @@ struct db_context *db_open(TALLOC_CTX *mem_ctx, int hash_size, int tdb_flags, int open_flags, mode_t mode); +struct db_context *db_open_rbt(TALLOC_CTX *mem_ctx); + +struct db_context *db_open_tdb(TALLOC_CTX *mem_ctx, + const char *name, + int hash_size, int tdb_flags, + int open_flags, mode_t mode); + +#ifdef CLUSTER_SUPPORT +struct db_context *db_open_ctdb(TALLOC_CTX *mem_ctx, + const char *name, + int hash_size, int tdb_flags, + int open_flags, mode_t mode); +#endif + +struct db_context *db_open_file(TALLOC_CTX *mem_ctx, + struct messaging_context *msg_ctx, + const char *name, + int hash_size, int tdb_flags, + int open_flags, mode_t mode); + + NTSTATUS dbwrap_delete_bystring(struct db_context *db, const char *key); NTSTATUS dbwrap_store_bystring(struct db_context *db, const char *key, TDB_DATA data, int flags); diff --git a/source3/include/util_tdb.h b/source3/include/util_tdb.h index a970806166..81211aee08 100644 --- a/source3/include/util_tdb.h +++ b/source3/include/util_tdb.h @@ -22,6 +22,9 @@ #include "tdb.h" +#include "talloc.h" /* for tdb_wrap_open() */ +#include "nt_status.h" /* for map_nt_error_from_tdb() */ + /* single node of a list returned by tdb_search_keys */ typedef struct keys_node { @@ -62,6 +65,8 @@ bool tdb_fetch_uint32(struct tdb_context *tdb, const char *keystr, uint32 *value int tdb_traverse_delete_fn(struct tdb_context *the_tdb, TDB_DATA key, TDB_DATA dbuf, void *state); int tdb_store_bystring(struct tdb_context *tdb, const char *keystr, TDB_DATA data, int flags); +int tdb_trans_store_bystring(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_delete_bystring(struct tdb_context *tdb, const char *keystr); struct tdb_context *tdb_open_log(const char *name, int hash_size, @@ -73,9 +78,21 @@ TDB_DATA string_tdb_data(const char *string); TDB_DATA string_term_tdb_data(const char *string); int tdb_trans_store(struct tdb_context *tdb, TDB_DATA key, TDB_DATA dbuf, int flag); +int tdb_trans_delete(struct tdb_context *tdb, TDB_DATA key); bool tdb_change_uint32_atomic(TDB_CONTEXT *tdb, const char *keystr, uint32 *oldval, uint32 change_val); int tdb_chainlock_with_timeout( TDB_CONTEXT *tdb, TDB_DATA key, unsigned int timeout); +struct tdb_wrap *tdb_wrap_open(TALLOC_CTX *mem_ctx, + const char *name, int hash_size, int tdb_flags, + int open_flags, mode_t mode); +NTSTATUS map_nt_error_from_tdb(enum TDB_ERROR err); + +int tdb_validate(struct tdb_context *tdb, tdb_validate_data_func validate_fn); +int tdb_validate_open(const char *tdb_path, tdb_validate_data_func validate_fn); +int tdb_validate_and_backup(const char *tdb_path, + tdb_validate_data_func validate_fn); + + #endif /* __TDBUTIL_H__ */ |