From 2927dba0434b960e4c381329bdc9fe474fb930ce Mon Sep 17 00:00:00 2001 From: Vinit Agnihotri Date: Tue, 3 Dec 2024 11:12:34 +0530 Subject: [PATCH] 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 --- source3/param/loadparm.c | 11 +++++++++++ source3/param/loadparm.h | 1 + 2 files changed, 12 insertions(+) diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index 74afbcb5309..3710c8bd719 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -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. ***************************************************************************/ diff --git a/source3/param/loadparm.h b/source3/param/loadparm.h index a33f1ae9a3b..b2b23157429 100644 --- a/source3/param/loadparm.h +++ b/source3/param/loadparm.h @@ -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); -- 2.47.2