]> git.sur5r.net Git - bacula/bacula/commitdiff
ebl Make SD plugins working
authorEric Bollengier <eric@eb.homelinux.org>
Tue, 18 Nov 2008 10:59:12 +0000 (10:59 +0000)
committerEric Bollengier <eric@eb.homelinux.org>
Tue, 18 Nov 2008 10:59:12 +0000 (10:59 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@8052 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/autoconf/configure.in
bacula/configure
bacula/src/plugins/sd/Makefile [deleted file]
bacula/src/plugins/sd/Makefile.in [new file with mode: 0644]
bacula/src/plugins/sd/example-plugin-sd.c
bacula/src/stored/stored.c
bacula/src/stored/stored.h
bacula/technotes-2.5

index 2a9b5fb4bf4b6b1b4e4a83c425592c9404176280..de0de1d711d2badf3f18996d0326b642683343c8 100644 (file)
@@ -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 \
index 250ae1e9ba11e8722f4c3d092674b71931029865..75533093b166601cbb25ac3bafd77979d9a2264a 100755 (executable)
@@ -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 (file)
index cc2775f..0000000
+++ /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 (file)
index 0000000..3584fde
--- /dev/null
@@ -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:
index 9392dab93a913aa31e312380a20a7dd5ce34170d..636fbb7c9b23d983cf76e3b5f7b21ae96e87be4f 100644 (file)
@@ -31,8 +31,8 @@
  *  Kern Sibbald, October 2007
  *
  */
-#include <stdio.h>
-#include "dir_plugins.h"
+#include "bacula.h"
+#include "sd_plugins.h"
 
 #ifdef __cplusplus
 extern "C" {
index 700bd31c88b904060a4413f7e6d44f37dc0a5a76..a14f1431cd12bbe3ef86d5c93d6326c6d6438968 100644 (file)
 #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) {
index 30353fe29e80a73188ddd1c65153971b85722f00..eadd47b9b759dbc0a5f23916ece5630704b35fa9 100644 (file)
@@ -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 */
index 9201c7845a96ea8d60bd2e56590c48fec37f3207..4ba4977b46368c77f270d48352ed68eeb8374d03 100644 (file)
@@ -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