From: Günther Deschner Date: Wed, 18 Aug 2010 16:59:23 +0000 (+0200) Subject: s3-build: use dbwrap.h only where needed. X-Git-Tag: samba-4.0.0alpha13~737 X-Git-Url: http://git.samba.org/samba.git/?p=ira%2Fwip.git;a=commitdiff_plain;h=7a05ca2c9cd387a92e1ad699ae72caea55895c13 s3-build: use dbwrap.h only where needed. Guenther --- diff --git a/source3/groupdb/mapping_tdb.c b/source3/groupdb/mapping_tdb.c index f608e2e5144..ee090c4edef 100644 --- a/source3/groupdb/mapping_tdb.c +++ b/source3/groupdb/mapping_tdb.c @@ -22,6 +22,7 @@ #include "includes.h" #include "groupdb/mapping.h" +#include "dbwrap.h" static struct db_context *db; /* used for driver files */ diff --git a/source3/include/dbwrap.h b/source3/include/dbwrap.h index 846e1c2815a..ff7b8b6a74f 100644 --- a/source3/include/dbwrap.h +++ b/source3/include/dbwrap.h @@ -100,4 +100,42 @@ NTSTATUS dbwrap_store_bystring(struct db_context *db, const char *key, TDB_DATA dbwrap_fetch_bystring(struct db_context *db, TALLOC_CTX *mem_ctx, const char *key); +/* The following definitions come from lib/dbwrap_util.c */ + +int32_t dbwrap_fetch_int32(struct db_context *db, const char *keystr); +int dbwrap_store_int32(struct db_context *db, const char *keystr, int32_t v); +bool dbwrap_fetch_uint32(struct db_context *db, const char *keystr, + uint32_t *val); +int dbwrap_store_uint32(struct db_context *db, const char *keystr, uint32_t v); +NTSTATUS dbwrap_change_uint32_atomic(struct db_context *db, const char *keystr, + uint32_t *oldval, uint32_t change_val); +NTSTATUS dbwrap_trans_change_uint32_atomic(struct db_context *db, + const char *keystr, + uint32_t *oldval, + uint32_t change_val); +NTSTATUS dbwrap_change_int32_atomic(struct db_context *db, const char *keystr, + int32_t *oldval, int32_t change_val); +NTSTATUS dbwrap_trans_change_int32_atomic(struct db_context *db, + const char *keystr, + int32_t *oldval, + int32_t change_val); +NTSTATUS dbwrap_trans_store(struct db_context *db, TDB_DATA key, TDB_DATA dbuf, + int flag); +NTSTATUS dbwrap_trans_delete(struct db_context *db, TDB_DATA key); +NTSTATUS dbwrap_trans_store_int32(struct db_context *db, const char *keystr, + int32_t v); +NTSTATUS dbwrap_trans_store_uint32(struct db_context *db, const char *keystr, + uint32_t v); +NTSTATUS dbwrap_trans_store_bystring(struct db_context *db, const char *key, + TDB_DATA data, int flags); +NTSTATUS dbwrap_trans_delete_bystring(struct db_context *db, const char *key); +NTSTATUS dbwrap_trans_do(struct db_context *db, + NTSTATUS (*action)(struct db_context *, void *), + void *private_data); +NTSTATUS dbwrap_delete_bystring_upper(struct db_context *db, const char *key); +NTSTATUS dbwrap_store_bystring_upper(struct db_context *db, const char *key, + TDB_DATA data, int flags); +TDB_DATA dbwrap_fetch_bystring_upper(struct db_context *db, TALLOC_CTX *mem_ctx, + const char *key); + #endif /* __DBWRAP_H__ */ diff --git a/source3/include/includes.h b/source3/include/includes.h index 98ba38027e6..30ff742ffd4 100644 --- a/source3/include/includes.h +++ b/source3/include/includes.h @@ -653,7 +653,6 @@ extern void *cmdline_lp_ctx; #include "session.h" #include "module.h" -#include "dbwrap.h" #include "packet.h" #include "ctdbd_conn.h" #include "../lib/util/talloc_stack.h" diff --git a/source3/include/proto.h b/source3/include/proto.h index 87b2e275ad3..2a70051c488 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -497,44 +497,6 @@ int connections_forall_read(int (*fn)(const struct connections_key *key, void *private_data); bool connections_init(bool rw); -/* The following definitions come from lib/dbwrap_util.c */ - -int32_t dbwrap_fetch_int32(struct db_context *db, const char *keystr); -int dbwrap_store_int32(struct db_context *db, const char *keystr, int32_t v); -bool dbwrap_fetch_uint32(struct db_context *db, const char *keystr, - uint32_t *val); -int dbwrap_store_uint32(struct db_context *db, const char *keystr, uint32_t v); -NTSTATUS dbwrap_change_uint32_atomic(struct db_context *db, const char *keystr, - uint32_t *oldval, uint32_t change_val); -NTSTATUS dbwrap_trans_change_uint32_atomic(struct db_context *db, - const char *keystr, - uint32_t *oldval, - uint32_t change_val); -NTSTATUS dbwrap_change_int32_atomic(struct db_context *db, const char *keystr, - int32_t *oldval, int32_t change_val); -NTSTATUS dbwrap_trans_change_int32_atomic(struct db_context *db, - const char *keystr, - int32_t *oldval, - int32_t change_val); -NTSTATUS dbwrap_trans_store(struct db_context *db, TDB_DATA key, TDB_DATA dbuf, - int flag); -NTSTATUS dbwrap_trans_delete(struct db_context *db, TDB_DATA key); -NTSTATUS dbwrap_trans_store_int32(struct db_context *db, const char *keystr, - int32_t v); -NTSTATUS dbwrap_trans_store_uint32(struct db_context *db, const char *keystr, - uint32_t v); -NTSTATUS dbwrap_trans_store_bystring(struct db_context *db, const char *key, - TDB_DATA data, int flags); -NTSTATUS dbwrap_trans_delete_bystring(struct db_context *db, const char *key); -NTSTATUS dbwrap_trans_do(struct db_context *db, - NTSTATUS (*action)(struct db_context *, void *), - void *private_data); -NTSTATUS dbwrap_delete_bystring_upper(struct db_context *db, const char *key); -NTSTATUS dbwrap_store_bystring_upper(struct db_context *db, const char *key, - TDB_DATA data, int flags); -TDB_DATA dbwrap_fetch_bystring_upper(struct db_context *db, TALLOC_CTX *mem_ctx, - const char *key); - /* The following definitions come from lib/debug.c */ void gfree_debugsyms(void); diff --git a/source3/lib/conn_tdb.c b/source3/lib/conn_tdb.c index b95b4cd377c..75841cce657 100644 --- a/source3/lib/conn_tdb.c +++ b/source3/lib/conn_tdb.c @@ -19,6 +19,7 @@ #include "includes.h" #include "smbd/globals.h" +#include "dbwrap.h" static struct db_context *connections_db_ctx(bool rw) { diff --git a/source3/lib/dbwrap.c b/source3/lib/dbwrap.c index 8b3db8940aa..4e7346c2c4f 100644 --- a/source3/lib/dbwrap.c +++ b/source3/lib/dbwrap.c @@ -20,6 +20,7 @@ */ #include "includes.h" +#include "dbwrap.h" #ifdef CLUSTER_SUPPORT #include "ctdb_private.h" #endif diff --git a/source3/lib/dbwrap_rbt.c b/source3/lib/dbwrap_rbt.c index e9b0e4616f6..af88c79e6a4 100644 --- a/source3/lib/dbwrap_rbt.c +++ b/source3/lib/dbwrap_rbt.c @@ -18,6 +18,7 @@ */ #include "includes.h" +#include "dbwrap.h" #include "../lib/util/rbtree.h" #define DBWRAP_RBT_ALIGN(_size_) (((_size_)+15)&~15) diff --git a/source3/lib/dbwrap_tdb.c b/source3/lib/dbwrap_tdb.c index 297a351764e..4cdc1930eed 100644 --- a/source3/lib/dbwrap_tdb.c +++ b/source3/lib/dbwrap_tdb.c @@ -18,6 +18,7 @@ */ #include "includes.h" +#include "dbwrap.h" struct db_tdb_ctx { struct tdb_wrap *wtdb; diff --git a/source3/lib/dbwrap_util.c b/source3/lib/dbwrap_util.c index 74b22655e2b..8ebc4f474f6 100644 --- a/source3/lib/dbwrap_util.c +++ b/source3/lib/dbwrap_util.c @@ -20,6 +20,7 @@ */ #include "includes.h" +#include "dbwrap.h" int32_t dbwrap_fetch_int32(struct db_context *db, const char *keystr) { diff --git a/source3/lib/messages.c b/source3/lib/messages.c index ba0cd8023c4..5212c8eb4da 100644 --- a/source3/lib/messages.c +++ b/source3/lib/messages.c @@ -48,6 +48,7 @@ #include "includes.h" #include "librpc/gen_ndr/messaging.h" #include "librpc/gen_ndr/ndr_messaging.h" +#include "dbwrap.h" struct messaging_callback { struct messaging_callback *prev, *next; diff --git a/source3/lib/privileges.c b/source3/lib/privileges.c index 86f84904f37..f629d45c1d5 100644 --- a/source3/lib/privileges.c +++ b/source3/lib/privileges.c @@ -22,6 +22,7 @@ #include "includes.h" +#include "dbwrap.h" #define PRIVPREFIX "PRIV_" diff --git a/source3/lib/serverid.c b/source3/lib/serverid.c index 0fac3759e73..fefcc5df7c5 100644 --- a/source3/lib/serverid.c +++ b/source3/lib/serverid.c @@ -19,6 +19,7 @@ #include "includes.h" #include "serverid.h" +#include "dbwrap.h" struct serverid_key { pid_t pid; diff --git a/source3/lib/sessionid_tdb.c b/source3/lib/sessionid_tdb.c index 6efbafd46d5..1515728bd94 100644 --- a/source3/lib/sessionid_tdb.c +++ b/source3/lib/sessionid_tdb.c @@ -18,6 +18,7 @@ */ #include "includes.h" +#include "dbwrap.h" static struct db_context *session_db_ctx(void) { diff --git a/source3/lib/sharesec.c b/source3/lib/sharesec.c index f84c8c5f815..1b137a66db5 100644 --- a/source3/lib/sharesec.c +++ b/source3/lib/sharesec.c @@ -19,6 +19,7 @@ #include "includes.h" #include "../librpc/gen_ndr/ndr_security.h" +#include "dbwrap.h" /******************************************************************* Create the share security tdb. diff --git a/source3/lib/talloc_dict.c b/source3/lib/talloc_dict.c index 18b88d99310..94c2e5201e7 100644 --- a/source3/lib/talloc_dict.c +++ b/source3/lib/talloc_dict.c @@ -18,6 +18,7 @@ */ #include "includes.h" +#include "dbwrap.h" struct talloc_dict { struct db_context *db; diff --git a/source3/locking/brlock.c b/source3/locking/brlock.c index 6c6094cac01..408917ef2ec 100644 --- a/source3/locking/brlock.c +++ b/source3/locking/brlock.c @@ -27,6 +27,7 @@ #include "includes.h" #include "librpc/gen_ndr/messaging.h" #include "smbd/globals.h" +#include "dbwrap.h" #undef DBGC_CLASS #define DBGC_CLASS DBGC_LOCKING diff --git a/source3/locking/locking.c b/source3/locking/locking.c index 24998ab5889..89bd19a7105 100644 --- a/source3/locking/locking.c +++ b/source3/locking/locking.c @@ -38,6 +38,7 @@ #include "includes.h" #include "librpc/gen_ndr/messaging.h" #include "smbd/globals.h" +#include "dbwrap.h" #undef DBGC_CLASS #define DBGC_CLASS DBGC_LOCKING diff --git a/source3/locking/posix.c b/source3/locking/posix.c index e6acbe8bac4..3bddb630dba 100644 --- a/source3/locking/posix.c +++ b/source3/locking/posix.c @@ -22,6 +22,7 @@ */ #include "includes.h" +#include "dbwrap.h" #undef DBGC_CLASS #define DBGC_CLASS DBGC_LOCKING diff --git a/source3/modules/vfs_acl_tdb.c b/source3/modules/vfs_acl_tdb.c index 8da0d1e3ee9..f31e09332a5 100644 --- a/source3/modules/vfs_acl_tdb.c +++ b/source3/modules/vfs_acl_tdb.c @@ -24,6 +24,7 @@ #include "librpc/gen_ndr/xattr.h" #include "librpc/gen_ndr/ndr_xattr.h" #include "../lib/crypto/crypto.h" +#include "dbwrap.h" #undef DBGC_CLASS #define DBGC_CLASS DBGC_VFS diff --git a/source3/modules/vfs_xattr_tdb.c b/source3/modules/vfs_xattr_tdb.c index 28b21b6bf69..ab40af4d6e7 100644 --- a/source3/modules/vfs_xattr_tdb.c +++ b/source3/modules/vfs_xattr_tdb.c @@ -21,6 +21,7 @@ #include "librpc/gen_ndr/xattr.h" #include "librpc/gen_ndr/ndr_xattr.h" #include "../librpc/gen_ndr/ndr_netlogon.h" +#include "dbwrap.h" #undef DBGC_CLASS #define DBGC_CLASS DBGC_VFS diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index 225f6c927b7..ad27233f9a9 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -61,6 +61,7 @@ #include "../librpc/gen_ndr/svcctl.h" #include "smb_signing.h" +#include "dbwrap.h" #ifdef HAVE_SYS_SYSCTL_H #include diff --git a/source3/passdb/account_pol.c b/source3/passdb/account_pol.c index 7a3e7de1409..a66c48d3967 100644 --- a/source3/passdb/account_pol.c +++ b/source3/passdb/account_pol.c @@ -20,6 +20,7 @@ */ #include "includes.h" +#include "dbwrap.h" static struct db_context *db; /* cache all entries for 60 seconds for to save ldap-queries (cache is updated diff --git a/source3/passdb/machine_account_secrets.c b/source3/passdb/machine_account_secrets.c index c5a8faf694d..f3206d4eb8e 100644 --- a/source3/passdb/machine_account_secrets.c +++ b/source3/passdb/machine_account_secrets.c @@ -25,6 +25,7 @@ #include "includes.h" #include "../libcli/auth/libcli_auth.h" #include "secrets.h" +#include "dbwrap.h" #undef DBGC_CLASS #define DBGC_CLASS DBGC_PASSDB diff --git a/source3/passdb/machine_sid.c b/source3/passdb/machine_sid.c index 0f735c40efb..c3534f7fa71 100644 --- a/source3/passdb/machine_sid.c +++ b/source3/passdb/machine_sid.c @@ -22,6 +22,7 @@ #include "includes.h" #include "secrets.h" +#include "dbwrap.h" /* NOTE! the global_sam_sid is the SID of our local SAM. This is only equal to the domain SID when we are a DC, otherwise its our diff --git a/source3/passdb/pdb_tdb.c b/source3/passdb/pdb_tdb.c index 526633b58df..e1c2c437ff6 100644 --- a/source3/passdb/pdb_tdb.c +++ b/source3/passdb/pdb_tdb.c @@ -23,6 +23,7 @@ */ #include "includes.h" +#include "dbwrap.h" #if 0 /* when made a module use this */ diff --git a/source3/passdb/secrets.c b/source3/passdb/secrets.c index 52c8e8060fe..1bb0e25cf77 100644 --- a/source3/passdb/secrets.c +++ b/source3/passdb/secrets.c @@ -26,6 +26,7 @@ #include "../libcli/auth/libcli_auth.h" #include "librpc/gen_ndr/ndr_secrets.h" #include "secrets.h" +#include "dbwrap.h" #undef DBGC_CLASS #define DBGC_CLASS DBGC_PASSDB diff --git a/source3/registry/reg_backend_db.c b/source3/registry/reg_backend_db.c index 3fdea105b16..2d7b97d7b82 100644 --- a/source3/registry/reg_backend_db.c +++ b/source3/registry/reg_backend_db.c @@ -28,6 +28,7 @@ #include "reg_backend_db.h" #include "reg_objects.h" #include "nt_printing.h" +#include "dbwrap.h" #undef DBGC_CLASS #define DBGC_CLASS DBGC_REGISTRY diff --git a/source3/registry/reg_objects.c b/source3/registry/reg_objects.c index 04b981015e5..eb3437286a6 100644 --- a/source3/registry/reg_objects.c +++ b/source3/registry/reg_objects.c @@ -23,6 +23,7 @@ #include "includes.h" #include "registry.h" #include "reg_objects.h" +#include "dbwrap.h" #undef DBGC_CLASS #define DBGC_CLASS DBGC_REGISTRY diff --git a/source3/rpc_server/srv_srvsvc_nt.c b/source3/rpc_server/srv_srvsvc_nt.c index af15e7e13ef..ceee47d443e 100644 --- a/source3/rpc_server/srv_srvsvc_nt.c +++ b/source3/rpc_server/srv_srvsvc_nt.c @@ -27,6 +27,7 @@ #include "../librpc/gen_ndr/srv_srvsvc.h" #include "librpc/gen_ndr/messaging.h" #include "../librpc/gen_ndr/ndr_security.h" +#include "dbwrap.h" extern const struct generic_mapping file_generic_mapping; diff --git a/source3/smbd/connection.c b/source3/smbd/connection.c index 9b766d586e1..9653723e13f 100644 --- a/source3/smbd/connection.c +++ b/source3/smbd/connection.c @@ -19,6 +19,7 @@ #include "includes.h" #include "smbd/globals.h" +#include "dbwrap.h" /**************************************************************************** Delete a connection record. diff --git a/source3/smbd/notify_internal.c b/source3/smbd/notify_internal.c index c559c1f53e0..d1475d2f7a6 100644 --- a/source3/smbd/notify_internal.c +++ b/source3/smbd/notify_internal.c @@ -26,6 +26,7 @@ #include "includes.h" #include "librpc/gen_ndr/ndr_notify.h" #include "librpc/gen_ndr/messaging.h" +#include "dbwrap.h" struct notify_context { struct db_context *db_recursive; diff --git a/source3/smbd/session.c b/source3/smbd/session.c index a8bb0daa3ab..185ba800bec 100644 --- a/source3/smbd/session.c +++ b/source3/smbd/session.c @@ -28,6 +28,7 @@ #include "includes.h" #include "smbd/globals.h" +#include "dbwrap.h" /******************************************************************** called when a session is created diff --git a/source3/torture/torture.c b/source3/torture/torture.c index fdff8a7d054..bc0e573011d 100644 --- a/source3/torture/torture.c +++ b/source3/torture/torture.c @@ -27,6 +27,7 @@ #include "../librpc/gen_ndr/svcctl.h" #include "memcache.h" #include "nsswitch/winbind_client.h" +#include "dbwrap.h" extern char *optarg; extern int optind; diff --git a/source3/utils/dbwrap_tool.c b/source3/utils/dbwrap_tool.c index 6fbef5f1313..da96bd706f9 100644 --- a/source3/utils/dbwrap_tool.c +++ b/source3/utils/dbwrap_tool.c @@ -20,6 +20,7 @@ */ #include "includes.h" +#include "dbwrap.h" extern bool AllowDebugChange; diff --git a/source3/utils/dbwrap_torture.c b/source3/utils/dbwrap_torture.c index 14301618586..1fdad0eb29b 100644 --- a/source3/utils/dbwrap_torture.c +++ b/source3/utils/dbwrap_torture.c @@ -21,6 +21,7 @@ #include "includes.h" #include "popt_common.h" +#include "dbwrap.h" #if 0 #include "lib/events/events.h" diff --git a/source3/utils/net_idmap.c b/source3/utils/net_idmap.c index 8bcb79fabf0..268d5222c85 100644 --- a/source3/utils/net_idmap.c +++ b/source3/utils/net_idmap.c @@ -22,6 +22,7 @@ #include "utils/net.h" #include "secrets.h" #include "idmap.h" +#include "dbwrap.h" #define ALLOC_CHECK(mem) do { \ if (!mem) { \ diff --git a/source3/utils/net_serverid.c b/source3/utils/net_serverid.c index 87974d2460d..0561b844744 100644 --- a/source3/utils/net_serverid.c +++ b/source3/utils/net_serverid.c @@ -19,6 +19,7 @@ #include "includes.h" #include "utils/net.h" +#include "dbwrap.h" static int net_serverid_list_fn(const struct server_id *id, uint32_t msg_flags, void *priv) diff --git a/source3/utils/status.c b/source3/utils/status.c index fb23789d0ee..12595236e77 100644 --- a/source3/utils/status.c +++ b/source3/utils/status.c @@ -32,6 +32,7 @@ #include "includes.h" #include "popt_common.h" +#include "dbwrap.h" #define SMB_MAXPIDS 2048 static uid_t Ucrit_uid = 0; /* added by OH */ diff --git a/source3/winbindd/idmap_tdb.c b/source3/winbindd/idmap_tdb.c index d04541fc248..9a274fc9ff2 100644 --- a/source3/winbindd/idmap_tdb.c +++ b/source3/winbindd/idmap_tdb.c @@ -27,6 +27,7 @@ #include "winbindd.h" #include "idmap.h" #include "idmap_rw.h" +#include "dbwrap.h" #undef DBGC_CLASS #define DBGC_CLASS DBGC_IDMAP diff --git a/source3/winbindd/idmap_tdb2.c b/source3/winbindd/idmap_tdb2.c index 77ebbebc662..0613fdb596f 100644 --- a/source3/winbindd/idmap_tdb2.c +++ b/source3/winbindd/idmap_tdb2.c @@ -35,6 +35,7 @@ #include "winbindd.h" #include "idmap.h" #include "idmap_rw.h" +#include "dbwrap.h" #undef DBGC_CLASS #define DBGC_CLASS DBGC_IDMAP