From a53beee0343e9fccc8f5b31fba1f293bdb6763da Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 16 Feb 2008 15:40:42 +0100 Subject: Add static header for gencache. (This used to be commit 58c25657bf552a11e7c522602805ba961de94cf2) --- .gitignore | 1 - source4/lib/basic.mk | 6 +-- source4/lib/gencache/gencache.h | 94 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 95 insertions(+), 6 deletions(-) create mode 100644 source4/lib/gencache/gencache.h diff --git a/.gitignore b/.gitignore index a8c1f9a4cc..b0786b66d6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,6 @@ source/pidl/Makefile source/mkconfig.mk source/test-results -source/lib/gencache/gencache.h source/lib/ldb/bin *.pc autom4te.cache diff --git a/source4/lib/basic.mk b/source4/lib/basic.mk index 8653779044..53eb0d038f 100644 --- a/source4/lib/basic.mk +++ b/source4/lib/basic.mk @@ -18,15 +18,11 @@ include tdr/config.mk include dbwrap/config.mk include crypto/config.mk -################################################ -# Start SUBSYSTEM LIBCOMPRESSION [SUBSYSTEM::LIBCOMPRESSION] OBJ_FILES = compression/mszip.o -# End SUBSYSTEM LIBCOMPRESION -################################################ [SUBSYSTEM::GENCACHE] -PRIVATE_PROTO_HEADER = gencache/gencache.h +PUBLIC_HEADERS = gencache/gencache.h OBJ_FILES = gencache/gencache.o PRIVATE_DEPENDENCIES = TDB_WRAP diff --git a/source4/lib/gencache/gencache.h b/source4/lib/gencache/gencache.h new file mode 100644 index 0000000000..1481676fd9 --- /dev/null +++ b/source4/lib/gencache/gencache.h @@ -0,0 +1,94 @@ +#ifndef __LIB_GENCACHE_GENCACHE_H__ +#define __LIB_GENCACHE_GENCACHE_H__ + +/** + * Cache initialisation function. Opens cache tdb file or creates + * it if does not exist. + * + * @return true on successful initialisation of the cache or + * false on failure + **/ +bool gencache_init(struct loadparm_context *lp_ctx); + +/** + * Cache shutdown function. Closes opened cache tdb file. + * + * @return true on successful closing the cache or + * false on failure during cache shutdown + **/ +bool gencache_shutdown(void); + +/** + * Set an entry in the cache file. If there's no such + * one, then add it. + * + * @param keystr string that represents a key of this entry + * @param value text representation value being cached + * @param timeout time when the value is expired + * + * @retval true when entry is successfuly stored + * @retval false on failure + **/ +bool gencache_set(const char *keystr, const char *value, time_t timeout); + +/** + * Set existing entry to the cache file. + * + * @param keystr string that represents a key of this entry + * @param valstr text representation value being cached + * @param timeout time when the value is expired + * + * @retval true when entry is successfuly set + * @retval false on failure + **/ +bool gencache_set_only(const char *keystr, const char *valstr, time_t timeout); + +/** + * Delete one entry from the cache file. + * + * @param keystr string that represents a key of this entry + * + * @retval true upon successful deletion + * @retval false in case of failure + **/ +bool gencache_del(const char *keystr); + +/** + * Get existing entry from the cache file. + * + * @param keystr string that represents a key of this entry + * @param valstr buffer that is allocated and filled with the entry value + * buffer's disposing must be done outside + * @param timeout pointer to a time_t that is filled with entry's + * timeout + * + * @retval true when entry is successfuly fetched + * @retval false for failure + **/ +bool gencache_get(const char *keystr, char **valstr, time_t *timeout); + +/** + * Iterate through all entries which key matches to specified pattern + * + * @param fn pointer to the function that will be supplied with each single + * matching cache entry (key, value and timeout) as an arguments + * @param data void pointer to an arbitrary data that is passed directly to the fn + * function on each call + * @param keystr_pattern pattern the existing entries' keys are matched to + * + **/ +void gencache_iterate(void (*fn)(const char* key, const char *value, time_t timeout, void* dptr), + void* data, const char* keystr_pattern); + +/******************************************************************** + lock a key +********************************************************************/ +int gencache_lock_entry( const char *key ); + +/******************************************************************** + unlock a key +********************************************************************/ +void gencache_unlock_entry( const char *key ); + +#endif /* __LIB_GENCACHE_GENCACHE_H__ */ + -- cgit From f5e94378967a3f5059fcf1fd09eaae68ef7ccfae Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 16 Feb 2008 16:22:05 +0100 Subject: Simplify handling of plugin installation. (This used to be commit 8f1270dd5c7688f023cf24215fa229da213e760c) --- source4/Makefile | 4 ++++ source4/build/smb_build/makefile.pm | 29 ++++++++++++++++------------- 2 files changed, 20 insertions(+), 13 deletions(-) diff --git a/source4/Makefile b/source4/Makefile index a99dc825f1..e5399e4c32 100644 --- a/source4/Makefile +++ b/source4/Makefile @@ -122,6 +122,8 @@ installbin:: $(SBIN_PROGS) $(BIN_PROGS) $(TORTURE_PROGS) installdirs $(DESTDIR)$(TORTUREDIR) \ $(TORTURE_PROGS) +installplugins:: + installlib:: $(INSTALLABLE_SHARED_LIBS) $(STATIC_LIBS) installdirs @$(SHELL) $(srcdir)/script/installlib.sh $(DESTDIR)$(libdir) "$(SHLIBEXT)" $(INSTALLABLE_SHARED_LIBS) #@$(SHELL) $(srcdir)/script/installlib.sh $(DESTDIR)$(libdir) "$(STLIBEXT)" $(STATIC_LIBS) @@ -165,6 +167,8 @@ uninstallheader:: uninstallman:: @$(SHELL) $(srcdir)/script/uninstallman.sh $(DESTDIR)$(mandir) $(MANPAGES) +uninstallplugins:: + config.status: @echo "config.status does not exist. Please run ./configure." @/bin/false diff --git a/source4/build/smb_build/makefile.pm b/source4/build/smb_build/makefile.pm index 7fd31a5114..427828128a 100644 --- a/source4/build/smb_build/makefile.pm +++ b/source4/build/smb_build/makefile.pm @@ -32,8 +32,6 @@ sub new($$$) $self->{headers} = []; $self->{shared_modules} = []; $self->{plugins} = []; - $self->{install_plugins} = ""; - $self->{uninstall_plugins} = ""; $self->{pc_files} = []; $self->{proto_headers} = []; $self->{output} = ""; @@ -154,16 +152,24 @@ sub SharedModule($$) } else { push (@{$self->{shared_modules}}, "$ctx->{TARGET_SHARED_LIBRARY}"); push (@{$self->{plugins}}, "$ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME}"); - $self->{install_plugins} .= "\t\@echo Installing $ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME} as \$(DESTDIR)\$(modulesdir)/$sane_subsystem/$ctx->{LIBRARY_REALNAME}\n"; - $self->{install_plugins} .= "\t\@mkdir -p \$(DESTDIR)\$(modulesdir)/$sane_subsystem/\n"; - $self->{install_plugins} .= "\t\@cp $ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME} \$(DESTDIR)\$(modulesdir)/$sane_subsystem/$ctx->{LIBRARY_REALNAME}\n"; - $self->{uninstall_plugins} .= "\t\@echo Uninstalling \$(DESTDIR)\$(modulesdir)/$sane_subsystem/$ctx->{LIBRARY_REALNAME}\n"; - $self->{uninstall_plugins} .= "\t\@-rm \$(DESTDIR)\$(modulesdir)/$sane_subsystem/$ctx->{LIBRARY_REALNAME}\n"; + $self->output("installplugins:: $ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME}\n"); + $self->output("\t\@echo Installing $ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME} as \$(DESTDIR)\$(modulesdir)/$sane_subsystem/$ctx->{LIBRARY_REALNAME}\n"); + $self->output("\t\@mkdir -p \$(DESTDIR)\$(modulesdir)/$sane_subsystem/\n"); + $self->output("\t\@cp $ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME} \$(DESTDIR)\$(modulesdir)/$sane_subsystem/$ctx->{LIBRARY_REALNAME}\n"); if (defined($ctx->{ALIASES})) { foreach (@{$ctx->{ALIASES}}) { - $self->{install_plugins} .= "\t\@rm -f \$(DESTDIR)\$(modulesdir)/$sane_subsystem/$_.\$(SHLIBEXT)\n"; - $self->{install_plugins} .= "\t\@ln -fs $ctx->{LIBRARY_REALNAME} \$(DESTDIR)\$(modulesdir)/$sane_subsystem/$_.\$(SHLIBEXT)\n"; - $self->{uninstall_plugins} .= "\t\@-rm \$(DESTDIR)\$(modulesdir)/$sane_subsystem/$_.\$(SHLIBEXT)\n"; + $self->output("\t\@rm -f \$(DESTDIR)\$(modulesdir)/$sane_subsystem/$_.\$(SHLIBEXT)\n"); + $self->output("\t\@ln -fs $ctx->{LIBRARY_REALNAME} \$(DESTDIR)\$(modulesdir)/$sane_subsystem/$_.\$(SHLIBEXT)\n"); + } + } + + $self->output("uninstallplugins::\n"); + $self->output("\t\@echo Uninstalling \$(DESTDIR)\$(modulesdir)/$sane_subsystem/$ctx->{LIBRARY_REALNAME}\n"); + $self->output("\t\@-rm \$(DESTDIR)\$(modulesdir)/$sane_subsystem/$ctx->{LIBRARY_REALNAME}\n"); + + if (defined($ctx->{ALIASES})) { + foreach (@{$ctx->{ALIASES}}) { + $self->output("\t\@-rm \$(DESTDIR)\$(modulesdir)/$sane_subsystem/$_.\$(SHLIBEXT)\n"); } } } @@ -438,9 +444,6 @@ sub write($$) $self->output("SHARED_MODULES = " . array2oneperline($self->{shared_modules}) . "\n"); $self->output("PLUGINS = " . array2oneperline($self->{plugins}) . "\n"); - $self->output("\ninstallplugins: \$(PLUGINS)\n".$self->{install_plugins}."\n"); - $self->output("\nuninstallplugins:\n".$self->{uninstall_plugins}."\n"); - $self->_prepare_mk_files(); $self->output($self->{mkfile}); -- cgit