param: turn 'smb2 max credits' into generated option
authorMichael Adam <obnox@samba.org>
Tue, 21 Jul 2015 13:18:01 +0000 (15:18 +0200)
committerJeremy Allison <jra@samba.org>
Thu, 30 Jul 2015 23:55:30 +0000 (01:55 +0200)
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>
docs-xml/smbdotconf/protocol/smb2maxcredits.xml
lib/param/loadparm.c
lib/param/loadparm.h
lib/param/param_table.c
source3/param/loadparm.c

index 572e9612f8be2c2c5fcb14645f5fdba7de837096..90bc622bf6172335685711c00082b5d0b9b13346 100644 (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
index 7c440938ca8073ea77254912a8121c8cfedfa4d4..63c908ba728d1b8d2b19ce6eb36199a64c3d1985 100644 (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.
 ***************************************************************************/
index bd170079b75aa877e7872b79f9da0c584bc01f87..cdcfdc7858dc6c4137422f69494ebf0ed3ad020b 100644 (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);
index f2a737b4539fa6f77bcd082a74e296a2924a5871..8642364f1dfbad4f07916720468a9b4b68292db0 100644 (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,
        },
        {
index 7d63d58eeb0d2591a9fb3d311b8e2116ec278670..296d426ab06cdef891d71d6a2ed6b16e26d175fa 100644 (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;