From: Vinit Agnihotri Date: Tue, 3 Dec 2024 05:42:34 +0000 (+0530) Subject: param: Add API to load registry without share info X-Git-Tag: samba-4.20.7~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=91410773497916f0cfcb453faafa1fea59e09eb6;p=thirdparty%2Fsamba.git param: Add API to load registry without share info 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 Reviewed-by: John Mulligan Reviewed-by: Guenther Deschner (cherry picked from commit 2927dba0434b960e4c381329bdc9fe474fb930ce) --- diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index 797baa66309..f1a509f87b5 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -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. ***************************************************************************/ diff --git a/source3/param/loadparm.h b/source3/param/loadparm.h index 78162911953..5aaf8d9ead7 100644 --- a/source3/param/loadparm.h +++ b/source3/param/loadparm.h @@ -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);