From: Eric Bollengier Date: Wed, 12 Nov 2008 13:26:16 +0000 (+0000) Subject: ebl Make example plugins for dird and filed working X-Git-Tag: Release-7.0.0~3738 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=c7af0380f7af01f29d665f1e4a9a8d953153808e;p=bacula%2Fbacula ebl Make example plugins for dird and filed working git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@8039 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/src/dird/dir_plugins.h b/bacula/src/dird/dir_plugins.h index d631e98a8e..7db456bc6c 100644 --- a/bacula/src/dird/dir_plugins.h +++ b/bacula/src/dird/dir_plugins.h @@ -129,12 +129,13 @@ typedef struct s_baculaFuncs { int level, const char *msg); } bFuncs; -/* Bacula Subroutines */ +/* Bacula Core Routines -- not used within a plugin */ +#ifdef DIRECTOR_DAEMON void load_dir_plugins(const char *plugin_dir); void new_plugins(JCR *jcr); void free_plugins(JCR *jcr); void generate_plugin_event(JCR *jcr, bEventType event, void *value=NULL); - +#endif /**************************************************************************** diff --git a/bacula/src/filed/fd_plugins.h b/bacula/src/filed/fd_plugins.h index afeb7ecadd..899f6503cb 100644 --- a/bacula/src/filed/fd_plugins.h +++ b/bacula/src/filed/fd_plugins.h @@ -46,7 +46,7 @@ #define _FILE_OFFSET_BITS 64 #define _LARGEFILE_SOURCE 1 #define _LARGE_FILES 1 -#endif +#endif /* ! _BACULA_H */ #include @@ -56,7 +56,7 @@ #else #include "winconfig.h" #endif -#else +#else /* !HAVE_WIN32 */ #ifndef __CONFIG_H #include "config.h" #define __CONFIG_H diff --git a/bacula/src/plugins/dir/Makefile.in b/bacula/src/plugins/dir/Makefile.in new file mode 100644 index 0000000000..0a6fa27c08 --- /dev/null +++ b/bacula/src/plugins/dir/Makefile.in @@ -0,0 +1,64 @@ +# +# Simple Makefile for building test FD plugins for Bacula +# +# Version $Id: Makefile.in 7841 2008-10-19 10:34:03Z kerns $ +# +@MCOMMON@ + + +# No optimization for now for easy debugging + +DIRDIR=../../dird +SRCDIR=../.. +LIBDIR=../../lib + +.SUFFIXES: .c .o .lo + +.c.o: + $(CXX) $(DEFS) $(DEBUG) $(CPPFLAGS) -I${SRCDIR} -I${DIRDIR} -DTEST_PROGRAM -c $< + +.c.lo: + $(LIBTOOL_COMPILE) $(CXX) $(DEFS) $(DEBUG) $(CPPFLAGS) -I${SRCDIR} -I${DIRDIR} -DTEST_PROGRAM -c $< + +all: example-plugin-dir$(DEFAULT_SHARED_OBJECT_TYPE) + +test: main example-plugin-dir.so + +dir_plugins.o: ${DIRDIR}/dir_plugins.h ${DIRDIR}/dir_plugins.c + $(CXX) -I${SRCDIR} -I${DIRDIR} -DTEST_PROGRAM -c ${DIRDIR}/dir_plugins.c + +main: dir_plugins.o + $(CXX) $(LDFLAGS) -L${LIBDIR} dir_plugins.o -o main -lbac -lpthread -lssl -l crypto -ldl + +example-plugin-dir.o: example-plugin-dir.c ${DIRDIR}/dir_plugins.h + $(CXX) -fPIC -I../.. -I${DIRDIR} -c example-plugin-fd.c + +example-plugin-dir.so: example-plugin-dir.o + $(CXX) $(LDFLAGS) -shared example-plugin-dir.o -o example-plugin-dir.so + +example-plugin-dir.lo: example-plugin-dir.c ${DIRDIR}/dir_plugins.h + $(LIBTOOL_COMPILE) $(CXX) $(DEFS) $(DEBUG) $(CFLAGS) -I../.. -I${DIRDIR} -c example-plugin-dir.c + +example-plugin-dir.la: Makefile example-plugin-dir$(DEFAULT_OBJECT_TYPE) + $(LIBTOOL_COMPILE) $(CXX) $(DEFS) $(DEBUG) $(CFLAGS) -I../.. -I${DIRDIR} -c example-plugin-dir.c + +install: all + $(MKDIR) $(DESTDIR)$(plugindir) + $(LIBTOOL_INSTALL) $(INSTALL_PROGRAM) example-plugin-dir$(DEFAULT_SHARED_OBJECT_TYPE) $(DESTDIR)$(plugindir) + $(RMF) $(DESTDIR)$(plugindir)/example-plugin-dir.la + +libtool-clean: + find . -name '*.lo' -print | xargs $(LIBTOOL_CLEAN) $(RMF) + $(RMF) *.la + $(RMF) -r .libs _libs + +clean: @LIBTOOL_CLEAN_TARGET@ + rm -f main *.so *.o 1 2 3 + +distclean: clean + rm -f Makefile + +uninstall: + $(RMF) $(DESTDIR)$(plugindir)/example-plugin-dir.so + +depend: diff --git a/bacula/src/plugins/dir/example-plugin-dir.c b/bacula/src/plugins/dir/example-plugin-dir.c index ff1474a770..e1441933be 100644 --- a/bacula/src/plugins/dir/example-plugin-dir.c +++ b/bacula/src/plugins/dir/example-plugin-dir.c @@ -31,7 +31,7 @@ * Kern Sibbald, October 2007 * */ -#include +#include "bacula.h" #include "dir_plugins.h" #ifdef __cplusplus diff --git a/bacula/src/plugins/fd/example-plugin-fd.c b/bacula/src/plugins/fd/example-plugin-fd.c index 458537f364..52f1d83ecb 100644 --- a/bacula/src/plugins/fd/example-plugin-fd.c +++ b/bacula/src/plugins/fd/example-plugin-fd.c @@ -9,7 +9,7 @@ the code in any way. */ -#include +#include "bacula.h" #include "fd_plugins.h" #ifdef __cplusplus @@ -136,10 +136,10 @@ static bRC handlePluginEvent(bpContext *ctx, bEvent *event, void *value) printf("plugin: BackupEnd\n"); break; case bEventLevel: - printf("plugin: JobLevel=%c %d\n", (int)value, (int)value); + printf("plugin: JobLevel=%c %d\n", *(int*)value, *(int*)value); break; case bEventSince: - printf("plugin: since=%d\n", (int)value); + printf("plugin: since=%d\n", *(int*)value); break; case bEventStartRestoreJob: printf("plugin: StartRestoreJob\n");