From: Eric Bollengier Date: Tue, 18 Nov 2008 10:59:12 +0000 (+0000) Subject: ebl Make SD plugins working X-Git-Tag: Release-7.0.0~3725 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=f67c43e80bdc5987e7238a8663ecb020d1fdb4dc;p=bacula%2Fbacula ebl Make SD plugins working git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@8052 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/autoconf/configure.in b/bacula/autoconf/configure.in index 2a9b5fb4bf..de0de1d711 100644 --- a/bacula/autoconf/configure.in +++ b/bacula/autoconf/configure.in @@ -2730,6 +2730,7 @@ AC_OUTPUT([autoconf/Make.common \ src/findlib/Makefile \ src/tools/Makefile \ src/plugins/fd/Makefile \ + src/plugins/sd/Makefile \ src/plugins/dir/Makefile \ po/Makefile.in \ updatedb/update_mysql_tables_10_to_11 \ diff --git a/bacula/configure b/bacula/configure index 250ae1e9ba..75533093b1 100755 --- a/bacula/configure +++ b/bacula/configure @@ -41322,7 +41322,7 @@ if test "x${subsysdir}" = "x${sbindir}" ; then exit 1 fi -ac_config_files="$ac_config_files autoconf/Make.common Makefile manpages/Makefile scripts/startmysql scripts/stopmysql scripts/btraceback scripts/startit scripts/stopit scripts/bconsole scripts/gconsole scripts/bacula scripts/bacula-ctl-dir scripts/bacula-ctl-fd scripts/bacula-ctl-sd scripts/devel_bacula scripts/Makefile scripts/logrotate scripts/bacula.desktop.gnome1 scripts/bacula.desktop.gnome2 scripts/bacula.desktop.gnome1.consolehelper scripts/bacula.desktop.gnome2.consolehelper scripts/bacula.desktop.gnome1.xsu scripts/bacula.desktop.gnome2.xsu scripts/bgnome-console.console_apps scripts/mtx-changer scripts/disk-changer scripts/dvd-handler scripts/dvd-simulator scripts/bacula-tray-monitor.desktop scripts/logwatch/Makefile scripts/logwatch/logfile.bacula.conf scripts/wxconsole.console_apps scripts/wxconsole.desktop.consolehelper scripts/wxconsole.desktop.xsu scripts/bat.desktop scripts/bat.desktop.xsu scripts/bat.desktop.consolehelper scripts/bat.console_apps src/Makefile src/host.h src/console/Makefile src/console/bconsole.conf src/gnome2-console/Makefile src/gnome2-console/bgnome-console.conf src/qt-console/bat.conf src/qt-console/bat.pro src/qt-console/bat.pro.mingw32 src/qt-console/install_conf_file src/wx-console/Makefile src/wx-console/bwx-console.conf src/tray-monitor/Makefile src/tray-monitor/tray-monitor.conf src/dird/Makefile src/dird/bacula-dir.conf src/lib/Makefile src/stored/Makefile src/stored/bacula-sd.conf src/filed/Makefile src/filed/bacula-fd.conf src/cats/Makefile src/cats/make_catalog_backup src/cats/delete_catalog_backup src/cats/create_postgresql_database src/cats/update_postgresql_tables src/cats/make_postgresql_tables src/cats/grant_postgresql_privileges src/cats/drop_postgresql_tables src/cats/drop_postgresql_database src/cats/create_mysql_database src/cats/update_mysql_tables src/cats/make_mysql_tables src/cats/grant_mysql_privileges src/cats/drop_mysql_tables src/cats/drop_mysql_database src/cats/create_sqlite_database src/cats/update_sqlite_tables src/cats/make_sqlite_tables src/cats/grant_sqlite_privileges src/cats/drop_sqlite_tables src/cats/drop_sqlite_database src/cats/create_sqlite3_database src/cats/update_sqlite3_tables src/cats/make_sqlite3_tables src/cats/grant_sqlite3_privileges src/cats/drop_sqlite3_tables src/cats/drop_sqlite3_database src/cats/sqlite src/cats/mysql src/cats/create_bdb_database src/cats/update_bdb_tables src/cats/make_bdb_tables src/cats/grant_bdb_privileges src/cats/drop_bdb_tables src/cats/drop_bdb_database src/cats/create_bacula_database src/cats/update_bacula_tables src/cats/grant_bacula_privileges src/cats/make_bacula_tables src/cats/drop_bacula_tables src/cats/drop_bacula_database src/findlib/Makefile src/tools/Makefile src/plugins/fd/Makefile po/Makefile.in updatedb/update_mysql_tables_10_to_11 updatedb/update_sqlite3_tables_10_to_11 updatedb/update_postgresql_tables_10_to_11 updatedb/update_sqlite_tables_10_to_11 $PFILES" +ac_config_files="$ac_config_files autoconf/Make.common Makefile manpages/Makefile scripts/startmysql scripts/stopmysql scripts/btraceback scripts/startit scripts/stopit scripts/bconsole scripts/gconsole scripts/bacula scripts/bacula-ctl-dir scripts/bacula-ctl-fd scripts/bacula-ctl-sd scripts/devel_bacula scripts/Makefile scripts/logrotate scripts/bacula.desktop.gnome1 scripts/bacula.desktop.gnome2 scripts/bacula.desktop.gnome1.consolehelper scripts/bacula.desktop.gnome2.consolehelper scripts/bacula.desktop.gnome1.xsu scripts/bacula.desktop.gnome2.xsu scripts/bgnome-console.console_apps scripts/mtx-changer scripts/disk-changer scripts/dvd-handler scripts/dvd-simulator scripts/bacula-tray-monitor.desktop scripts/logwatch/Makefile scripts/logwatch/logfile.bacula.conf scripts/wxconsole.console_apps scripts/wxconsole.desktop.consolehelper scripts/wxconsole.desktop.xsu scripts/bat.desktop scripts/bat.desktop.xsu scripts/bat.desktop.consolehelper scripts/bat.console_apps src/Makefile src/host.h src/console/Makefile src/console/bconsole.conf src/gnome2-console/Makefile src/gnome2-console/bgnome-console.conf src/qt-console/bat.conf src/qt-console/bat.pro src/qt-console/bat.pro.mingw32 src/qt-console/install_conf_file src/wx-console/Makefile src/wx-console/bwx-console.conf src/tray-monitor/Makefile src/tray-monitor/tray-monitor.conf src/dird/Makefile src/dird/bacula-dir.conf src/lib/Makefile src/stored/Makefile src/stored/bacula-sd.conf src/filed/Makefile src/filed/bacula-fd.conf src/cats/Makefile src/cats/make_catalog_backup src/cats/delete_catalog_backup src/cats/create_postgresql_database src/cats/update_postgresql_tables src/cats/make_postgresql_tables src/cats/grant_postgresql_privileges src/cats/drop_postgresql_tables src/cats/drop_postgresql_database src/cats/create_mysql_database src/cats/update_mysql_tables src/cats/make_mysql_tables src/cats/grant_mysql_privileges src/cats/drop_mysql_tables src/cats/drop_mysql_database src/cats/create_sqlite_database src/cats/update_sqlite_tables src/cats/make_sqlite_tables src/cats/grant_sqlite_privileges src/cats/drop_sqlite_tables src/cats/drop_sqlite_database src/cats/create_sqlite3_database src/cats/update_sqlite3_tables src/cats/make_sqlite3_tables src/cats/grant_sqlite3_privileges src/cats/drop_sqlite3_tables src/cats/drop_sqlite3_database src/cats/sqlite src/cats/mysql src/cats/create_bdb_database src/cats/update_bdb_tables src/cats/make_bdb_tables src/cats/grant_bdb_privileges src/cats/drop_bdb_tables src/cats/drop_bdb_database src/cats/create_bacula_database src/cats/update_bacula_tables src/cats/grant_bacula_privileges src/cats/make_bacula_tables src/cats/drop_bacula_tables src/cats/drop_bacula_database src/findlib/Makefile src/tools/Makefile src/plugins/fd/Makefile src/plugins/sd/Makefile src/plugins/dir/Makefile po/Makefile.in updatedb/update_mysql_tables_10_to_11 updatedb/update_sqlite3_tables_10_to_11 updatedb/update_postgresql_tables_10_to_11 updatedb/update_sqlite_tables_10_to_11 $PFILES" ac_config_commands="$ac_config_commands default" @@ -42351,6 +42351,8 @@ do "src/findlib/Makefile") CONFIG_FILES="$CONFIG_FILES src/findlib/Makefile" ;; "src/tools/Makefile") CONFIG_FILES="$CONFIG_FILES src/tools/Makefile" ;; "src/plugins/fd/Makefile") CONFIG_FILES="$CONFIG_FILES src/plugins/fd/Makefile" ;; + "src/plugins/sd/Makefile") CONFIG_FILES="$CONFIG_FILES src/plugins/sd/Makefile" ;; + "src/plugins/dir/Makefile") CONFIG_FILES="$CONFIG_FILES src/plugins/dir/Makefile" ;; "po/Makefile.in") CONFIG_FILES="$CONFIG_FILES po/Makefile.in" ;; "updatedb/update_mysql_tables_10_to_11") CONFIG_FILES="$CONFIG_FILES updatedb/update_mysql_tables_10_to_11" ;; "updatedb/update_sqlite3_tables_10_to_11") CONFIG_FILES="$CONFIG_FILES updatedb/update_sqlite3_tables_10_to_11" ;; diff --git a/bacula/src/plugins/sd/Makefile b/bacula/src/plugins/sd/Makefile deleted file mode 100644 index cc2775f043..0000000000 --- a/bacula/src/plugins/sd/Makefile +++ /dev/null @@ -1,31 +0,0 @@ -# -# Simple Makefile for building test SD plugins for Bacula -# - -# No optimization for now for easy debugging -CC = g++ -g -O0 -Wall - -SDDIR=../../stored -SRCDIR=../.. -LIBDIR=../../lib - -.SUFFIXES: .c .o -.c.o: - $(CC) -I${SRCDIR} -I${SDDIR} -DTEST_PROGRAM -c $< - -test: main example-plugin-sd.so - -sd_plugins.o: ${SDDIR}/sd_plugins.h ${SDDIR}/sd_plugins.c - $(CC) -I${SRCDIR} -I${SDDIR} -DTEST_PROGRAM -c ${SDDIR}/sd_plugins.c - -main: sd_plugins.o - $(CC) -L${LIBDIR} sd_plugins.o -o main -lbac -lpthread -lssl -l crypto -ldl - -example-plugin-sd.o: example-plugin-sd.c ${SDDIR}/sd_plugins.h - $(CC) -fPIC -I../.. -I${SDDIR} -c example-plugin-sd.c - -example-plugin-sd.so: example-plugin-sd.o - $(CC) -shared example-plugin-sd.o -o example-plugin-sd.so - -clean: - rm -f main *.so *.o 1 2 3 diff --git a/bacula/src/plugins/sd/Makefile.in b/bacula/src/plugins/sd/Makefile.in new file mode 100644 index 0000000000..3584fdeae7 --- /dev/null +++ b/bacula/src/plugins/sd/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 + +SDDIR=../../stored +SRCDIR=../.. +LIBDIR=../../lib + +.SUFFIXES: .c .o .lo + +.c.o: + $(CXX) $(DEFS) $(DEBUG) $(CPPFLAGS) -I${SRCDIR} -I${SDDIR} -DTEST_PROGRAM -c $< + +.c.lo: + $(LIBTOOL_COMPILE) $(CXX) $(DEFS) $(DEBUG) $(CPPFLAGS) -I${SRCDIR} -I${SDDIR} -DTEST_PROGRAM -c $< + +all: example-plugin-sd$(DEFAULT_SHARED_OBJECT_TYPE) + +test: main example-plugin-sd.so + +dir_plugins.o: ${SDDIR}/dir_plugins.h ${SDDIR}/dir_plugins.c + $(CXX) -I${SRCDIR} -I${SDDIR} -DTEST_PROGRAM -c ${SDDIR}/dir_plugins.c + +main: dir_plugins.o + $(CXX) $(LDFLAGS) -L${LIBDIR} dir_plugins.o -o main -lbac -lpthread -lssl -l crypto -ldl + +example-plugin-sd.o: example-plugin-sd.c ${SDDIR}/dir_plugins.h + $(CXX) $(DEFS) $(DEBUG) $(CPPFLAGS) -fPIC -I../.. -I${SDDIR} -c example-plugin-sd.c + +example-plugin-sd.so: example-plugin-sd.o + $(CXX) $(LDFLAGS) -shared example-plugin-sd.o -o example-plugin-sd.so + +example-plugin-sd.lo: example-plugin-sd.c ${SDDIR}/dir_plugins.h + $(LIBTOOL_COMPILE) $(CXX) $(DEFS) $(DEBUG) $(CFLAGS) -I../.. -I${SDDIR} -c example-plugin-sd.c + +example-plugin-sd.la: Makefile example-plugin-sd$(DEFAULT_OBJECT_TYPE) + $(LIBTOOL_LINK) $(CXX) $(LDFLAGS) -shared example-plugin-sd.lo -o $@ -rpath $(plugindir) -module -export-dynamic -avoid-version + +install: all + $(MKDIR) $(DESTDIR)$(plugindir) + $(LIBTOOL_INSTALL) $(INSTALL_PROGRAM) example-plugin-sd$(DEFAULT_SHARED_OBJECT_TYPE) $(DESTDIR)$(plugindir) + $(RMF) $(DESTDIR)$(plugindir)/example-plugin-sd.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-sd.so + +depend: diff --git a/bacula/src/plugins/sd/example-plugin-sd.c b/bacula/src/plugins/sd/example-plugin-sd.c index 9392dab93a..636fbb7c9b 100644 --- a/bacula/src/plugins/sd/example-plugin-sd.c +++ b/bacula/src/plugins/sd/example-plugin-sd.c @@ -31,8 +31,8 @@ * Kern Sibbald, October 2007 * */ -#include -#include "dir_plugins.h" +#include "bacula.h" +#include "sd_plugins.h" #ifdef __cplusplus extern "C" { diff --git a/bacula/src/stored/stored.c b/bacula/src/stored/stored.c index 700bd31c88..a14f1431cd 100644 --- a/bacula/src/stored/stored.c +++ b/bacula/src/stored/stored.c @@ -42,6 +42,12 @@ #include "bacula.h" #include "stored.h" +/* TODO: fix problem with bls, bextract + * that use findlib and already declare + * filed plugins + */ +#include "sd_plugins.h" + #ifdef HAVE_PYTHON #undef _POSIX_C_SOURCE @@ -253,6 +259,8 @@ int main (int argc, char *argv[]) create_pid_file(me->pid_directory, "bacula-sd", get_first_port_host_order(me->sdaddrs)); read_state_file(me->working_directory, "bacula-sd", get_first_port_host_order(me->sdaddrs)); + load_dir_plugins(me->plugin_directory); + drop(uid, gid); cleanup_old_files(); @@ -625,6 +633,7 @@ void terminate_stored(int sig) Dmsg1(200, "In terminate_stored() sig=%d\n", sig); + unload_plugins(); free_volume_lists(); foreach_res(device, R_DEVICE) { diff --git a/bacula/src/stored/stored.h b/bacula/src/stored/stored.h index 30353fe29e..eadd47b9b7 100644 --- a/bacula/src/stored/stored.h +++ b/bacula/src/stored/stored.h @@ -80,7 +80,6 @@ int readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result); #include "vtape.h" - /* Daemon globals from stored.c */ extern STORES *me; /* "Global" daemon resource */ extern bool forge_on; /* proceed inspite of I/O errors */ diff --git a/bacula/technotes-2.5 b/bacula/technotes-2.5 index 9201c7845a..4ba4977b46 100644 --- a/bacula/technotes-2.5 +++ b/bacula/technotes-2.5 @@ -10,6 +10,8 @@ filepattern (restore with regex in bsr) mixed priorities General: +18Nov08 +ebl Make SD plugins working. 14Nov08 ebl Apply Riccardo's patch to compile bacula+mysql on mandriva 13Nov08