]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
param: Add API to load registry without share info
authorVinit Agnihotri <vagnihot@redhat.com>
Tue, 3 Dec 2024 05:42:34 +0000 (11:12 +0530)
committerJule Anger <janger@samba.org>
Tue, 21 Jan 2025 07:38:18 +0000 (07:38 +0000)
As number of shares increases loading entire registry configuration along with
share information becomes very costly operation.
Since we may not require share information all time, we can optimise
this by using API just loading configuration without any share info.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15780

Signed-off-by: Vinit Agnihotri <vagnihot@redhat.com>
Reviewed-by: John Mulligan <jmulligan@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
(cherry picked from commit 2927dba0434b960e4c381329bdc9fe474fb930ce)

source3/param/loadparm.c
source3/param/loadparm.h

index 797baa66309f22354c7b4fe98b2b15f5fb3ad797..f1a509f87b5899cbda5696a64a45bbc8a5e7053d 100644 (file)
@@ -4250,6 +4250,17 @@ bool lp_load_with_registry_shares(const char *pszFname)
                          true); /* load_all_shares*/
 }
 
+bool lp_load_with_registry_without_shares(const char *pszFname)
+{
+       return lp_load_ex(pszFname,
+                         false, /* global_only */
+                         true,  /* save_defaults */
+                         false, /* add_ipc */
+                         true, /* reinit_globals */
+                         true,  /* allow_include_registry */
+                         false); /* load_all_shares*/
+}
+
 /***************************************************************************
  Return the max number of services.
 ***************************************************************************/
index 78162911953d129054e36a09e9ebb7d3cd9658be..5aaf8d9ead747827f3ad3f2c11c13d664fbbe694 100644 (file)
@@ -155,6 +155,7 @@ bool lp_load_global_no_reinit(const char *file_name);
 bool lp_load_no_reinit(const char *file_name);
 bool lp_load_client_no_reinit(const char *file_name);
 bool lp_load_with_registry_shares(const char *pszFname);
+bool lp_load_with_registry_without_shares(const char *pszFname);
 int lp_numservices(void);
 void lp_dump(FILE *f, bool show_defaults, int maxtoprint);
 void lp_dump_one(FILE * f, bool show_defaults, int snum);