]> 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)
committerGünther Deschner <gd@samba.org>
Fri, 10 Jan 2025 09:46:32 +0000 (09:46 +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>
source3/param/loadparm.c
source3/param/loadparm.h

index 74afbcb5309644ebc81dad7a5f4b6973039571bd..3710c8bd719f16408f9ce3d55699f68226e86243 100644 (file)
@@ -4298,6 +4298,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 a33f1ae9a3b815ea998a8099d91448854be74de2..b2b23157429c183b059dce91a15ea53f6109ac67 100644 (file)
@@ -165,6 +165,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);