From 44619ad2611bd02419c4a81b5434ad587b2cb8a7 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Tue, 21 Jul 2015 15:18:01 +0200 Subject: [PATCH] param: turn 'smb2 max credits' into generated option This is achieved by moving the special treatment from the lp_smb2_max_credits() function in the the special handler that is called only once upon lp_load(). Signed-off-by: Michael Adam Reviewed-by: Jeremy Allison --- docs-xml/smbdotconf/protocol/smb2maxcredits.xml | 2 +- lib/param/loadparm.c | 15 +++++++++++++++ lib/param/loadparm.h | 3 +-- lib/param/param_table.c | 4 ++-- source3/param/loadparm.c | 9 +-------- 5 files changed, 20 insertions(+), 13 deletions(-) diff --git a/docs-xml/smbdotconf/protocol/smb2maxcredits.xml b/docs-xml/smbdotconf/protocol/smb2maxcredits.xml index 572e9612f8b..90bc622bf61 100644 --- a/docs-xml/smbdotconf/protocol/smb2maxcredits.xml +++ b/docs-xml/smbdotconf/protocol/smb2maxcredits.xml @@ -1,7 +1,7 @@ This option controls the maximum number of outstanding simultaneous SMB2 operations diff --git a/lib/param/loadparm.c b/lib/param/loadparm.c index 7c440938ca8..63c908ba728 100644 --- a/lib/param/loadparm.c +++ b/lib/param/loadparm.c @@ -1366,6 +1366,21 @@ bool handle_smb_ports(struct loadparm_context *lp_ctx, struct loadparm_service * return true; } +bool handle_smb2_max_credits(struct loadparm_context *lp_ctx, + struct loadparm_service *service, + const char *pszParmValue, char **ptr) +{ + int value = lp_int(pszParmValue); + + if (value <= 0) { + value = DEFAULT_SMB2_MAX_CREDITS; + } + + *(int *)ptr = value; + + return true; +} + /*************************************************************************** Initialise a copymap. ***************************************************************************/ diff --git a/lib/param/loadparm.h b/lib/param/loadparm.h index bd170079b75..cdcfdc7858d 100644 --- a/lib/param/loadparm.h +++ b/lib/param/loadparm.h @@ -253,8 +253,7 @@ enum case_handling {CASE_LOWER,CASE_UPPER}; char *szIdmapUID; \ char *szIdmapGID; \ char *szIdmapBackend; \ - int winbindMaxDomainConnections; \ - int ismb2_max_credits; + int winbindMaxDomainConnections; const char* server_role_str(uint32_t role); int lp_find_server_role(int server_role, int security, int domain_logons, int domain_master); diff --git a/lib/param/param_table.c b/lib/param/param_table.c index f2a737b4539..8642364f1df 100644 --- a/lib/param/param_table.c +++ b/lib/param/param_table.c @@ -1877,8 +1877,8 @@ struct parm_struct parm_table[] = { .label = "smb2 max credits", .type = P_INTEGER, .p_class = P_GLOBAL, - .offset = GLOBAL_VAR(ismb2_max_credits), - .special = NULL, + .offset = GLOBAL_VAR(smb2_max_credits), + .special = handle_smb2_max_credits, .enum_list = NULL, }, { diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index 7d63d58eeb0..296d426ab06 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -858,7 +858,7 @@ static void init_globals(struct loadparm_context *lp_ctx, bool reinit_globals) Globals.smb2_max_read = DEFAULT_SMB2_MAX_READ; Globals.smb2_max_write = DEFAULT_SMB2_MAX_WRITE; Globals.smb2_max_trans = DEFAULT_SMB2_MAX_TRANSACT; - Globals.ismb2_max_credits = DEFAULT_SMB2_MAX_CREDITS; + Globals.smb2_max_credits = DEFAULT_SMB2_MAX_CREDITS; Globals.smb2_leases = false; string_set(Globals.ctx, &Globals.ncalrpc_dir, get_dyn_NCALRPCDIR()); @@ -1033,13 +1033,6 @@ int lp_winbind_max_domain_connections(void) return MAX(1, lp_winbind_max_domain_connections_int()); } -int lp_smb2_max_credits(void) -{ - if (Globals.ismb2_max_credits <= 0) { - Globals.ismb2_max_credits = DEFAULT_SMB2_MAX_CREDITS; - } - return Globals.ismb2_max_credits; -} int lp_cups_encrypt(void) { int result = 0;