From 8750e3f22c9b62840fd7e90eb99b95204542a592 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Wed, 24 Aug 2011 14:53:42 +0200 Subject: s3:dbwrap: move definitions of db_record and db_contect structs to dbwrap_private.h The API and callers now only need the forward declarations. --- source3/lib/dbwrap/dbwrap.h | 37 ++----------------------------------- source3/lib/dbwrap/dbwrap_ctdb.c | 1 + source3/lib/dbwrap/dbwrap_private.h | 35 +++++++++++++++++++++++++++++++++++ source3/lib/dbwrap/dbwrap_rbt.c | 1 + source3/lib/dbwrap/dbwrap_tdb.c | 1 + 5 files changed, 40 insertions(+), 35 deletions(-) diff --git a/source3/lib/dbwrap/dbwrap.h b/source3/lib/dbwrap/dbwrap.h index b5fc018158..13565f8b33 100644 --- a/source3/lib/dbwrap/dbwrap.h +++ b/source3/lib/dbwrap/dbwrap.h @@ -22,41 +22,8 @@ #include "tdb_compat.h" -struct db_record { - TDB_DATA key, value; - NTSTATUS (*store)(struct db_record *rec, TDB_DATA data, int flag); - NTSTATUS (*delete_rec)(struct db_record *rec); - void *private_data; -}; - -struct db_context { - struct db_record *(*fetch_locked)(struct db_context *db, - TALLOC_CTX *mem_ctx, - TDB_DATA key); - int (*fetch)(struct db_context *db, TALLOC_CTX *mem_ctx, - TDB_DATA key, TDB_DATA *data); - int (*traverse)(struct db_context *db, - int (*f)(struct db_record *rec, - void *private_data), - void *private_data); - int (*traverse_read)(struct db_context *db, - int (*f)(struct db_record *rec, - void *private_data), - void *private_data); - int (*get_seqnum)(struct db_context *db); - int (*get_flags)(struct db_context *db); - int (*transaction_start)(struct db_context *db); - int (*transaction_commit)(struct db_context *db); - int (*transaction_cancel)(struct db_context *db); - int (*parse_record)(struct db_context *db, TDB_DATA key, - int (*parser)(TDB_DATA key, TDB_DATA data, - void *private_data), - void *private_data); - int (*exists)(struct db_context *db,TDB_DATA key); - int (*wipe)(struct db_context *db); - void *private_data; - bool persistent; -}; +struct db_record; +struct db_context; /* The following definitions come from lib/dbwrap.c */ diff --git a/source3/lib/dbwrap/dbwrap_ctdb.c b/source3/lib/dbwrap/dbwrap_ctdb.c index 2263d73dec..5823ab4695 100644 --- a/source3/lib/dbwrap/dbwrap_ctdb.c +++ b/source3/lib/dbwrap/dbwrap_ctdb.c @@ -46,6 +46,7 @@ #include "ctdb_private.h" #include "ctdbd_conn.h" #include "dbwrap/dbwrap.h" +#include "dbwrap/dbwrap_private.h" #include "dbwrap/dbwrap_ctdb.h" #include "g_lock.h" #include "messages.h" diff --git a/source3/lib/dbwrap/dbwrap_private.h b/source3/lib/dbwrap/dbwrap_private.h index 1e221878f5..0a8581a91b 100644 --- a/source3/lib/dbwrap/dbwrap_private.h +++ b/source3/lib/dbwrap/dbwrap_private.h @@ -23,6 +23,41 @@ #ifndef __DBWRAP_PRIVATE_H__ #define __DBWRAP_PRIVATE_H__ +struct db_record { + TDB_DATA key, value; + NTSTATUS (*store)(struct db_record *rec, TDB_DATA data, int flag); + NTSTATUS (*delete_rec)(struct db_record *rec); + void *private_data; +}; + +struct db_context { + struct db_record *(*fetch_locked)(struct db_context *db, + TALLOC_CTX *mem_ctx, + TDB_DATA key); + int (*fetch)(struct db_context *db, TALLOC_CTX *mem_ctx, + TDB_DATA key, TDB_DATA *data); + int (*traverse)(struct db_context *db, + int (*f)(struct db_record *rec, + void *private_data), + void *private_data); + int (*traverse_read)(struct db_context *db, + int (*f)(struct db_record *rec, + void *private_data), + void *private_data); + int (*get_seqnum)(struct db_context *db); + int (*get_flags)(struct db_context *db); + int (*transaction_start)(struct db_context *db); + int (*transaction_commit)(struct db_context *db); + int (*transaction_cancel)(struct db_context *db); + int (*parse_record)(struct db_context *db, TDB_DATA key, + int (*parser)(TDB_DATA key, TDB_DATA data, + void *private_data), + void *private_data); + int (*exists)(struct db_context *db,TDB_DATA key); + int (*wipe)(struct db_context *db); + void *private_data; + bool persistent; +}; int dbwrap_fallback_fetch(struct db_context *db, TALLOC_CTX *mem_ctx, TDB_DATA key, TDB_DATA *data); diff --git a/source3/lib/dbwrap/dbwrap_rbt.c b/source3/lib/dbwrap/dbwrap_rbt.c index cc4e0dd129..98541eaf07 100644 --- a/source3/lib/dbwrap/dbwrap_rbt.c +++ b/source3/lib/dbwrap/dbwrap_rbt.c @@ -19,6 +19,7 @@ #include "includes.h" #include "dbwrap/dbwrap.h" +#include "dbwrap/dbwrap_private.h" #include "dbwrap/dbwrap_rbt.h" #include "../lib/util/rbtree.h" diff --git a/source3/lib/dbwrap/dbwrap_tdb.c b/source3/lib/dbwrap/dbwrap_tdb.c index b838539307..4330c961ec 100644 --- a/source3/lib/dbwrap/dbwrap_tdb.c +++ b/source3/lib/dbwrap/dbwrap_tdb.c @@ -19,6 +19,7 @@ #include "includes.h" #include "dbwrap/dbwrap.h" +#include "dbwrap/dbwrap_private.h" #include "dbwrap/dbwrap_tdb.h" #include "lib/util/tdb_wrap.h" -- cgit