From 59422efca9734f7e4248f9c7df8b6b823f17999b Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Wed, 26 May 2010 10:48:15 +1000 Subject: s3:smbd move messaging_context and memcache into globals.c This helps vfstest, which previously had duplicate copies of these functions. Signed-off-by: Stefan Metzmacher --- source3/smbd/globals.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'source3/smbd/globals.c') diff --git a/source3/smbd/globals.c b/source3/smbd/globals.c index 10ee5e81e2..892bc89d08 100644 --- a/source3/smbd/globals.c +++ b/source3/smbd/globals.c @@ -125,6 +125,33 @@ int num_children = 0; struct smbd_server_connection *smbd_server_conn = NULL; +struct messaging_context *smbd_messaging_context(void) +{ + if (smbd_msg_ctx == NULL) { + smbd_msg_ctx = messaging_init(talloc_autofree_context(), + procid_self(), + smbd_event_context()); + } + if (smbd_msg_ctx == NULL) { + DEBUG(0, ("Could not init smbd messaging context.\n")); + } + return smbd_msg_ctx; +} + +struct memcache *smbd_memcache(void) +{ + if (!smbd_memcache_ctx) { + smbd_memcache_ctx = memcache_init(talloc_autofree_context(), + lp_max_stat_cache_size()*1024); + } + if (!smbd_memcache_ctx) { + smb_panic("Could not init smbd memcache"); + } + + return smbd_memcache_ctx; +} + + void smbd_init_globals(void) { ZERO_STRUCT(char_flags); -- cgit