From 7621b4c3d80f411aac6e40ea5cce787cec108af5 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Tue, 18 Mar 2008 23:29:11 +0100 Subject: libsmbconf: change smbconf_get_seqnum() to smbconf_changed(). The former seqnum is hidden inside a struct smbconf_csn. And the get_seqnum is united with a changed function that stores the seqnum inside the given csn. Michael (This used to be commit 5b6b90900a1a3eab24cb5612d78f9678a363cf73) --- source3/lib/smbconf/smbconf.c | 38 ++++++++++++++++++++++++++++++-------- 1 file changed, 30 insertions(+), 8 deletions(-) (limited to 'source3/lib/smbconf/smbconf.c') diff --git a/source3/lib/smbconf/smbconf.c b/source3/lib/smbconf/smbconf.c index dc45a16c48..454056167e 100644 --- a/source3/lib/smbconf/smbconf.c +++ b/source3/lib/smbconf/smbconf.c @@ -417,6 +417,20 @@ static int smbconf_destroy_ctx(struct smbconf_ctx *ctx) return regdb_close(); } +/** + * Get the change sequence number of the given service/parameter. + * service and parameter strings may be NULL. + */ +static void smbconf_reg_get_csn(struct smbconf_ctx *ctx, + struct smbconf_csn *csn, + const char *service, const char *param) +{ + if (csn == NULL) { + return; + } + csn->csn = (uint64_t)regdb_get_seqnum(); +} + /********************************************************************** * * The actual net conf api functions, that are exported. @@ -475,16 +489,24 @@ void smbconf_close(struct smbconf_ctx *ctx) } /** - * Get the change sequence number of the given service/parameter. - * - * NOTE: Currently, for registry configuration, this is independent - * of the service and parameter, it returns the registry-sequence - * number. + * Detect changes in the configuration. + * The given csn struct is filled with the current csn. + * smbconf_changed() can also be used for initial retrieval + * of the csn. */ -uint64_t smbconf_get_seqnum(struct smbconf_ctx *ctx, - const char *service, const char *param) +bool smbconf_changed(struct smbconf_ctx *ctx, struct smbconf_csn *csn, + const char *service, const char *param) { - return (uint64_t)regdb_get_seqnum(); + struct smbconf_csn old_csn; + + if (csn == NULL) { + return false; + } + + old_csn = *csn; + + smbconf_reg_get_csn(ctx, csn, service, param); + return (csn->csn != old_csn.csn); } /** -- cgit