1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

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 <obnox@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
Michael Adam 2015-07-21 15:18:01 +02:00 committed by Jeremy Allison
parent ea6d35ccdd
commit 44619ad261
5 changed files with 20 additions and 13 deletions

View File

@ -1,7 +1,7 @@
<samba:parameter name="smb2 max credits"
type="integer"
context="G"
generated_function="0"
handler="handle_smb2_max_credits"
xmlns:samba="http://www.samba.org/samba/DTD/samba-doc">
<description>
<para>This option controls the maximum number of outstanding simultaneous SMB2 operations

View File

@ -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.
***************************************************************************/

View File

@ -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);

View File

@ -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,
},
{

View File

@ -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;