From f3b33c863e725b60b4e3fe1930408833e6ccd64e Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Sun, 7 Jul 2002 14:41:19 +0000 Subject: [PATCH] First cut 1.23 -- kes07Jul02 git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@54 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/ChangeLog | 63 ++ bacula/Makefile.in | 5 +- bacula/autoconf/aclocal.m4 | 5 +- bacula/autoconf/configure.in | 13 +- bacula/configure | 756 +++++++++++----------- bacula/src/baconfig.h | 23 +- bacula/src/cats/Makefile.in | 13 +- bacula/src/cats/bdb_find.c | 2 +- bacula/src/cats/bdb_update.c | 2 +- bacula/src/cats/cats.h | 33 +- bacula/src/cats/create_bdb_database.in | 5 + bacula/src/cats/create_mysql_database.in | 13 +- bacula/src/cats/create_sqlite_database.in | 5 + bacula/src/cats/drop_bdb_tables.in | 13 + bacula/src/cats/make_bdb_tables.in | 6 + bacula/src/cats/make_mysql_tables.in | 39 +- bacula/src/cats/make_sqlite_tables.in | 33 +- bacula/src/cats/mysql.c | 6 +- bacula/src/cats/protos.h | 6 +- bacula/src/cats/sql_create.c | 5 +- bacula/src/cats/sql_find.c | 32 +- bacula/src/cats/sql_get.c | 5 +- bacula/src/cats/sql_update.c | 6 +- bacula/src/cats/sqlite.c | 40 +- bacula/src/console/console.c | 49 +- bacula/src/count-lines | 2 +- bacula/src/dird/autoprune.c | 2 +- bacula/src/dird/backup.c | 105 +-- bacula/src/dird/catreq.c | 8 +- bacula/src/dird/dird.c | 3 + bacula/src/dird/dird_conf.c | 30 +- bacula/src/dird/dird_conf.h | 20 +- bacula/src/dird/job.c | 11 +- bacula/src/dird/msgchan.c | 20 +- bacula/src/dird/protos.h | 9 +- bacula/src/dird/ua.h | 2 +- bacula/src/dird/ua_cmds.c | 17 +- bacula/src/dird/ua_prune.c | 69 +- bacula/src/dird/ua_run.c | 60 +- bacula/src/dird/ua_server.c | 1 - bacula/src/dird/verify.c | 163 ++++- bacula/src/filed/Makefile.in | 4 +- bacula/src/filed/backup.c | 4 + bacula/src/filed/filed.c | 2 + bacula/src/filed/job.c | 53 +- bacula/src/filed/protos.h | 1 + bacula/src/filed/restore.c | 12 +- bacula/src/filed/verify.c | 4 + bacula/src/filed/verify_vol.c | 269 ++++++++ bacula/src/findlib/find.h | 7 +- bacula/src/findlib/find_one.c | 528 ++++++++------- bacula/src/findlib/match.c | 8 + bacula/src/jcr.h | 26 +- bacula/src/lib/Makefile.in | 2 +- bacula/src/lib/bnet.c | 6 +- bacula/src/lib/bnet_pkt.c | 88 +++ bacula/src/lib/bsock.h | 34 + bacula/src/lib/message.c | 8 +- bacula/src/lib/parse_conf.c | 2 - bacula/src/stored/append.c | 18 +- bacula/src/stored/askdir.c | 28 +- bacula/src/stored/bextract.c | 14 +- bacula/src/stored/bls.c | 12 +- bacula/src/stored/bscan.c | 34 +- bacula/src/stored/bsr.h | 46 +- bacula/src/stored/btape.c | 206 +++--- bacula/src/stored/dev.c | 13 +- bacula/src/stored/dev.h | 27 +- bacula/src/stored/device.c | 4 +- bacula/src/stored/dircmd.c | 6 + bacula/src/stored/job.c | 10 +- bacula/src/stored/label.c | 22 +- bacula/src/stored/match_bsr.c | 17 + bacula/src/stored/parse_bsr.c | 49 ++ bacula/src/stored/read.c | 4 +- bacula/src/stored/stored.c | 7 +- bacula/src/stored/stored_conf.c | 220 +++---- bacula/src/version.h | 2 +- 78 files changed, 2174 insertions(+), 1323 deletions(-) create mode 100644 bacula/src/cats/create_bdb_database.in create mode 100644 bacula/src/cats/create_sqlite_database.in create mode 100644 bacula/src/cats/drop_bdb_tables.in create mode 100644 bacula/src/cats/make_bdb_tables.in create mode 100644 bacula/src/filed/verify_vol.c create mode 100644 bacula/src/lib/bnet_pkt.c diff --git a/bacula/ChangeLog b/bacula/ChangeLog index d0ab5fdec5..2257327e7b 100644 --- a/bacula/ChangeLog +++ b/bacula/ChangeLog @@ -1,3 +1,66 @@ +2002-mm-dd Release 1.23 + From kes07Jul02 +- This documents what I did while on vacation. +- A fair amount of documentation. +- Implemented Verify Volume to Catalog (needs renaming) +- Modified the database to include new MarkId field as + well as Counters. Database level is incremented from 1 to 2. +- Added first cut of managing autochangers by implementing Slot in DB. +- Fixed a good number of M_ERROR messages to be M_FATAL where appropriate. + Also converted a number of Emsg() to Jmsg() permitting better Job error + messages. +- First cut at implementing a general packet passing mechanism for bsock + to replace printf and sscanf for passing data. +- Made make_xxx_tables and drop_xxx_tables and create_xxx_database + for bdb as well as sqlite. With this each database has the + same set of scripts (with the exception that MySQL has grant_privileges). +- Modified Makefile to only install the database scripts for the + database that you are using. +- Updated the pdf script to include all the html files. +- Did quite a lot of documentation. +- Made Bacula compile correctly with DEBUG turned off. +- Implemented Pmsg() macros that permit using the debug print + routines even with DEBUG off. +- Updated job_cancelled() macro to handle JS_FatalError. +- Changed db_find_last_full_verify() to db_find_last_jobid(). This + permits working with Verify Volume to Catalog. +- Removed TRANSACTION code from incrementing NextId for SQLite. +- Implemented quick and dirty (not fully functional code) so that + console program does not die if ctl-Z is entered. +- Cleaned up backup.c a bit adding a bail_out goto to ensure proper + handling of errors with minimum code. +- Added passing Slot back and forth to Storage daemon with Volume info. +- Implemented Slot in Media record in DB. +- Implemented first cut of Counter resource in dird_conf.c. A counter + resource is part of the Pool resource. +- Implemented necessary database record. However, the resource doesn't + yet create a DB record. +- Implemented onefs (One File System) and recurse options on Include + resource. +- Implemented autopruning of Verify and Restore Jobs. +- Did a better job of calculating thread_concurrency() for Sun systems. + This permits better multi-threading allowing all the threads to run + at the same time. +- Implemented a wait_for_storage_daemon_termination(), which is used by + backup and verify volume. +- Clarified a number of UA prompts, and add feedback where certain commands + completed but printed nothing. (More work to be done here). +- Added a pile of new code to implement Verify Volume to Catalog. It is sort + of a hybrid of "restore" and "verify" in that it actually reads the tape, + then compares it to the catalog. Need Verify Volume to Client. +- Added a good number of checks for job_cancelled() this should permit + quicker and more reliable cancelling of jobs. +- Fixed one bug in restore where I used ofile instead of lname, which means + that if the lname was too long, the memory was not properly reallocated. +- Cleaned up find_one.c in findlib quite a bit. +- Link smtp static so that it works even if the libraries are messed up. +- If mail host is not found, retry with local host in smtp. +- Added slot and stream to the bootstrap record processing. +- Do offline on tape cartrige for unmount command. This can be turned off + by the user in the config file. OffLineOnUnmount in Device resource. +- Implemented AutoChanger = yes/no in Device resource. + + 2002-07-07 Release 1.22 - All the basic Restore code to handle the boostrap file is now implemented with the exception of the Console Restore command. diff --git a/bacula/Makefile.in b/bacula/Makefile.in index 4b29146442..6ea2fb2cbe 100755 --- a/bacula/Makefile.in +++ b/bacula/Makefile.in @@ -123,10 +123,13 @@ Makefiles: chmod 755 src/dird/btraceback src/filed/btraceback chmod 755 src/stored/btraceback chmod 755 src/cats/make_mysql_tables src/cats/drop_mysql_tables + chmod 755 src/cats/make_sqlite_tables src/cats/drop_sqlite_tables + chmod 755 src/cats/make_bdb_tables src/cats/drop_bdb_tables chmod 755 src/cats/make_test_tables src/cats/drop_test_tables chmod 755 src/cats/create_mysql_database + chmod 755 src/cats/create_sqlite_database + chmod 755 src/cats/create_bdb_database chmod 755 src/cats/grant_mysql_privileges - chmod 755 src/cats/make_sqlite_tables clean: @for I in ${subdirs}; \ diff --git a/bacula/autoconf/aclocal.m4 b/bacula/autoconf/aclocal.m4 index 017f8536f7..46e59b1701 100644 --- a/bacula/autoconf/aclocal.m4 +++ b/bacula/autoconf/aclocal.m4 @@ -230,7 +230,6 @@ AC_MSG_RESULT(" ") AC_DEFUN(BA_CHECK_MYSQL_DB, [ have_db=no -db_name=none AC_MSG_CHECKING(for MySQL support) AC_ARG_WITH(mysql, [ @@ -288,6 +287,7 @@ Which one DBMS do you want to use (please select only one): have_db=yes support_mysql=yes db_name=MySQL + DB_NAME=mysql else AC_MSG_RESULT(no) @@ -305,7 +305,6 @@ AC_SUBST(SQL_BINDIR) AC_DEFUN(BA_CHECK_SQLITE_DB, [ have_db=no -db_name=none AC_MSG_CHECKING(for SQLite support) AC_ARG_WITH(sqlite, [ @@ -347,6 +346,7 @@ Which one DBMS do you want to use (please select only one): have_db=yes support_sqlite=yes db_name=SQLite + DB_NAME=sqlite else AC_MSG_RESULT(no) @@ -1173,4 +1173,3 @@ AC_DEFUN([GNOME_ORBIT_HOOK],[ AC_DEFUN([GNOME_ORBIT_CHECK], [ GNOME_ORBIT_HOOK([],failure) ]) - diff --git a/bacula/autoconf/configure.in b/bacula/autoconf/configure.in index 1fd35375c5..bf84950b79 100644 --- a/bacula/autoconf/configure.in +++ b/bacula/autoconf/configure.in @@ -140,6 +140,8 @@ support_mysql=no support_sqlite=no support_smartalloc=yes cats= +db_name=Internal +DB_NAME=bdb dnl# -------------------------------------------------------------------------- dnl# CHECKING COMMAND LINE OPTIONS @@ -622,7 +624,6 @@ AC_SUBST(sd_password) -AC_SUBST(cats) # ------------------------------------------------ # Bacula check for various SQL database engines @@ -635,6 +636,8 @@ BA_CHECK_MYSQL_DB # ------------------------------------------------ BA_CHECK_SQLITE_DB +AC_SUBST(cats) +AC_SUBST(DB_NAME) AC_DEFINE(PROTOTYPES) @@ -1183,7 +1186,11 @@ AC_OUTPUT([autoconf/Make.common \ src/cats/grant_mysql_privileges \ src/cats/make_sqlite_tables \ src/cats/drop_sqlite_tables \ + src/cats/create_sqlite_database \ src/cats/sqlite \ + src/cats/create_bdb_database \ + src/cats/make_bdb_tables \ + src/cats/drop_bdb_tables \ src/findlib/Makefile \ $PFILES ], [(echo "Doing make of dependencies"; make depend;) ] @@ -1200,8 +1207,10 @@ chmod 755 src/cats/make_test_tables src/cats/drop_test_tables chmod 755 src/cats/create_mysql_database chmod 755 src/cats/grant_mysql_privileges chmod 755 src/cats/make_sqlite_tables src/cats/drop_sqlite_tables +chmod 755 src/cats/create_sqlite_database chmod 755 src/cats/sqlite - +chmod 755 src/cats/make_bdb_tables src/cats/drop_bdb_tables +chmod 755 src/cats/create_bdb_database echo " Configuration on `date`: diff --git a/bacula/configure b/bacula/configure index cc8ee3a18d..d2d0104244 100755 --- a/bacula/configure +++ b/bacula/configure @@ -2304,6 +2304,8 @@ support_mysql=no support_sqlite=no support_smartalloc=yes cats= +db_name=Internal +DB_NAME=bdb # Check whether --enable-everything or --disable-everything was given. if test "${enable_everything+set}" = set; then @@ -2384,7 +2386,7 @@ fi # Extract the first word of "gnome-config", so it can be a program name with args. set dummy gnome-config; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2388: checking for $ac_word" >&5 +echo "configure:2390: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_GNOME_CONFIG'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2421,7 +2423,7 @@ fi no_gnome_config="yes" else echo $ac_n "checking if $GNOME_CONFIG works""... $ac_c" 1>&6 -echo "configure:2425: checking if $GNOME_CONFIG works" >&5 +echo "configure:2427: checking if $GNOME_CONFIG works" >&5 if $GNOME_CONFIG --libs-only-l gnome >/dev/null 2>&1; then echo "$ac_t""yes" 1>&6 @@ -2429,7 +2431,7 @@ echo "configure:2425: checking if $GNOME_CONFIG works" >&5 # Extract the first word of "orbit-config", so it can be a program name with args. set dummy orbit-config; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2433: checking for $ac_word" >&5 +echo "configure:2435: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_ORBIT_CONFIG'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2465,7 +2467,7 @@ fi # Extract the first word of "orbit-idl", so it can be a program name with args. set dummy orbit-idl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2469: checking for $ac_word" >&5 +echo "configure:2471: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_ORBIT_IDL'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2499,7 +2501,7 @@ else fi echo $ac_n "checking for working ORBit environment""... $ac_c" 1>&6 -echo "configure:2503: checking for working ORBit environment" >&5 +echo "configure:2505: checking for working ORBit environment" >&5 if eval "test \"`echo '$''{'gnome_cv_orbit_found'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2535,7 +2537,7 @@ fi fi echo $ac_n "checking for gnorba libraries""... $ac_c" 1>&6 -echo "configure:2539: checking for gnorba libraries" >&5 +echo "configure:2541: checking for gnorba libraries" >&5 if eval "test \"`echo '$''{'gnome_cv_gnorba_found'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2599,7 +2601,7 @@ fi if test "$no_gnome_config" = "yes"; then echo $ac_n "checking for gnomeConf.sh file in $gnome_prefix""... $ac_c" 1>&6 -echo "configure:2603: checking for gnomeConf.sh file in $gnome_prefix" >&5 +echo "configure:2605: checking for gnomeConf.sh file in $gnome_prefix" >&5 if test -f $gnome_prefix/gnomeConf.sh; then echo "$ac_t""found" 1>&6 echo "loading gnome configuration from" \ @@ -2619,7 +2621,7 @@ echo "configure:2603: checking for gnomeConf.sh file in $gnome_prefix" >&5 n="" for i in $n; do echo $ac_n "checking extra library \"$i\"""... $ac_c" 1>&6 -echo "configure:2623: checking extra library \"$i\"" >&5 +echo "configure:2625: checking extra library \"$i\"" >&5 case $i in applets) @@ -2700,17 +2702,17 @@ if test "${with_readline+set}" = set; then fi ac_safe=`echo "$with_readline/readline.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $with_readline/readline.h""... $ac_c" 1>&6 -echo "configure:2704: checking for $with_readline/readline.h" >&5 +echo "configure:2706: checking for $with_readline/readline.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2714: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2716: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -2749,17 +2751,17 @@ else # check for standard readline library ac_safe=`echo "/usr/include/readline/readline.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for /usr/include/readline/readline.h""... $ac_c" 1>&6 -echo "configure:2753: checking for /usr/include/readline/readline.h" >&5 +echo "configure:2755: checking for /usr/include/readline/readline.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2763: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2765: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -2816,12 +2818,12 @@ MAKE_SHELL=/bin/sh echo $ac_n "checking whether stat file-mode macros are broken""... $ac_c" 1>&6 -echo "configure:2820: checking whether stat file-mode macros are broken" >&5 +echo "configure:2822: checking whether stat file-mode macros are broken" >&5 if eval "test \"`echo '$''{'ac_cv_header_stat_broken'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -2876,12 +2878,12 @@ for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr that defines DIR""... $ac_c" 1>&6 -echo "configure:2880: checking for $ac_hdr that defines DIR" >&5 +echo "configure:2882: checking for $ac_hdr that defines DIR" >&5 if eval "test \"`echo '$''{'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include <$ac_hdr> @@ -2889,7 +2891,7 @@ int main() { DIR *dirp = 0; ; return 0; } EOF -if { (eval echo configure:2893: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2895: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* eval "ac_cv_header_dirent_$ac_safe=yes" else @@ -2914,7 +2916,7 @@ done # Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. if test $ac_header_dirent = dirent.h; then echo $ac_n "checking for opendir in -ldir""... $ac_c" 1>&6 -echo "configure:2918: checking for opendir in -ldir" >&5 +echo "configure:2920: checking for opendir in -ldir" >&5 ac_lib_var=`echo dir'_'opendir | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2922,7 +2924,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldir $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2939: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2955,7 +2957,7 @@ fi else echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6 -echo "configure:2959: checking for opendir in -lx" >&5 +echo "configure:2961: checking for opendir in -lx" >&5 ac_lib_var=`echo x'_'opendir | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2963,7 +2965,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lx $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2980: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3000,12 +3002,12 @@ fi for ac_func in strcasecmp select setenv putenv tcgetattr setlocale lstat lchown do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3004: checking for $ac_func" >&5 +echo "configure:3006: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3034: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3058,12 +3060,12 @@ done # EXTRAOBJ="$EXTRAOBJ lib/getopt.o lib/getopt1.o"]) echo $ac_n "checking for getopt_long""... $ac_c" 1>&6 -echo "configure:3062: checking for getopt_long" >&5 +echo "configure:3064: checking for getopt_long" >&5 if eval "test \"`echo '$''{'ac_cv_func_getopt_long'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3092: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_getopt_long=yes" else @@ -3111,7 +3113,7 @@ fi echo $ac_n "checking for working strcoll""... $ac_c" 1>&6 -echo "configure:3115: checking for working strcoll" >&5 +echo "configure:3117: checking for working strcoll" >&5 if eval "test \"`echo '$''{'ac_cv_func_strcoll_works'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3119,7 +3121,7 @@ else ac_cv_func_strcoll_works=no else cat > conftest.$ac_ext < main () @@ -3129,7 +3131,7 @@ main () strcoll ("123", "456") >= 0); } EOF -if { (eval echo configure:3133: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3135: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_func_strcoll_works=yes else @@ -3157,17 +3159,17 @@ for ac_hdr in varargs.h \ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:3161: checking for $ac_hdr" >&5 +echo "configure:3163: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3171: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3173: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -3219,17 +3221,17 @@ if test "${with_gmp+set}" = set; then fi ac_safe=`echo "$with_gmp/gmp.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $with_gmp/gmp.h""... $ac_c" 1>&6 -echo "configure:3223: checking for $with_gmp/gmp.h" >&5 +echo "configure:3225: checking for $with_gmp/gmp.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3233: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3235: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -3268,17 +3270,17 @@ else # check for standard gmp library ac_safe=`echo "/usr/include/gmp.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for /usr/include/gmp.h""... $ac_c" 1>&6 -echo "configure:3272: checking for /usr/include/gmp.h" >&5 +echo "configure:3274: checking for /usr/include/gmp.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3282: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3284: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -3356,17 +3358,17 @@ if test "${with_cweb+set}" = set; then fi ac_safe=`echo "$with_cweb/cweb.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $with_cweb/cweb.h""... $ac_c" 1>&6 -echo "configure:3360: checking for $with_cweb/cweb.h" >&5 +echo "configure:3362: checking for $with_cweb/cweb.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3370: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3372: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -3405,17 +3407,17 @@ else # check for standard cweb library ac_safe=`echo "/usr/include/cweb.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for /usr/include/cweb.h""... $ac_c" 1>&6 -echo "configure:3409: checking for /usr/include/cweb.h" >&5 +echo "configure:3411: checking for /usr/include/cweb.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3419: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3421: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -3486,9 +3488,9 @@ if test "${with_tcp_wrappers+set}" = set; then saved_LIBS="$LIBS" LIBS="$LIBS -lwrap -lnsl" echo $ac_n "checking for libwrap""... $ac_c" 1>&6 -echo "configure:3490: checking for libwrap" >&5 +echo "configure:3492: checking for libwrap" >&5 cat > conftest.$ac_ext < int deny_severity = 0; @@ -3498,7 +3500,7 @@ int main() { hosts_access(req); ; return 0; } EOF -if { (eval echo configure:3502: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3504: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* echo "$ac_t""yes" 1>&6 @@ -3757,13 +3759,11 @@ fi - # ------------------------------------------------ # Bacula check for various SQL database engines # ------------------------------------------------ have_db=no -db_name=none echo $ac_n "checking for MySQL support""... $ac_c" 1>&6 echo "configure:3769: checking for MySQL support" >&5 # Check whether --with-mysql or --without-mysql was given. @@ -3822,6 +3822,7 @@ EOF have_db=yes support_mysql=yes db_name=MySQL + DB_NAME=mysql else echo "$ac_t""no" 1>&6 @@ -3845,7 +3846,6 @@ fi # ------------------------------------------------ have_db=no -db_name=none echo $ac_n "checking for SQLite support""... $ac_c" 1>&6 echo "configure:3851: checking for SQLite support" >&5 # Check whether --with-sqlite or --without-sqlite was given. @@ -3888,6 +3888,7 @@ EOF have_db=yes support_sqlite=yes db_name=SQLite + DB_NAME=sqlite else echo "$ac_t""no" 1>&6 @@ -3906,6 +3907,8 @@ fi + + cat >> confdefs.h <<\EOF #define PROTOTYPES 1 EOF @@ -3920,19 +3923,19 @@ fi echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6 -echo "configure:3924: checking for mingw32 environment" >&5 +echo "configure:3927: checking for mingw32 environment" >&5 if eval "test \"`echo '$''{'ac_cv_mingw32'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3939: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_mingw32=yes else @@ -3951,7 +3954,7 @@ test "$ac_cv_mingw32" = yes && MINGW32=yes echo $ac_n "checking for executable suffix""... $ac_c" 1>&6 -echo "configure:3955: checking for executable suffix" >&5 +echo "configure:3958: checking for executable suffix" >&5 if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3961,7 +3964,7 @@ else rm -f conftest* echo 'int main () { return 0; }' > conftest.$ac_ext ac_cv_exeext= - if { (eval echo configure:3965: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then + if { (eval echo configure:3968: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then for file in conftest.*; do case $file in *.c | *.o | *.obj) ;; @@ -3989,7 +3992,7 @@ ac_exeext=$EXEEXT # Uses ac_ vars as temps to allow command line to override cache and checks. # --without-x overrides everything else, but does not touch the cache. echo $ac_n "checking for X""... $ac_c" 1>&6 -echo "configure:3993: checking for X" >&5 +echo "configure:3996: checking for X" >&5 # Check whether --with-x or --without-x was given. if test "${with_x+set}" = set; then @@ -4051,12 +4054,12 @@ if test "$ac_x_includes" = NO; then # First, try using that file with no special directory specified. cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4060: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4063: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -4125,14 +4128,14 @@ if test "$ac_x_libraries" = NO; then ac_save_LIBS="$LIBS" LIBS="-l$x_direct_test_library $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4139: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* LIBS="$ac_save_LIBS" # We can link X programs with no special library path. @@ -4238,17 +4241,17 @@ else case "`(uname -sr) 2>/dev/null`" in "SunOS 5"*) echo $ac_n "checking whether -R must be followed by a space""... $ac_c" 1>&6 -echo "configure:4242: checking whether -R must be followed by a space" >&5 +echo "configure:4245: checking whether -R must be followed by a space" >&5 ac_xsave_LIBS="$LIBS"; LIBS="$LIBS -R$x_libraries" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4255: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_R_nospace=yes else @@ -4264,14 +4267,14 @@ rm -f conftest* else LIBS="$ac_xsave_LIBS -R $x_libraries" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4278: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_R_space=yes else @@ -4303,7 +4306,7 @@ rm -f conftest* # libraries were built with DECnet support. And karl@cs.umb.edu says # the Alpha needs dnet_stub (dnet does not exist). echo $ac_n "checking for dnet_ntoa in -ldnet""... $ac_c" 1>&6 -echo "configure:4307: checking for dnet_ntoa in -ldnet" >&5 +echo "configure:4310: checking for dnet_ntoa in -ldnet" >&5 ac_lib_var=`echo dnet'_'dnet_ntoa | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4311,7 +4314,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldnet $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4329: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4344,7 +4347,7 @@ fi if test $ac_cv_lib_dnet_dnet_ntoa = no; then echo $ac_n "checking for dnet_ntoa in -ldnet_stub""... $ac_c" 1>&6 -echo "configure:4348: checking for dnet_ntoa in -ldnet_stub" >&5 +echo "configure:4351: checking for dnet_ntoa in -ldnet_stub" >&5 ac_lib_var=`echo dnet_stub'_'dnet_ntoa | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4352,7 +4355,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldnet_stub $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4370: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4392,12 +4395,12 @@ fi # The nsl library prevents programs from opening the X display # on Irix 5.2, according to dickey@clark.net. echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6 -echo "configure:4396: checking for gethostbyname" >&5 +echo "configure:4399: checking for gethostbyname" >&5 if eval "test \"`echo '$''{'ac_cv_func_gethostbyname'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4427: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_gethostbyname=yes" else @@ -4441,7 +4444,7 @@ fi if test $ac_cv_func_gethostbyname = no; then echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6 -echo "configure:4445: checking for gethostbyname in -lnsl" >&5 +echo "configure:4448: checking for gethostbyname in -lnsl" >&5 ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4449,7 +4452,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lnsl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4467: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4490,12 +4493,12 @@ fi # -lsocket must be given before -lnsl if both are needed. # We assume that if connect needs -lnsl, so does gethostbyname. echo $ac_n "checking for connect""... $ac_c" 1>&6 -echo "configure:4494: checking for connect" >&5 +echo "configure:4497: checking for connect" >&5 if eval "test \"`echo '$''{'ac_cv_func_connect'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4525: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_connect=yes" else @@ -4539,7 +4542,7 @@ fi if test $ac_cv_func_connect = no; then echo $ac_n "checking for connect in -lsocket""... $ac_c" 1>&6 -echo "configure:4543: checking for connect in -lsocket" >&5 +echo "configure:4546: checking for connect in -lsocket" >&5 ac_lib_var=`echo socket'_'connect | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4547,7 +4550,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lsocket $X_EXTRA_LIBS $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4565: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4582,12 +4585,12 @@ fi # gomez@mi.uni-erlangen.de says -lposix is necessary on A/UX. echo $ac_n "checking for remove""... $ac_c" 1>&6 -echo "configure:4586: checking for remove" >&5 +echo "configure:4589: checking for remove" >&5 if eval "test \"`echo '$''{'ac_cv_func_remove'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4617: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_remove=yes" else @@ -4631,7 +4634,7 @@ fi if test $ac_cv_func_remove = no; then echo $ac_n "checking for remove in -lposix""... $ac_c" 1>&6 -echo "configure:4635: checking for remove in -lposix" >&5 +echo "configure:4638: checking for remove in -lposix" >&5 ac_lib_var=`echo posix'_'remove | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4639,7 +4642,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lposix $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4657: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4674,12 +4677,12 @@ fi # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay. echo $ac_n "checking for shmat""... $ac_c" 1>&6 -echo "configure:4678: checking for shmat" >&5 +echo "configure:4681: checking for shmat" >&5 if eval "test \"`echo '$''{'ac_cv_func_shmat'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4709: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_shmat=yes" else @@ -4723,7 +4726,7 @@ fi if test $ac_cv_func_shmat = no; then echo $ac_n "checking for shmat in -lipc""... $ac_c" 1>&6 -echo "configure:4727: checking for shmat in -lipc" >&5 +echo "configure:4730: checking for shmat in -lipc" >&5 ac_lib_var=`echo ipc'_'shmat | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4731,7 +4734,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lipc $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4749: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4775,7 +4778,7 @@ fi # libraries we check for below, so use a different variable. # --interran@uluru.Stanford.EDU, kb@cs.umb.edu. echo $ac_n "checking for IceConnectionNumber in -lICE""... $ac_c" 1>&6 -echo "configure:4779: checking for IceConnectionNumber in -lICE" >&5 +echo "configure:4782: checking for IceConnectionNumber in -lICE" >&5 ac_lib_var=`echo ICE'_'IceConnectionNumber | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4783,7 +4786,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lICE $X_EXTRA_LIBS $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4801: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4839,17 +4842,17 @@ for ac_hdr in \ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4843: checking for $ac_hdr" >&5 +echo "configure:4846: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4853: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4856: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -4876,12 +4879,12 @@ fi done echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:4880: checking for ANSI C header files" >&5 +echo "configure:4883: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -4889,7 +4892,7 @@ else #include EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4893: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4896: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -4906,7 +4909,7 @@ rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -4924,7 +4927,7 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -4945,7 +4948,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext < #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -4956,7 +4959,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -if { (eval echo configure:4960: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:4963: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -4980,19 +4983,19 @@ EOF fi echo $ac_n "checking whether sys/types.h defines makedev""... $ac_c" 1>&6 -echo "configure:4984: checking whether sys/types.h defines makedev" >&5 +echo "configure:4987: checking whether sys/types.h defines makedev" >&5 if eval "test \"`echo '$''{'ac_cv_header_sys_types_h_makedev'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { return makedev(0, 0); ; return 0; } EOF -if { (eval echo configure:4996: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4999: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_header_sys_types_h_makedev=yes else @@ -5010,17 +5013,17 @@ echo "$ac_t""$ac_cv_header_sys_types_h_makedev" 1>&6 if test $ac_cv_header_sys_types_h_makedev = no; then ac_safe=`echo "sys/mkdev.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for sys/mkdev.h""... $ac_c" 1>&6 -echo "configure:5014: checking for sys/mkdev.h" >&5 +echo "configure:5017: checking for sys/mkdev.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5024: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5027: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -5048,17 +5051,17 @@ fi if test $ac_cv_header_sys_mkdev_h = no; then ac_safe=`echo "sys/sysmacros.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for sys/sysmacros.h""... $ac_c" 1>&6 -echo "configure:5052: checking for sys/sysmacros.h" >&5 +echo "configure:5055: checking for sys/sysmacros.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5062: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5065: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -5090,12 +5093,12 @@ for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr that defines DIR""... $ac_c" 1>&6 -echo "configure:5094: checking for $ac_hdr that defines DIR" >&5 +echo "configure:5097: checking for $ac_hdr that defines DIR" >&5 if eval "test \"`echo '$''{'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include <$ac_hdr> @@ -5103,7 +5106,7 @@ int main() { DIR *dirp = 0; ; return 0; } EOF -if { (eval echo configure:5107: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5110: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* eval "ac_cv_header_dirent_$ac_safe=yes" else @@ -5128,7 +5131,7 @@ done # Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. if test $ac_header_dirent = dirent.h; then echo $ac_n "checking for opendir in -ldir""... $ac_c" 1>&6 -echo "configure:5132: checking for opendir in -ldir" >&5 +echo "configure:5135: checking for opendir in -ldir" >&5 ac_lib_var=`echo dir'_'opendir | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5136,7 +5139,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldir $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5154: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5169,7 +5172,7 @@ fi else echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6 -echo "configure:5173: checking for opendir in -lx" >&5 +echo "configure:5176: checking for opendir in -lx" >&5 ac_lib_var=`echo x'_'opendir | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5177,7 +5180,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lx $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5195: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5211,12 +5214,12 @@ fi fi echo $ac_n "checking whether stat file-mode macros are broken""... $ac_c" 1>&6 -echo "configure:5215: checking whether stat file-mode macros are broken" >&5 +echo "configure:5218: checking whether stat file-mode macros are broken" >&5 if eval "test \"`echo '$''{'ac_cv_header_stat_broken'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -5267,12 +5270,12 @@ EOF fi echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6 -echo "configure:5271: checking for sys/wait.h that is POSIX.1 compatible" >&5 +echo "configure:5274: checking for sys/wait.h that is POSIX.1 compatible" >&5 if eval "test \"`echo '$''{'ac_cv_header_sys_wait_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -5288,7 +5291,7 @@ wait (&s); s = WIFEXITED (s) ? WEXITSTATUS (s) : 1; ; return 0; } EOF -if { (eval echo configure:5292: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5295: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_sys_wait_h=yes else @@ -5309,12 +5312,12 @@ EOF fi echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6 -echo "configure:5313: checking whether time.h and sys/time.h may both be included" >&5 +echo "configure:5316: checking whether time.h and sys/time.h may both be included" >&5 if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -5323,7 +5326,7 @@ int main() { struct tm *tp; ; return 0; } EOF -if { (eval echo configure:5327: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5330: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_time=yes else @@ -5344,12 +5347,12 @@ EOF fi echo $ac_n "checking for st_blksize in struct stat""... $ac_c" 1>&6 -echo "configure:5348: checking for st_blksize in struct stat" >&5 +echo "configure:5351: checking for st_blksize in struct stat" >&5 if eval "test \"`echo '$''{'ac_cv_struct_st_blksize'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -5357,7 +5360,7 @@ int main() { struct stat s; s.st_blksize; ; return 0; } EOF -if { (eval echo configure:5361: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5364: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_struct_st_blksize=yes else @@ -5378,12 +5381,12 @@ EOF fi echo $ac_n "checking for st_blocks in struct stat""... $ac_c" 1>&6 -echo "configure:5382: checking for st_blocks in struct stat" >&5 +echo "configure:5385: checking for st_blocks in struct stat" >&5 if eval "test \"`echo '$''{'ac_cv_struct_st_blocks'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -5391,7 +5394,7 @@ int main() { struct stat s; s.st_blocks; ; return 0; } EOF -if { (eval echo configure:5395: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5398: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_struct_st_blocks=yes else @@ -5414,12 +5417,12 @@ else fi echo $ac_n "checking whether struct tm is in sys/time.h or time.h""... $ac_c" 1>&6 -echo "configure:5418: checking whether struct tm is in sys/time.h or time.h" >&5 +echo "configure:5421: checking whether struct tm is in sys/time.h or time.h" >&5 if eval "test \"`echo '$''{'ac_cv_struct_tm'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -5427,7 +5430,7 @@ int main() { struct tm *tp; tp->tm_sec; ; return 0; } EOF -if { (eval echo configure:5431: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5434: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_struct_tm=time.h else @@ -5448,12 +5451,12 @@ EOF fi echo $ac_n "checking for tm_zone in struct tm""... $ac_c" 1>&6 -echo "configure:5452: checking for tm_zone in struct tm" >&5 +echo "configure:5455: checking for tm_zone in struct tm" >&5 if eval "test \"`echo '$''{'ac_cv_struct_tm_zone'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include <$ac_cv_struct_tm> @@ -5461,7 +5464,7 @@ int main() { struct tm tm; tm.tm_zone; ; return 0; } EOF -if { (eval echo configure:5465: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5468: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_struct_tm_zone=yes else @@ -5481,12 +5484,12 @@ EOF else echo $ac_n "checking for tzname""... $ac_c" 1>&6 -echo "configure:5485: checking for tzname" >&5 +echo "configure:5488: checking for tzname" >&5 if eval "test \"`echo '$''{'ac_cv_var_tzname'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #ifndef tzname /* For SGI. */ @@ -5496,7 +5499,7 @@ int main() { atoi(*tzname); ; return 0; } EOF -if { (eval echo configure:5500: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5503: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_var_tzname=yes else @@ -5523,12 +5526,12 @@ fi # be POSIX, POSIX_C, ALL, HPUX or whatever, depending on the machine. echo $ac_n "checking for utime.h""... $ac_c" 1>&6 -echo "configure:5527: checking for utime.h" >&5 +echo "configure:5530: checking for utime.h" >&5 if eval "test \"`echo '$''{'tar_cv_header_utime_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -5537,7 +5540,7 @@ int main() { struct utimbuf foo ; return 0; } EOF -if { (eval echo configure:5541: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5544: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* tar_cv_header_utime_h=yes else @@ -5556,12 +5559,12 @@ EOF echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:5560: checking for working const" >&5 +echo "configure:5563: checking for working const" >&5 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5617: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes else @@ -5633,17 +5636,17 @@ fi echo $ac_n "checking how to get filesystem type""... $ac_c" 1>&6 -echo "configure:5637: checking how to get filesystem type" >&5 +echo "configure:5640: checking how to get filesystem type" >&5 fstype=no # The order of these tests is important. cat > conftest.$ac_ext < #include EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5647: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5650: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -5659,13 +5662,13 @@ fi rm -f conftest* if test $fstype = no; then cat > conftest.$ac_ext < #include EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5669: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5672: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -5682,13 +5685,13 @@ rm -f conftest* fi if test $fstype = no; then cat > conftest.$ac_ext < #include EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5692: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5695: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -5705,12 +5708,12 @@ rm -f conftest* fi if test $fstype = no; then cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5714: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5717: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -5727,7 +5730,7 @@ rm -f conftest* fi if test $fstype = no; then cat > conftest.$ac_ext < EOF @@ -5744,13 +5747,13 @@ rm -f conftest* fi if test $fstype = no; then cat > conftest.$ac_ext < #include EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5754: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5757: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -5768,12 +5771,12 @@ fi echo "$ac_t""$fstype" 1>&6 echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6 -echo "configure:5772: checking return type of signal handlers" >&5 +echo "configure:5775: checking return type of signal handlers" >&5 if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -5790,7 +5793,7 @@ int main() { int i; ; return 0; } EOF -if { (eval echo configure:5794: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5797: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_type_signal=void else @@ -5810,13 +5813,13 @@ EOF echo $ac_n "checking for type of signal functions""... $ac_c" 1>&6 -echo "configure:5814: checking for type of signal functions" >&5 +echo "configure:5817: checking for type of signal functions" >&5 if eval "test \"`echo '$''{'bash_cv_signal_vintage'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { @@ -5829,7 +5832,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:5833: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5836: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* bash_cv_signal_vintage=posix else @@ -5838,7 +5841,7 @@ else rm -rf conftest* cat > conftest.$ac_ext < int main() { @@ -5848,7 +5851,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:5852: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5855: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* bash_cv_signal_vintage=4.2bsd else @@ -5857,7 +5860,7 @@ else rm -rf conftest* cat > conftest.$ac_ext < @@ -5870,7 +5873,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:5874: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5877: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* bash_cv_signal_vintage=svr3 else @@ -5909,12 +5912,12 @@ EOF fi echo $ac_n "checking for mode_t""... $ac_c" 1>&6 -echo "configure:5913: checking for mode_t" >&5 +echo "configure:5916: checking for mode_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_mode_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -5942,12 +5945,12 @@ EOF fi echo $ac_n "checking for uid_t in sys/types.h""... $ac_c" 1>&6 -echo "configure:5946: checking for uid_t in sys/types.h" >&5 +echo "configure:5949: checking for uid_t in sys/types.h" >&5 if eval "test \"`echo '$''{'ac_cv_type_uid_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF @@ -5976,12 +5979,12 @@ EOF fi echo $ac_n "checking for size_t""... $ac_c" 1>&6 -echo "configure:5980: checking for size_t" >&5 +echo "configure:5983: checking for size_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -6009,12 +6012,12 @@ EOF fi echo $ac_n "checking for pid_t""... $ac_c" 1>&6 -echo "configure:6013: checking for pid_t" >&5 +echo "configure:6016: checking for pid_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -6042,12 +6045,12 @@ EOF fi echo $ac_n "checking for off_t""... $ac_c" 1>&6 -echo "configure:6046: checking for off_t" >&5 +echo "configure:6049: checking for off_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -6075,12 +6078,12 @@ EOF fi echo $ac_n "checking for ino_t""... $ac_c" 1>&6 -echo "configure:6079: checking for ino_t" >&5 +echo "configure:6082: checking for ino_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_ino_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -6108,12 +6111,12 @@ EOF fi echo $ac_n "checking for dev_t""... $ac_c" 1>&6 -echo "configure:6112: checking for dev_t" >&5 +echo "configure:6115: checking for dev_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_dev_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -6141,12 +6144,12 @@ EOF fi echo $ac_n "checking for daddr_t""... $ac_c" 1>&6 -echo "configure:6145: checking for daddr_t" >&5 +echo "configure:6148: checking for daddr_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_daddr_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -6174,12 +6177,12 @@ EOF fi echo $ac_n "checking for major_t""... $ac_c" 1>&6 -echo "configure:6178: checking for major_t" >&5 +echo "configure:6181: checking for major_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_major_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -6207,12 +6210,12 @@ EOF fi echo $ac_n "checking for minor_t""... $ac_c" 1>&6 -echo "configure:6211: checking for minor_t" >&5 +echo "configure:6214: checking for minor_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_minor_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -6240,12 +6243,12 @@ EOF fi echo $ac_n "checking for ssize_t""... $ac_c" 1>&6 -echo "configure:6244: checking for ssize_t" >&5 +echo "configure:6247: checking for ssize_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_ssize_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -6273,12 +6276,12 @@ EOF fi echo $ac_n "checking for st_blocks in struct stat""... $ac_c" 1>&6 -echo "configure:6277: checking for st_blocks in struct stat" >&5 +echo "configure:6280: checking for st_blocks in struct stat" >&5 if eval "test \"`echo '$''{'ac_cv_struct_st_blocks'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -6286,7 +6289,7 @@ int main() { struct stat s; s.st_blocks; ; return 0; } EOF -if { (eval echo configure:6290: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6293: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_struct_st_blocks=yes else @@ -6309,12 +6312,12 @@ else fi echo $ac_n "checking for st_rdev in struct stat""... $ac_c" 1>&6 -echo "configure:6313: checking for st_rdev in struct stat" >&5 +echo "configure:6316: checking for st_rdev in struct stat" >&5 if eval "test \"`echo '$''{'ac_cv_struct_st_rdev'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -6322,7 +6325,7 @@ int main() { struct stat s; s.st_rdev; ; return 0; } EOF -if { (eval echo configure:6326: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6329: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_struct_st_rdev=yes else @@ -6343,12 +6346,12 @@ EOF fi echo $ac_n "checking whether struct tm is in sys/time.h or time.h""... $ac_c" 1>&6 -echo "configure:6347: checking whether struct tm is in sys/time.h or time.h" >&5 +echo "configure:6350: checking whether struct tm is in sys/time.h or time.h" >&5 if eval "test \"`echo '$''{'ac_cv_struct_tm'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -6356,7 +6359,7 @@ int main() { struct tm *tp; tp->tm_sec; ; return 0; } EOF -if { (eval echo configure:6360: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6363: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_struct_tm=time.h else @@ -6377,12 +6380,12 @@ EOF fi echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:6381: checking for working const" >&5 +echo "configure:6384: checking for working const" >&5 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6438: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes else @@ -6454,7 +6457,7 @@ fi echo $ac_n "checking size of char""... $ac_c" 1>&6 -echo "configure:6458: checking size of char" >&5 +echo "configure:6461: checking size of char" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof_char'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6462,7 +6465,7 @@ else ac_cv_sizeof_char=1 else cat > conftest.$ac_ext < int main() @@ -6473,7 +6476,7 @@ int main() return(0); } EOF -if { (eval echo configure:6477: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:6480: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_char=`cat conftestval` else @@ -6493,7 +6496,7 @@ EOF echo $ac_n "checking size of short int""... $ac_c" 1>&6 -echo "configure:6497: checking size of short int" >&5 +echo "configure:6500: checking size of short int" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof_short_int'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6501,7 +6504,7 @@ else ac_cv_sizeof_short_int=2 else cat > conftest.$ac_ext < int main() @@ -6512,7 +6515,7 @@ int main() return(0); } EOF -if { (eval echo configure:6516: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:6519: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_short_int=`cat conftestval` else @@ -6532,7 +6535,7 @@ EOF echo $ac_n "checking size of int""... $ac_c" 1>&6 -echo "configure:6536: checking size of int" >&5 +echo "configure:6539: checking size of int" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof_int'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6540,7 +6543,7 @@ else ac_cv_sizeof_int=4 else cat > conftest.$ac_ext < int main() @@ -6551,7 +6554,7 @@ int main() return(0); } EOF -if { (eval echo configure:6555: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:6558: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_int=`cat conftestval` else @@ -6571,7 +6574,7 @@ EOF echo $ac_n "checking size of long int""... $ac_c" 1>&6 -echo "configure:6575: checking size of long int" >&5 +echo "configure:6578: checking size of long int" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof_long_int'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6579,7 +6582,7 @@ else ac_cv_sizeof_long_int=4 else cat > conftest.$ac_ext < int main() @@ -6590,7 +6593,7 @@ int main() return(0); } EOF -if { (eval echo configure:6594: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:6597: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_long_int=`cat conftestval` else @@ -6610,7 +6613,7 @@ EOF echo $ac_n "checking size of long long int""... $ac_c" 1>&6 -echo "configure:6614: checking size of long long int" >&5 +echo "configure:6617: checking size of long long int" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof_long_long_int'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6618,7 +6621,7 @@ else ac_cv_sizeof_long_long_int=8 else cat > conftest.$ac_ext < int main() @@ -6629,7 +6632,7 @@ int main() return(0); } EOF -if { (eval echo configure:6633: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:6636: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_long_long_int=`cat conftestval` else @@ -6649,7 +6652,7 @@ EOF echo $ac_n "checking size of int *""... $ac_c" 1>&6 -echo "configure:6653: checking size of int *" >&5 +echo "configure:6656: checking size of int *" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof_int_p'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6657,7 +6660,7 @@ else ac_cv_sizeof_int_p=4 else cat > conftest.$ac_ext < int main() @@ -6668,7 +6671,7 @@ int main() return(0); } EOF -if { (eval echo configure:6672: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:6675: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_int_p=`cat conftestval` else @@ -6690,20 +6693,20 @@ EOF # Check for sys/types.h types echo $ac_n "checking for u_int type""... $ac_c" 1>&6 -echo "configure:6694: checking for u_int type" >&5 +echo "configure:6697: checking for u_int type" >&5 if eval "test \"`echo '$''{'ac_cv_have_u_int'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { u_int a; a = 1; ; return 0; } EOF -if { (eval echo configure:6707: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6710: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_have_u_int="yes" else @@ -6727,20 +6730,20 @@ EOF fi echo $ac_n "checking for intmax_t type""... $ac_c" 1>&6 -echo "configure:6731: checking for intmax_t type" >&5 +echo "configure:6734: checking for intmax_t type" >&5 if eval "test \"`echo '$''{'ac_cv_have_intmax_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { intmax_t a; a = 1; ; return 0; } EOF -if { (eval echo configure:6744: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6747: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_have_intmax_t="yes" else @@ -6749,14 +6752,14 @@ else rm -rf conftest* cat > conftest.$ac_ext < int main() { intmax_t a; a = 1; ; return 0; } EOF -if { (eval echo configure:6760: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6763: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_have_intmax_t="yes" else @@ -6786,20 +6789,20 @@ fi echo $ac_n "checking for u_intmax_t type""... $ac_c" 1>&6 -echo "configure:6790: checking for u_intmax_t type" >&5 +echo "configure:6793: checking for u_intmax_t type" >&5 if eval "test \"`echo '$''{'ac_cv_have_u_intmax_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { u_intmax_t a; a = 1; ; return 0; } EOF -if { (eval echo configure:6803: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6806: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_have_u_intmax_t="yes" else @@ -6808,14 +6811,14 @@ else rm -rf conftest* cat > conftest.$ac_ext < int main() { u_intmax_t a; a = 1; ; return 0; } EOF -if { (eval echo configure:6819: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6822: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_have_u_intmax_t="yes" else @@ -6844,20 +6847,20 @@ fi echo $ac_n "checking for intXX_t types""... $ac_c" 1>&6 -echo "configure:6848: checking for intXX_t types" >&5 +echo "configure:6851: checking for intXX_t types" >&5 if eval "test \"`echo '$''{'ac_cv_have_intxx_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { int8_t a; int16_t b; int32_t c; a = b = c = 1; ; return 0; } EOF -if { (eval echo configure:6861: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6864: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_have_intxx_t="yes" else @@ -6881,20 +6884,20 @@ EOF fi echo $ac_n "checking for int64_t type""... $ac_c" 1>&6 -echo "configure:6885: checking for int64_t type" >&5 +echo "configure:6888: checking for int64_t type" >&5 if eval "test \"`echo '$''{'ac_cv_have_int64_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { int64_t a; a = 1; ; return 0; } EOF -if { (eval echo configure:6898: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6901: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_have_int64_t="yes" else @@ -6918,20 +6921,20 @@ EOF fi echo $ac_n "checking for u_intXX_t types""... $ac_c" 1>&6 -echo "configure:6922: checking for u_intXX_t types" >&5 +echo "configure:6925: checking for u_intXX_t types" >&5 if eval "test \"`echo '$''{'ac_cv_have_u_intxx_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1; ; return 0; } EOF -if { (eval echo configure:6935: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6938: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_have_u_intxx_t="yes" else @@ -6955,20 +6958,20 @@ EOF fi echo $ac_n "checking for u_int64_t types""... $ac_c" 1>&6 -echo "configure:6959: checking for u_int64_t types" >&5 +echo "configure:6962: checking for u_int64_t types" >&5 if eval "test \"`echo '$''{'ac_cv_have_u_int64_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { u_int64_t a; a = 1; ; return 0; } EOF -if { (eval echo configure:6972: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6975: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_have_u_int64_t="yes" else @@ -6995,9 +6998,9 @@ if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \ test "x$ac_cv_header_sys_bitypes_h" = "xyes") then echo $ac_n "checking for intXX_t and u_intXX_t types in sys/bitypes.h""... $ac_c" 1>&6 -echo "configure:6999: checking for intXX_t and u_intXX_t types in sys/bitypes.h" >&5 +echo "configure:7002: checking for intXX_t and u_intXX_t types in sys/bitypes.h" >&5 cat > conftest.$ac_ext < int main() { @@ -7006,7 +7009,7 @@ int main() { a = b = c = e = f = g = 1; ; return 0; } EOF -if { (eval echo configure:7010: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7013: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cat >> confdefs.h <<\EOF #define HAVE_U_INTXX_T 1 @@ -7033,13 +7036,13 @@ fi if test -z "$have_u_intxx_t" ; then echo $ac_n "checking for uintXX_t types""... $ac_c" 1>&6 -echo "configure:7037: checking for uintXX_t types" >&5 +echo "configure:7040: checking for uintXX_t types" >&5 if eval "test \"`echo '$''{'ac_cv_have_uintxx_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { @@ -7047,7 +7050,7 @@ int main() { uint32_t c; a = b = c = 1; ; return 0; } EOF -if { (eval echo configure:7051: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:7054: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_have_uintxx_t="yes" else @@ -7087,12 +7090,12 @@ for ac_func in \ do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:7091: checking for $ac_func" >&5 +echo "configure:7094: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7122: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -7145,12 +7148,12 @@ done for ac_func in fchdir do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:7149: checking for $ac_func" >&5 +echo "configure:7152: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7180: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -7204,12 +7207,12 @@ done for ac_func in snprintf vsnprintf do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:7208: checking for $ac_func" >&5 +echo "configure:7211: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7239: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -7260,12 +7263,12 @@ done for ac_func in localtime_r do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:7264: checking for $ac_func" >&5 +echo "configure:7267: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7295: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -7319,12 +7322,12 @@ done for ac_func in readdir_r do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:7323: checking for $ac_func" >&5 +echo "configure:7326: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7354: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -7377,12 +7380,12 @@ done # Find where sockets are (especially for Solaris) echo $ac_n "checking for socket""... $ac_c" 1>&6 -echo "configure:7381: checking for socket" >&5 +echo "configure:7384: checking for socket" >&5 if eval "test \"`echo '$''{'ac_cv_func_socket'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7412: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_socket=yes" else @@ -7423,7 +7426,7 @@ if eval "test \"`echo '$ac_cv_func_'socket`\" = yes"; then else echo "$ac_t""no" 1>&6 echo $ac_n "checking for socket in -lxnet""... $ac_c" 1>&6 -echo "configure:7427: checking for socket in -lxnet" >&5 +echo "configure:7430: checking for socket in -lxnet" >&5 ac_lib_var=`echo xnet'_'socket | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -7431,7 +7434,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lxnet $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7449: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -7470,7 +7473,7 @@ else fi echo $ac_n "checking for socket in -lsocket""... $ac_c" 1>&6 -echo "configure:7474: checking for socket in -lsocket" >&5 +echo "configure:7477: checking for socket in -lsocket" >&5 ac_lib_var=`echo socket'_'socket | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -7478,7 +7481,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lsocket $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7496: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -7517,7 +7520,7 @@ else fi echo $ac_n "checking for socket in -linet""... $ac_c" 1>&6 -echo "configure:7521: checking for socket in -linet" >&5 +echo "configure:7524: checking for socket in -linet" >&5 ac_lib_var=`echo inet'_'socket | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -7525,7 +7528,7 @@ else ac_save_LIBS="$LIBS" LIBS="-linet $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7543: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -7568,12 +7571,12 @@ fi # If resolver functions are not in libc check for -lnsl or -lresolv. echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6 -echo "configure:7572: checking for gethostbyname" >&5 +echo "configure:7575: checking for gethostbyname" >&5 if eval "test \"`echo '$''{'ac_cv_func_gethostbyname'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7603: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_gethostbyname=yes" else @@ -7614,7 +7617,7 @@ if eval "test \"`echo '$ac_cv_func_'gethostbyname`\" = yes"; then else echo "$ac_t""no" 1>&6 echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6 -echo "configure:7618: checking for gethostbyname in -lnsl" >&5 +echo "configure:7621: checking for gethostbyname in -lnsl" >&5 ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -7622,7 +7625,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lnsl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7640: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -7661,7 +7664,7 @@ else fi echo $ac_n "checking for gethostbyname in -lresolv""... $ac_c" 1>&6 -echo "configure:7665: checking for gethostbyname in -lresolv" >&5 +echo "configure:7668: checking for gethostbyname in -lresolv" >&5 ac_lib_var=`echo resolv'_'gethostbyname | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -7669,7 +7672,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lresolv $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7687: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -7712,12 +7715,12 @@ fi echo $ac_n "checking for strftime""... $ac_c" 1>&6 -echo "configure:7716: checking for strftime" >&5 +echo "configure:7719: checking for strftime" >&5 if eval "test \"`echo '$''{'ac_cv_func_strftime'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7747: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_strftime=yes" else @@ -7762,7 +7765,7 @@ else echo "$ac_t""no" 1>&6 # strftime is in -lintl on SCO UNIX. echo $ac_n "checking for strftime in -lintl""... $ac_c" 1>&6 -echo "configure:7766: checking for strftime in -lintl" >&5 +echo "configure:7769: checking for strftime in -lintl" >&5 ac_lib_var=`echo intl'_'strftime | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -7770,7 +7773,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lintl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7788: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -7808,12 +7811,12 @@ fi fi echo $ac_n "checking for vprintf""... $ac_c" 1>&6 -echo "configure:7812: checking for vprintf" >&5 +echo "configure:7815: checking for vprintf" >&5 if eval "test \"`echo '$''{'ac_cv_func_vprintf'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7843: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_vprintf=yes" else @@ -7860,12 +7863,12 @@ fi if test "$ac_cv_func_vprintf" != yes; then echo $ac_n "checking for _doprnt""... $ac_c" 1>&6 -echo "configure:7864: checking for _doprnt" >&5 +echo "configure:7867: checking for _doprnt" >&5 if eval "test \"`echo '$''{'ac_cv_func__doprnt'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7895: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func__doprnt=yes" else @@ -7915,19 +7918,19 @@ fi # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works # for constant arguments. Useless! echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6 -echo "configure:7919: checking for working alloca.h" >&5 +echo "configure:7922: checking for working alloca.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { char *p = alloca(2 * sizeof(int)); ; return 0; } EOF -if { (eval echo configure:7931: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7934: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_header_alloca_h=yes else @@ -7948,12 +7951,12 @@ EOF fi echo $ac_n "checking for alloca""... $ac_c" 1>&6 -echo "configure:7952: checking for alloca" >&5 +echo "configure:7955: checking for alloca" >&5 if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7988: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_func_alloca_works=yes else @@ -8013,12 +8016,12 @@ EOF echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6 -echo "configure:8017: checking whether alloca needs Cray hooks" >&5 +echo "configure:8020: checking whether alloca needs Cray hooks" >&5 if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&6 if test $ac_cv_os_cray = yes; then for ac_func in _getb67 GETB67 getb67; do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:8047: checking for $ac_func" >&5 +echo "configure:8050: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8078: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -8098,7 +8101,7 @@ done fi echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6 -echo "configure:8102: checking stack direction for C alloca" >&5 +echo "configure:8105: checking stack direction for C alloca" >&5 if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -8106,7 +8109,7 @@ else ac_cv_c_stack_direction=0 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:8132: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_c_stack_direction=1 else @@ -8148,7 +8151,7 @@ fi # getmntent is in -lsun on Irix 4, -lseq on Dynix/PTX, -lgen on Unixware. echo $ac_n "checking for getmntent in -lsun""... $ac_c" 1>&6 -echo "configure:8152: checking for getmntent in -lsun" >&5 +echo "configure:8155: checking for getmntent in -lsun" >&5 ac_lib_var=`echo sun'_'getmntent | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -8156,7 +8159,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lsun $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8174: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -8186,7 +8189,7 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then else echo "$ac_t""no" 1>&6 echo $ac_n "checking for getmntent in -lseq""... $ac_c" 1>&6 -echo "configure:8190: checking for getmntent in -lseq" >&5 +echo "configure:8193: checking for getmntent in -lseq" >&5 ac_lib_var=`echo seq'_'getmntent | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -8194,7 +8197,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lseq $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8212: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -8224,7 +8227,7 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then else echo "$ac_t""no" 1>&6 echo $ac_n "checking for getmntent in -lgen""... $ac_c" 1>&6 -echo "configure:8228: checking for getmntent in -lgen" >&5 +echo "configure:8231: checking for getmntent in -lgen" >&5 ac_lib_var=`echo gen'_'getmntent | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -8232,7 +8235,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lgen $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8250: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -8268,12 +8271,12 @@ fi fi echo $ac_n "checking for getmntent""... $ac_c" 1>&6 -echo "configure:8272: checking for getmntent" >&5 +echo "configure:8275: checking for getmntent" >&5 if eval "test \"`echo '$''{'ac_cv_func_getmntent'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8303: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_getmntent=yes" else @@ -8319,7 +8322,7 @@ else fi echo $ac_n "checking whether closedir returns void""... $ac_c" 1>&6 -echo "configure:8323: checking whether closedir returns void" >&5 +echo "configure:8326: checking whether closedir returns void" >&5 if eval "test \"`echo '$''{'ac_cv_func_closedir_void'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -8327,13 +8330,13 @@ else ac_cv_func_closedir_void=yes else cat > conftest.$ac_ext < #include <$ac_header_dirent> int closedir(); main() { exit(closedir(opendir(".")) != 0); } EOF -if { (eval echo configure:8337: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:8340: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_func_closedir_void=no else @@ -8356,7 +8359,7 @@ EOF fi echo $ac_n "checking whether setpgrp takes no argument""... $ac_c" 1>&6 -echo "configure:8360: checking whether setpgrp takes no argument" >&5 +echo "configure:8363: checking whether setpgrp takes no argument" >&5 if eval "test \"`echo '$''{'ac_cv_func_setpgrp_void'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -8364,7 +8367,7 @@ else { echo "configure: error: cannot check setpgrp if cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:8391: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_func_setpgrp_void=no else @@ -8407,7 +8410,7 @@ EOF fi echo $ac_n "checking for working fnmatch""... $ac_c" 1>&6 -echo "configure:8411: checking for working fnmatch" >&5 +echo "configure:8414: checking for working fnmatch" >&5 if eval "test \"`echo '$''{'ac_cv_func_fnmatch_works'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -8418,11 +8421,11 @@ if test "$cross_compiling" = yes; then ac_cv_func_fnmatch_works=no else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:8429: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_func_fnmatch_works=yes else @@ -8447,7 +8450,7 @@ fi echo $ac_n "checking for setlocale in -lxpg4""... $ac_c" 1>&6 -echo "configure:8451: checking for setlocale in -lxpg4" >&5 +echo "configure:8454: checking for setlocale in -lxpg4" >&5 ac_lib_var=`echo xpg4'_'setlocale | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -8455,7 +8458,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lxpg4 $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8473: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -8489,7 +8492,7 @@ fi echo $ac_n "checking for getpwnam in -lsun""... $ac_c" 1>&6 -echo "configure:8493: checking for getpwnam in -lsun" >&5 +echo "configure:8496: checking for getpwnam in -lsun" >&5 ac_lib_var=`echo sun'_'getpwnam | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -8497,7 +8500,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lsun $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8515: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -8536,7 +8539,7 @@ else fi echo $ac_n "checking for deflate in -lz""... $ac_c" 1>&6 -echo "configure:8540: checking for deflate in -lz" >&5 +echo "configure:8543: checking for deflate in -lz" >&5 ac_lib_var=`echo z'_'deflate | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -8544,7 +8547,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lz $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8562: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -8586,7 +8589,7 @@ fi PTHREAD_LIB="" echo $ac_n "checking for pthread_create in -lpthread""... $ac_c" 1>&6 -echo "configure:8590: checking for pthread_create in -lpthread" >&5 +echo "configure:8593: checking for pthread_create in -lpthread" >&5 ac_lib_var=`echo pthread'_'pthread_create | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -8594,7 +8597,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lpthread $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8612: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -8624,7 +8627,7 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then else echo "$ac_t""no" 1>&6 echo $ac_n "checking for pthread_create in -lpthreads""... $ac_c" 1>&6 -echo "configure:8628: checking for pthread_create in -lpthreads" >&5 +echo "configure:8631: checking for pthread_create in -lpthreads" >&5 ac_lib_var=`echo pthreads'_'pthread_create | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -8632,7 +8635,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lpthreads $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8650: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -8662,7 +8665,7 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then else echo "$ac_t""no" 1>&6 echo $ac_n "checking for pthread_create in -lc_r""... $ac_c" 1>&6 -echo "configure:8666: checking for pthread_create in -lc_r" >&5 +echo "configure:8669: checking for pthread_create in -lc_r" >&5 ac_lib_var=`echo c_r'_'pthread_create | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -8670,7 +8673,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lc_r $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8688: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -8700,12 +8703,12 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then else echo "$ac_t""no" 1>&6 echo $ac_n "checking for pthread_create""... $ac_c" 1>&6 -echo "configure:8704: checking for pthread_create" >&5 +echo "configure:8707: checking for pthread_create" >&5 if eval "test \"`echo '$''{'ac_cv_func_pthread_create'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8735: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_pthread_create=yes" else @@ -9069,7 +9072,11 @@ trap 'rm -fr `echo "autoconf/Make.common \ src/cats/grant_mysql_privileges \ src/cats/make_sqlite_tables \ src/cats/drop_sqlite_tables \ + src/cats/create_sqlite_database \ src/cats/sqlite \ + src/cats/create_bdb_database \ + src/cats/make_bdb_tables \ + src/cats/drop_bdb_tables \ src/findlib/Makefile \ $PFILES src/config.h:autoconf/config.h.in" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 EOF @@ -9208,10 +9215,11 @@ s%@sd_port@%$sd_port%g s%@dir_password@%$dir_password%g s%@fd_password@%$fd_password%g s%@sd_password@%$sd_password%g -s%@cats@%$cats%g s%@SQL_LFLAGS@%$SQL_LFLAGS%g s%@SQL_INCLUDE@%$SQL_INCLUDE%g s%@SQL_BINDIR@%$SQL_BINDIR%g +s%@cats@%$cats%g +s%@DB_NAME@%$DB_NAME%g s%@EXEEXT@%$EXEEXT%g s%@X_CFLAGS@%$X_CFLAGS%g s%@X_PRE_LIBS@%$X_PRE_LIBS%g @@ -9303,7 +9311,11 @@ CONFIG_FILES=\${CONFIG_FILES-"autoconf/Make.common \ src/cats/grant_mysql_privileges \ src/cats/make_sqlite_tables \ src/cats/drop_sqlite_tables \ + src/cats/create_sqlite_database \ src/cats/sqlite \ + src/cats/create_bdb_database \ + src/cats/make_bdb_tables \ + src/cats/drop_bdb_tables \ src/findlib/Makefile \ $PFILES "} EOF @@ -9496,8 +9508,10 @@ chmod 755 src/cats/make_test_tables src/cats/drop_test_tables chmod 755 src/cats/create_mysql_database chmod 755 src/cats/grant_mysql_privileges chmod 755 src/cats/make_sqlite_tables src/cats/drop_sqlite_tables +chmod 755 src/cats/create_sqlite_database chmod 755 src/cats/sqlite - +chmod 755 src/cats/make_bdb_tables src/cats/drop_bdb_tables +chmod 755 src/cats/create_bdb_database echo " Configuration on `date`: diff --git a/bacula/src/baconfig.h b/bacula/src/baconfig.h index 4262b4a050..0b9213125a 100644 --- a/bacula/src/baconfig.h +++ b/bacula/src/baconfig.h @@ -39,11 +39,14 @@ # define __PROTO(p) () #endif -/* #define ASSERT(x) if (!(x)) Emsg1(M_ABORT, 0, "Failed ASSERT: %s\n", __STRING(x)) */ +#ifdef DEBUG #define ASSERT(x) if (!(x)) { \ char *jcr = NULL; \ Emsg1(M_ERROR, 0, "Failed ASSERT: %s\n", #x); \ jcr[0] = 0; } +#else +#define ASSERT(x) +#endif /* Allow printing of NULL pointers */ #define NPRT(x) (x)?(x):"*None*" @@ -200,6 +203,24 @@ extern void _v(char *file, int line, pthread_mutex_t *m); #define Dmsg12(lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12) #define Dmsg13(lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13) #endif /* DEBUG */ + + +/* Messages that are printed (uses d_msg) */ +#define Pmsg0(lvl, msg) d_msg(__FILE__, __LINE__, lvl, msg) +#define Pmsg1(lvl, msg, a1) d_msg(__FILE__, __LINE__, lvl, msg, a1) +#define Pmsg2(lvl, msg, a1, a2) d_msg(__FILE__, __LINE__, lvl, msg, a1, a2) +#define Pmsg3(lvl, msg, a1, a2, a3) d_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3) +#define Pmsg4(lvl, msg, arg1, arg2, arg3, arg4) d_msg(__FILE__, __LINE__, lvl, msg, arg1, arg2, arg3, arg4) +#define Pmsg5(lvl, msg, a1, a2, a3, a4, a5) d_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3, a4, a5) +#define Pmsg6(lvl, msg, a1, a2, a3, a4, a5, a6) d_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3, a4, a5, a6) +#define Pmsg7(lvl, msg, a1, a2, a3, a4, a5, a6, a7) d_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3, a4, a5, a6, a7) +#define Pmsg8(lvl, msg, a1, a2, a3, a4, a5, a6, a7, a8) d_msg(__FILE__, __LINE__, lvl, msg, a1, a2, a3, a4, a5, a6, a7, a8) +#define Pmsg9(lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9) d_msg(__FILE__,__LINE__,lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9) +#define Pmsg10(lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10) d_msg(__FILE__,__LINE__,lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10) +#define Pmsg11(lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11) d_msg(__FILE__,__LINE__,lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11) +#define Pmsg12(lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12) d_msg(__FILE__,__LINE__,lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12) +#define Pmsg13(lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13) d_msg(__FILE__,__LINE__,lvl,msg,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13) + /* Daemon Error Messages that are delivered according to the message resource */ #define Emsg0(typ, lvl, msg) e_msg(__FILE__, __LINE__, typ, lvl, msg) diff --git a/bacula/src/cats/Makefile.in b/bacula/src/cats/Makefile.in index 4478ee95ae..3be938d7cf 100644 --- a/bacula/src/cats/Makefile.in +++ b/bacula/src/cats/Makefile.in @@ -62,20 +62,21 @@ realclean: clean $(RMF) tags $(RMF) make_mysql_tables grant_mysql_privileges drop_mysql_tables $(RMF) create_mysql_database make_sqlite_tables sqlite + $(RMF) create_bdb_database drop_bdb_tables make_dbd_tables distclean: realclean if test $(srcdir) = .; then $(MAKE) realclean; fi (cd $(srcdir); $(RMF) Makefile) install: - $(INSTALL_SCRIPT) create_mysql_database $(DESTDIR)$(sysconfdir)/create_mysql_database - $(INSTALL_SCRIPT) drop_mysql_tables $(DESTDIR)$(sysconfdir)/drop_mysql_tables - $(INSTALL_SCRIPT) make_mysql_tables $(DESTDIR)$(sysconfdir)/make_mysql_tables + $(INSTALL_SCRIPT) create_@DB_NAME@_database $(DESTDIR)$(sysconfdir)/create_@DB_NAME@_database + $(INSTALL_SCRIPT) drop_@DB_NAME@_tables $(DESTDIR)$(sysconfdir)/drop_@DB_NAME@_tables + $(INSTALL_SCRIPT) make_@DB_NAME@_tables $(DESTDIR)$(sysconfdir)/make_@DB_NAME@_tables uninstall: - (cd $(DESTDIR)$(sysconfdir); $(RMF) create_mysql_database) - (cd $(DESTDIR)$(sysconfdir); $(RMF) drop_mysql_tables) - (cd $(DESTDIR)$(sysconfdir); $(RMF) make_mysql_tables) + (cd $(DESTDIR)$(sysconfdir); $(RMF) create_@DB_NAME@_database) + (cd $(DESTDIR)$(sysconfdir); $(RMF) drop_@DB_NAME@_tables) + (cd $(DESTDIR)$(sysconfdir); $(RMF) make_@DB_NAME@_tables) # Semi-automatic generation of dependencies: diff --git a/bacula/src/cats/bdb_find.c b/bacula/src/cats/bdb_find.c index eee4ea7b18..d9838b0adf 100644 --- a/bacula/src/cats/bdb_find.c +++ b/bacula/src/cats/bdb_find.c @@ -177,7 +177,7 @@ int db_find_next_volume(B_DB *mdb, int item, MEDIA_DBR *mr) return stat; } -int db_find_last_full_verify(B_DB *mdb, JOB_DBR *jr) { return 0; } +int db_find_last_jobid(B_DB *mdb, JOB_DBR *jr) { return 0; } #endif /* HAVE_BACULA_DB */ diff --git a/bacula/src/cats/bdb_update.c b/bacula/src/cats/bdb_update.c index 8b0f0ea2f5..9a474576fb 100755 --- a/bacula/src/cats/bdb_update.c +++ b/bacula/src/cats/bdb_update.c @@ -197,7 +197,7 @@ int db_add_MD5_to_file_record(B_DB *mdb, FileId_t FileId, char *MD5) return 1; } -int db_mark_file_record(B_DB *mdb, FileId_t FileId, int JobId) +int db_mark_file_record(B_DB *mdb, FileId_t FileId, JobId_t JobId) { return 1; } diff --git a/bacula/src/cats/cats.h b/bacula/src/cats/cats.h index b3946a61e4..1d05775664 100644 --- a/bacula/src/cats/cats.h +++ b/bacula/src/cats/cats.h @@ -44,28 +44,11 @@ typedef int (DB_RESULT_HANDLER)(void *, int, char **); #define db_lock(mdb) _db_lock(__FILE__, __LINE__, mdb) #define db_unlock(mdb) _db_unlock(__FILE__, __LINE__, mdb) -#ifdef xxxxx_old_way_of_doing_it -#define db_lock(mdb) P(mdb->mutex) -#define db_unlock(mdb) V(mdb->mutex) -#define db_lock(mdb) \ - do { int errstat; if ((errstat=rwl_writelock(&(mdb->lock)))) \ - e_msg(__FILE__, __LINE__, M_ABORT, 0, "rwl_writelock failure. ERR=%s\n",\ - strerror(errstat)); \ - } while(0) - -#define db_unlock(x) \ - do { int errstat; if ((errstat=rwl_writeunlock(&(mdb->lock)))) \ - e_msg(__FILE__, __LINE__, M_ABORT, 0, "rwl_writeunlock failure. ERR=%s\n",\ - strerror(errstat)); \ - } while(0) -#endif - - #ifdef __SQL_C #ifdef HAVE_SQLITE -#define BDB_VERSION 1 +#define BDB_VERSION 2 #include @@ -93,7 +76,6 @@ typedef struct s_sql_field { */ typedef struct s_db { BQUEUE bq; /* queue control */ -/* pthread_mutex_t mutex; */ brwlock_t lock; /* transaction lock */ struct sqlite *db; char **result; @@ -149,7 +131,7 @@ extern void my_sqlite_free_table(B_DB *mdb); #ifdef HAVE_MYSQL -#define BDB_VERSION 1 +#define BDB_VERSION 2 #include @@ -162,7 +144,6 @@ extern void my_sqlite_free_table(B_DB *mdb); */ typedef struct s_db { BQUEUE bq; /* queue control */ -/* pthread_mutex_t mutex; */ brwlock_t lock; /* transaction lock */ MYSQL mysql; MYSQL *db; @@ -354,6 +335,7 @@ typedef struct { JobId_t JobId; uint32_t FilenameId; uint32_t PathId; + JobId_t MarkId; char LStat[256]; /* int Status; */ char MD5[50]; @@ -383,9 +365,9 @@ typedef struct { char VolumeName[MAX_NAME_LENGTH]; /* Volume name */ char MediaType[MAX_NAME_LENGTH]; /* Media type */ uint32_t PoolId; /* Pool id */ - time_t FirstWritten; /* Time Volume first written */ - time_t LastWritten; /* Time Volume last written */ - time_t LabelDate; /* Date/Time Volume labelled */ + time_t FirstWritten; /* Time Volume first written */ + time_t LastWritten; /* Time Volume last written */ + time_t LabelDate; /* Date/Time Volume labelled */ uint32_t VolJobs; /* number of jobs on this medium */ uint32_t VolFiles; /* Number of files */ uint32_t VolBlocks; /* Number of blocks */ @@ -397,7 +379,8 @@ typedef struct { uint64_t VolMaxBytes; /* max bytes to write */ uint64_t VolCapacityBytes; /* capacity estimate */ btime_t VolRetention; /* Volume retention in seconds */ - int Recycle; /* recycle yes/no */ + int Recycle; /* recycle yes/no */ + int32_t Slot; /* slot in changer */ char VolStatus[20]; /* Volume status */ /* Extra stuff not in DB */ faddr_t rec_addr; /* found record address */ diff --git a/bacula/src/cats/create_bdb_database.in b/bacula/src/cats/create_bdb_database.in new file mode 100644 index 0000000000..4313515899 --- /dev/null +++ b/bacula/src/cats/create_bdb_database.in @@ -0,0 +1,5 @@ +#!/bin/sh +# +# shell script to create Bacula database(s) +# +# Nothing to do diff --git a/bacula/src/cats/create_mysql_database.in b/bacula/src/cats/create_mysql_database.in index f0bae06f48..4313515899 100644 --- a/bacula/src/cats/create_mysql_database.in +++ b/bacula/src/cats/create_mysql_database.in @@ -2,15 +2,4 @@ # # shell script to create Bacula database(s) # - -bindir=@SQL_BINDIR@ - -if $bindir/mysql -f <result == NULL) { + send(ctx, _("No results to list.\n")); return; } /* determine column display widths */ diff --git a/bacula/src/cats/protos.h b/bacula/src/cats/protos.h index fbaf15b8af..c3ca48c5a3 100644 --- a/bacula/src/cats/protos.h +++ b/bacula/src/cats/protos.h @@ -36,7 +36,7 @@ void db_close_database(B_DB *db); void db_escape_string(char *snew, char *old, int len); char *db_strerror(B_DB *mdb); int get_sql_record_max(B_DB *mdb); -char *db_next_index(B_DB *mdb, char *table); +int db_next_index(B_DB *mdb, char *table, char *index); int db_sql_query(B_DB *mdb, char *cmd, DB_RESULT_HANDLER *result_handler, void *ctx); int check_tables_version(B_DB *mdb); void _db_unlock(char *file, int line, B_DB *mdb); @@ -57,7 +57,7 @@ int db_delete_media_record(B_DB *mdb, MEDIA_DBR *mr); /* find.c */ int db_find_job_start_time(B_DB *mdb, JOB_DBR *jr, char *stime); -int db_find_last_full_verify(B_DB *mdb, JOB_DBR *jr); +int db_find_last_jobid(B_DB *mdb, JOB_DBR *jr); int db_find_next_volume(B_DB *mdb, int index, MEDIA_DBR *mr); /* get.c */ @@ -89,6 +89,6 @@ int db_update_job_end_record(B_DB *db, JOB_DBR *jr); int db_update_pool_record(B_DB *db, POOL_DBR *pr); int db_update_media_record(B_DB *db, MEDIA_DBR *mr); int db_add_MD5_to_file_record(B_DB *mdb, FileId_t FileId, char *MD5); -int db_mark_file_record(B_DB *mdb, FileId_t FileId, int JobId); +int db_mark_file_record(B_DB *mdb, FileId_t FileId, JobId_t JobId); #endif /* __SQL_PROTOS_H */ diff --git a/bacula/src/cats/sql_create.c b/bacula/src/cats/sql_create.c index 04768c3234..d6eee63df0 100644 --- a/bacula/src/cats/sql_create.c +++ b/bacula/src/cats/sql_create.c @@ -69,7 +69,7 @@ db_create_job_record(B_DB *mdb, JOB_DBR *jr) time_t stime; struct tm tm; int stat; - char *JobId; + char JobId[30]; btime_t JobTDate; char ed1[30]; @@ -80,8 +80,7 @@ db_create_job_record(B_DB *mdb, JOB_DBR *jr) JobTDate = (btime_t)stime; db_lock(mdb); - JobId = db_next_index(mdb, "Job"); - if (!JobId) { + if (!db_next_index(mdb, "Job", JobId)) { jr->JobId = 0; db_unlock(mdb); return 0; diff --git a/bacula/src/cats/sql_find.c b/bacula/src/cats/sql_find.c index bc558ac20f..7da8ecd7b7 100644 --- a/bacula/src/cats/sql_find.c +++ b/bacula/src/cats/sql_find.c @@ -133,32 +133,42 @@ ORDER by StartTime DESC LIMIT 1", } /* - * Find JobId of last full verify + * Find JobId of last job that ran. E.g. for + * VERIFY_CATALOG we want the JobId of the last INIT. + * For VERIFY_VOLUME_TO_CATALOG, we want the JobId of the last Job. + * * Returns: 1 on success * 0 on failure */ int -db_find_last_full_verify(B_DB *mdb, JOB_DBR *jr) +db_find_last_jobid(B_DB *mdb, JOB_DBR *jr) { SQL_ROW row; /* Find last full */ db_lock(mdb); - if (jr->Level != L_VERIFY_CATALOG) { - Mmsg2(&mdb->errmsg, _("Expecting Level=%c, got %c\n"), L_VERIFY_CATALOG, jr->Level); + if (jr->Level == L_VERIFY_CATALOG) { + Mmsg(&mdb->cmd, +"SELECT JobId FROM Job WHERE Type='%c' AND Level='%c' AND Name=\"%s\" AND \ +ClientId=%d ORDER BY StartTime DESC LIMIT 1", + JT_VERIFY, L_VERIFY_INIT, jr->Name, jr->ClientId); + } else if (jr->Level == L_VERIFY_VOLUME_TO_CATALOG) { + Mmsg(&mdb->cmd, +"SELECT JobId FROM Job WHERE Type='%c' AND \ +ClientId=%d ORDER BY StartTime DESC LIMIT 1", + JT_BACKUP, jr->ClientId); + } else { + Mmsg1(&mdb->errmsg, _("Unknown Job level=%c\n"), jr->Level); + db_unlock(mdb); return 0; } - Mmsg(&mdb->cmd, -"SELECT JobId from Job WHERE Type='%c' and Level='%c' and Name=\"%s\" and \ -ClientId=%d ORDER by StartTime DESC LIMIT 1", - JT_VERIFY, L_VERIFY_INIT, jr->Name, jr->ClientId); if (!QUERY_DB(mdb, mdb->cmd)) { db_unlock(mdb); return 0; } if ((row = sql_fetch_row(mdb)) == NULL) { - Mmsg0(&mdb->errmsg, _("No Job found for last full verify.\n")); + Mmsg1(&mdb->errmsg, _("No Job found for: %s.\n"), mdb->cmd); sql_free_result(mdb); db_unlock(mdb); return 0; @@ -167,9 +177,9 @@ ClientId=%d ORDER by StartTime DESC LIMIT 1", jr->JobId = atoi(row[0]); sql_free_result(mdb); - Dmsg1(100, "db_get_last_full_verify: got JobId=%d\n", jr->JobId); + Dmsg1(100, "db_get_last_jobid: got JobId=%d\n", jr->JobId); if (jr->JobId <= 0) { - Mmsg1(&mdb->errmsg, _("No Verify Job found for: %s\n"), mdb->cmd); + Mmsg1(&mdb->errmsg, _("No Job found for: %s\n"), mdb->cmd); db_unlock(mdb); return 0; } diff --git a/bacula/src/cats/sql_get.c b/bacula/src/cats/sql_get.c index ca5f868a66..8d26335ffa 100644 --- a/bacula/src/cats/sql_get.c +++ b/bacula/src/cats/sql_get.c @@ -311,11 +311,11 @@ int db_get_job_record(B_DB *mdb, JOB_DBR *jr) db_lock(mdb); if (jr->JobId == 0) { Mmsg(&mdb->cmd, "SELECT VolSessionId, VolSessionTime, \ -PoolId, StartTime, EndTime, JobFiles, JobBytes, JobTDate, Job \ +PoolId, StartTime, EndTime, JobFiles, JobBytes, JobTDate, Job, JobStatus \ FROM Job WHERE Job=\"%s\"", jr->Job); } else { Mmsg(&mdb->cmd, "SELECT VolSessionId, VolSessionTime, \ -PoolId, StartTime, EndTime, JobFiles, JobBytes, JobTDate, Job \ +PoolId, StartTime, EndTime, JobFiles, JobBytes, JobTDate, Job, JobStatus \ FROM Job WHERE JobId=%d", jr->JobId); } @@ -339,6 +339,7 @@ FROM Job WHERE JobId=%d", jr->JobId); jr->JobBytes = (uint64_t)strtod(row[6], NULL); jr->JobTDate = (btime_t)strtod(row[7], NULL); strcpy(jr->Job, row[8]); + jr->JobStatus = (int)*row[9]; sql_free_result(mdb); db_unlock(mdb); diff --git a/bacula/src/cats/sql_update.c b/bacula/src/cats/sql_update.c index 5c646f0ea8..1707a84b55 100644 --- a/bacula/src/cats/sql_update.c +++ b/bacula/src/cats/sql_update.c @@ -67,14 +67,14 @@ db_add_MD5_to_file_record(B_DB *mdb, FileId_t FileId, char *MD5) } /* Mark the file record as being visited during database - * verify compare. Stuff JobId into FileIndex field + * verify compare. Stuff JobId into MarkedId field */ -int db_mark_file_record(B_DB *mdb, FileId_t FileId, int JobId) +int db_mark_file_record(B_DB *mdb, FileId_t FileId, JobId_t JobId) { int stat; db_lock(mdb); - Mmsg(&mdb->cmd, "UPDATE File SET FileIndex=%d WHERE FileId=%d", JobId, FileId); + Mmsg(&mdb->cmd, "UPDATE File SET MarkId=%d WHERE FileId=%d", JobId, FileId); stat = UPDATE_DB(mdb, mdb->cmd); db_unlock(mdb); return stat; diff --git a/bacula/src/cats/sqlite.c b/bacula/src/cats/sqlite.c index e4969aad7c..4dc485aed3 100644 --- a/bacula/src/cats/sqlite.c +++ b/bacula/src/cats/sqlite.c @@ -106,16 +106,9 @@ db_open_database(B_DB *mdb) return 1; } mdb->connected = FALSE; -#ifdef needed - if (pthread_mutex_init(&mdb->mutex, NULL) != 0) { - Mmsg1(&mdb->errmsg, _("Unable to initialize DB mutex. ERR=%s\n"), strerror(errno)); - V(mutex); - return 0; - } -#endif if (rwl_init(&mdb->lock) != 0) { - Mmsg1(&mdb->errmsg, "Unable to initialize DB lock. ERR=%s\n", strerror(errno)); + Mmsg1(&mdb->errmsg, _("Unable to initialize DB lock. ERR=%s\n"), strerror(errno)); V(mutex); return 0; } @@ -169,7 +162,6 @@ db_close_database(B_DB *mdb) if (mdb->connected && mdb->db) { sqlite_close(mdb->db); } -/* pthread_mutex_destroy(&mdb->mutex); */ rwl_destroy(&mdb->lock); free_pool_memory(mdb->errmsg); free_pool_memory(mdb->cmd); @@ -184,44 +176,41 @@ db_close_database(B_DB *mdb) /* * Return the next unique index (auto-increment) for - * the given table. Return NULL on error. + * the given table. Return 0 on error. */ -char *db_next_index(B_DB *mdb, char *table) +int db_next_index(B_DB *mdb, char *table, char *index) { SQL_ROW row; - static char id[20]; - QUERY_DB(mdb, "BEGIN TRANSACTION"); - sql_free_result(mdb); + db_lock(mdb); Mmsg(&mdb->cmd, "SELECT id FROM NextId WHERE TableName=\"%s\"", table); if (!QUERY_DB(mdb, mdb->cmd)) { Mmsg(&mdb->errmsg, _("next_index query error: ERR=%s\n"), sql_strerror(mdb)); - QUERY_DB(mdb, "ROLLBACK"); - return NULL; + db_unlock(mdb); + return 0; } if ((row = sql_fetch_row(mdb)) == NULL) { Mmsg(&mdb->errmsg, _("Error fetching index: ERR=%s\n"), sql_strerror(mdb)); - QUERY_DB(mdb, "ROLLBACK"); - return NULL; + db_unlock(mdb); + return 0; } - strncpy(id, row[0], sizeof(id)); - id[sizeof(id)-1] = 0; + strncpy(index, row[0], 28); + index[28] = 0; sql_free_result(mdb); Mmsg(&mdb->cmd, "UPDATE NextId SET id=id+1 WHERE TableName=\"%s\"", table); if (!QUERY_DB(mdb, mdb->cmd)) { Mmsg(&mdb->errmsg, _("next_index update error: ERR=%s\n"), sql_strerror(mdb)); - QUERY_DB(mdb, "ROLLBACK"); - return NULL; + db_unlock(mdb); + return 0; } sql_free_result(mdb); - QUERY_DB(mdb, "COMMIT"); - sql_free_result(mdb); - return id; + db_unlock(mdb); + return 1; } @@ -412,6 +401,7 @@ list_result(B_DB *mdb, DB_LIST_HANDLER *send, void *ctx) char buf[2000], ewc[30]; if (mdb->result == NULL || mdb->nrow == 0) { + send(ctx, _("No results to list.\n")); return; } /* determine column display widths */ diff --git a/bacula/src/console/console.c b/bacula/src/console/console.c index f20c683fc9..fe0aac5b2f 100644 --- a/bacula/src/console/console.c +++ b/bacula/src/console/console.c @@ -52,6 +52,7 @@ static char *configfile = NULL; static BSOCK *UA_sock = NULL; static DIRRES *dir; static FILE *output = stdout; +static int stop = FALSE; #define CONFIG_FILE "./console.conf" /* default configuration file */ @@ -71,6 +72,28 @@ static void usage() exit(1); } + +void got_stop(int sig) +{ + stop = TRUE; +} + +void got_continue(int sig) +{ + stop = FALSE; +} + +void got_tout(int sig) +{ +// printf("Got tout\n"); +} + +void got_tin(int sig) +{ +// printf("Got tin\n"); +} + + static void read_and_process_input(FILE *input, BSOCK *UA_sock) { char *prompt = "*"; @@ -112,12 +135,18 @@ static void read_and_process_input(FILE *input, BSOCK *UA_sock) } while ((stat = bnet_recv(UA_sock)) > 0) { if (at_prompt) { - fprintf(output, "\n"); + if (!stop) { + fprintf(output, "\n"); + } at_prompt = FALSE; } - printf("%s", UA_sock->msg); + if (!stop) { + fprintf(output, "%s", UA_sock->msg); + } + } + if (!stop) { + fflush(output); } - fflush(output); if (stat < 0) { break; /* error */ } else if (stat == 0) { @@ -182,6 +211,10 @@ int main(int argc, char *argv[]) init_signals(terminate_console); } signal(SIGCHLD, SIG_IGN); + signal(SIGTSTP, got_stop); + signal(SIGCONT, got_continue); + signal(SIGTTIN, got_tin); + signal(SIGTTOU, got_tout); if (argc) { usage(); @@ -353,8 +386,11 @@ int get_cmd(FILE *input, char *prompt, BSOCK *sock, int sec) { int len; - fprintf(output, prompt); - fflush(output); + if (!stop) { + fprintf(output, prompt); + fflush(output); + } +again: switch (wait_for_data(fileno(input), sec)) { case 0: return 0; /* timeout */ @@ -362,6 +398,9 @@ get_cmd(FILE *input, char *prompt, BSOCK *sock, int sec) return -1; /* error */ default: len = sizeof_pool_memory(sock->msg) - 1; + if (stop) { + goto again; + } if (fgets(sock->msg, len, input) == NULL) { return -1; } diff --git a/bacula/src/count-lines b/bacula/src/count-lines index 5f545b0a8f..89850d6000 100755 --- a/bacula/src/count-lines +++ b/bacula/src/count-lines @@ -4,5 +4,5 @@ touch 1 for i in . console gnome-console cats dird filed findlib lib stored; do ls -1 $i/*.c $i/*.h $i/*.in >>1 done -cat 1 | lines +cat 1 | $HOME/bin/lines # rm -f 1 diff --git a/bacula/src/dird/autoprune.c b/bacula/src/dird/autoprune.c index 64f38888e4..c9cf645d40 100644 --- a/bacula/src/dird/autoprune.c +++ b/bacula/src/dird/autoprune.c @@ -74,7 +74,7 @@ int do_autoprune(JCR *jcr) if (jcr->job->PruneJobs || jcr->client->AutoPrune) { Jmsg(jcr, M_INFO, 0, _("Begin pruning Jobs.\n")); - prune_jobs(&ua, client); + prune_jobs(&ua, client, jcr->JobType); pruned = TRUE; } else { pruned = FALSE; diff --git a/bacula/src/dird/backup.c b/bacula/src/dird/backup.c index aca3aa1b30..d0c2abc2a5 100644 --- a/bacula/src/dird/backup.c +++ b/bacula/src/dird/backup.c @@ -74,10 +74,11 @@ int do_backup(JCR *jcr) since[0] = 0; if (!get_or_create_client_record(jcr)) { - backup_cleanup(jcr, JS_ErrorTerminated, since); + Jmsg(jcr, M_ERROR, 0, _("Could not get/create Client record. ERR=%s\n"), + db_strerror(jcr->db)); + goto bail_out; } - /* * Get or Create FileSet record */ @@ -93,21 +94,19 @@ int do_backup(JCR *jcr) Jmsg(jcr, M_WARNING, 0, _("FileSet MD5 signature not found.\n")); } if (!db_create_fileset_record(jcr->db, &fsr)) { - Jmsg(jcr, M_ERROR, 0, _("Could not create FileSet record. %s"), + Jmsg(jcr, M_ERROR, 0, _("Could not create FileSet record. ERR=%s\n"), db_strerror(jcr->db)); - backup_cleanup(jcr, JS_ErrorTerminated, since); - return 0; + goto bail_out; } jcr->jr.FileSetId = fsr.FileSetId; Dmsg2(9, "Created FileSet %s record %d\n", jcr->fileset->hdr.name, jcr->jr.FileSetId); - /* Look up the last * FULL backup job to get the time/date for a * differential or incremental save. */ - jcr->stime = (char *) get_pool_memory(PM_MESSAGE); + jcr->stime = get_pool_memory(PM_MESSAGE); jcr->stime[0] = 0; since[0] = 0; switch (jcr->JobLevel) { @@ -117,8 +116,7 @@ int do_backup(JCR *jcr) jcr->jr.JobId = 0; if (!db_find_job_start_time(jcr->db, &jcr->jr, jcr->stime)) { Jmsg(jcr, M_INFO, 0, _("Last FULL backup time not found. Doing FULL backup.\n")); - jcr->JobLevel = L_FULL; - jcr->jr.Level = L_FULL; + jcr->JobLevel = jcr->jr.Level = L_FULL; } else { strcpy(since, ", since="); strcat(since, jcr->stime); @@ -131,8 +129,7 @@ int do_backup(JCR *jcr) jcr->jr.StartTime = jcr->start_time; if (!db_update_job_start_record(jcr->db, &jcr->jr)) { Jmsg(jcr, M_ERROR, 0, "%s", db_strerror(jcr->db)); - backup_cleanup(jcr, JS_ErrorTerminated, since); - return 0; + goto bail_out; } jcr->fname = (char *) get_pool_memory(PM_FNAME); @@ -151,8 +148,7 @@ int do_backup(JCR *jcr) if (create_pool(jcr->db, jcr->pool) < 0) { Jmsg(jcr, M_FATAL, 0, _("Pool %s not in database. %s"), pr.Name, db_strerror(jcr->db)); - backup_cleanup(jcr, JS_ErrorTerminated, since); - return 0; + goto bail_out; } else { Jmsg(jcr, M_INFO, 0, _("Pool %s created in database.\n"), pr.Name); } @@ -160,27 +156,6 @@ int do_backup(JCR *jcr) jcr->PoolId = pr.PoolId; /****FIXME**** this can go away */ jcr->jr.PoolId = pr.PoolId; -#ifdef needed - /* NOTE, THIS IS NOW DONE BY THE STORAGE DAEMON - * - * Find at least one Volume associated with this Pool - * It must be marked Append, and be of the correct Media Type - * for the storage type. - */ - memset(&mr, 0, sizeof(mr)); - mr.PoolId = pr.PoolId; - strcpy(mr.VolStatus, "Append"); - strcpy(mr.MediaType, jcr->store->media_type); - if (!db_find_next_volume(jcr->db, 1, &mr)) { - if (!newVolume(jcr)) { - Jmsg(jcr, M_FATAL, 0, _("No writable %s media in Pool %s.\n\ - Please use the Console program to add available Volumes.\n"), mr.MediaType, pr.Name); - backup_cleanup(jcr, JS_ErrorTerminated, since); - return 0; - } - } -#endif - /* * Open a message channel connection with the Storage * daemon. This is to let him know that our client @@ -193,42 +168,36 @@ int do_backup(JCR *jcr) * Start conversation with Storage daemon */ if (!connect_to_storage_daemon(jcr, 10, SDConnectTimeout, 1)) { - backup_cleanup(jcr, JS_ErrorTerminated, since); - return 0; + goto bail_out; } /* * Now start a job with the Storage daemon */ if (!start_storage_daemon_job(jcr)) { - backup_cleanup(jcr, JS_ErrorTerminated, since); - return 0; + goto bail_out; } /* * Now start a Storage daemon message thread */ if (!start_storage_daemon_message_thread(jcr)) { - backup_cleanup(jcr, JS_ErrorTerminated, since); - return 0; + goto bail_out; } - Dmsg0(50, "Storage daemon connection OK\n"); + jcr->JobStatus = JS_Blocked; if (!connect_to_file_daemon(jcr, 10, FDConnectTimeout, 1)) { - backup_cleanup(jcr, JS_ErrorTerminated, since); - return 0; + goto bail_out; } jcr->JobStatus = JS_Running; fd = jcr->file_bsock; if (!send_include_list(jcr)) { - backup_cleanup(jcr, JS_ErrorTerminated, since); - return 0; + goto bail_out; } if (!send_exclude_list(jcr)) { - backup_cleanup(jcr, JS_ErrorTerminated, since); - return 0; + goto bail_out; } /* @@ -239,8 +208,7 @@ int do_backup(JCR *jcr) } bnet_fsend(fd, storaddr, jcr->store->address, jcr->store->SDDport); if (!response(fd, OKstore, "Storage")) { - backup_cleanup(jcr, JS_ErrorTerminated, since); - return 0; + goto bail_out; } /* @@ -258,27 +226,34 @@ int do_backup(JCR *jcr) break; case L_SINCE: default: - Emsg1(M_FATAL, 0, _("Unimplemented backup level %d\n"), jcr->JobLevel); - backup_cleanup(jcr, JS_ErrorTerminated, since); - return 0; + Jmsg2(jcr, M_FATAL, 0, _("Unimplemented backup level %d %c\n"), + jcr->JobLevel, jcr->JobLevel); + goto bail_out; } Dmsg1(20, ">filed: %s", fd->msg); if (!response(fd, OKlevel, "Level")) { - backup_cleanup(jcr, JS_ErrorTerminated, since); - return 0; + goto bail_out; } /* Send backup command */ bnet_fsend(fd, backupcmd); if (!response(fd, OKbackup, "backup")) { - backup_cleanup(jcr, JS_ErrorTerminated, since); - return 0; + goto bail_out; } /* Pickup Job termination data */ stat = wait_for_job_termination(jcr); backup_cleanup(jcr, stat, since); return 1; + +bail_out: + if (jcr->stime) { + free_pool_memory(jcr->stime); + jcr->stime = NULL; + } + backup_cleanup(jcr, JS_ErrorTerminated, since); + return 0; + } /* @@ -302,21 +277,8 @@ static int wait_for_job_termination(JCR *jcr) bnet_strerror(fd)); } - /* Now wait for Storage daemon to terminate our message thread */ - P(jcr->mutex); - jcr->JobStatus = JS_WaitSD; - while (!jcr->msg_thread_done && !job_cancelled(jcr)) { - struct timeval tv; - struct timezone tz; - struct timespec timeout; - - gettimeofday(&tv, &tz); - timeout.tv_nsec = 0; - timeout.tv_sec = tv.tv_sec + 10; /* wait 10 seconds */ - Dmsg0(300, "I'm waiting for message thread termination.\n"); - pthread_cond_timedwait(&jcr->term_wait, &jcr->mutex, &timeout); - } - V(jcr->mutex); + wait_for_storage_daemon_termination(jcr); + if (n < 0) { return JS_ErrorTerminated; } @@ -352,7 +314,6 @@ static void backup_cleanup(JCR *jcr, int TermCode, char *since) db_strerror(jcr->db)); } - msg_type = M_INFO; /* by default INFO message */ switch (TermCode) { case JS_Terminated: diff --git a/bacula/src/dird/catreq.c b/bacula/src/dird/catreq.c index d8b8dc3b33..6aae9dbabc 100644 --- a/bacula/src/dird/catreq.c +++ b/bacula/src/dird/catreq.c @@ -48,12 +48,12 @@ static char Update_media[] = "CatReq Job=%127s UpdateMedia VolName=%s\ VolJobs=%d VolFiles=%d VolBlocks=%d VolBytes=%" lld " VolMounts=%d\ VolErrors=%d VolWrites=%d VolMaxBytes=%" lld " EndTime=%d VolStatus=%10s\ FirstIndex=%d LastIndex=%d StartFile=%d EndFile=%d \ - StartBlock=%d EndBlock=%d relabel=%d\n"; + StartBlock=%d EndBlock=%d relabel=%d Slot=%d\n"; /* Responses sent to Storage daemon */ static char OK_media[] = "1000 OK VolName=%s VolJobs=%d VolFiles=%d\ VolBlocks=%d VolBytes=%" lld " VolMounts=%d VolErrors=%d VolWrites=%d\ - VolMaxBytes=%" lld " VolCapacityBytes=%" lld " VolStatus=%s\n"; + VolMaxBytes=%" lld " VolCapacityBytes=%" lld " VolStatus=%s Slot=%d\n"; static char OK_update[] = "1000 OK UpdateMedia\n"; @@ -109,7 +109,7 @@ void catalog_request(JCR *jcr, BSOCK *bs, char *msg) bnet_fsend(bs, OK_media, mr.VolumeName, mr.VolJobs, mr.VolFiles, mr.VolBlocks, mr.VolBytes, mr.VolMounts, mr.VolErrors, mr.VolWrites, mr.VolMaxBytes, mr.VolCapacityBytes, - mr.VolStatus); + mr.VolStatus, mr.Slot); } else { bnet_fsend(bs, "1999 No Media\n"); } @@ -163,7 +163,7 @@ MediaType=%s\n", mr.PoolId, jcr->PoolId, mr.VolStatus, mr.MediaType); &mr.VolFiles, &mr.VolBlocks, &mr.VolBytes, &mr.VolMounts, &mr.VolErrors, &mr.VolWrites, &mr.VolMaxBytes, &mr.LastWritten, &mr.VolStatus, &jm.FirstIndex, &jm.LastIndex, &jm.StartFile, &jm.EndFile, - &jm.StartBlock, &jm.EndBlock, &relabel) == 19) { + &jm.StartBlock, &jm.EndBlock, &relabel, &mr.Slot) == 20) { /* * Update Media Record */ diff --git a/bacula/src/dird/dird.c b/bacula/src/dird/dird.c index 8de6fce6c3..640b7be170 100644 --- a/bacula/src/dird/dird.c +++ b/bacula/src/dird/dird.c @@ -190,6 +190,9 @@ int main (int argc, char *argv[]) init_console_msg(working_directory); + set_thread_concurrency(director->MaxConcurrentJobs * 2 + + 4 /* UA */ + 4 /* sched+watchdog+jobsvr+misc */); + Dmsg0(200, "Start UA server\n"); start_UA_server(director->DIRport); diff --git a/bacula/src/dird/dird_conf.c b/bacula/src/dird/dird_conf.c index 1535331327..1cc6195c4a 100644 --- a/bacula/src/dird/dird_conf.c +++ b/bacula/src/dird/dird_conf.c @@ -234,6 +234,21 @@ static struct res_items pool_items[] = { {NULL, NULL, NULL, 0, 0, 0} }; +/* + * Counter Resource + * name handler value code flags default_value + */ +static struct res_items counter_items[] = { + {"name", store_name, ITEM(res_counter.hdr.name), 0, ITEM_REQUIRED, 0}, + {"description", store_str, ITEM(res_counter.hdr.desc), 0, 0, 0}, + {"minimum", store_int, ITEM(res_counter.MinValue), 0, ITEM_DEFAULT, 0}, + {"maximum", store_pint, ITEM(res_counter.MaxValue), 0, ITEM_DEFAULT, INT32_MAX}, + {"global", store_yesno, ITEM(res_counter.Global), 0, ITEM_DEFAULT, 0}, + {"wrapcounter", store_strname, ITEM(res_counter.WrapCounter), 0, 0, 0}, + {NULL, NULL, NULL, 0, 0, 0} +}; + + /* Message resource */ extern struct res_items msgs_items[]; @@ -254,6 +269,7 @@ struct s_res resources[] = { {"group", group_items, R_GROUP, NULL}, {"pool", pool_items, R_POOL, NULL}, {"messages", msgs_items, R_MSGS, NULL}, + {"counter", counter_items, R_COUNTER, NULL}, {NULL, NULL, 0, NULL} }; @@ -270,7 +286,7 @@ struct s_jl joblevels[] = { {"Since", L_SINCE, JT_BACKUP}, {"Catalog", L_VERIFY_CATALOG, JT_VERIFY}, {"Initcatalog", L_VERIFY_INIT, JT_VERIFY}, - {"Volume", L_VERIFY_VOLUME, JT_VERIFY}, + {"VolumeToCatalog", L_VERIFY_VOLUME_TO_CATALOG, JT_VERIFY}, {"Data", L_VERIFY_DATA, JT_VERIFY}, {NULL, 0} }; @@ -324,6 +340,8 @@ static struct s_kw ReplaceOptions[] = { #define FS_KW_SIGNATURE 2 #define FS_KW_ENCRYPTION 3 #define FS_KW_VERIFY 4 +#define FS_KW_ONEFS 5 +#define FS_KW_RECURSE 6 /* FileSet keywords */ static struct s_kw FS_option_kw[] = { @@ -331,6 +349,8 @@ static struct s_kw FS_option_kw[] = { {"signature", FS_KW_SIGNATURE}, {"encryption", FS_KW_ENCRYPTION}, {"verify", FS_KW_VERIFY}, + {"onefs", FS_KW_ONEFS}, + {"recurse", FS_KW_RECURSE}, {NULL, 0} }; @@ -355,8 +375,12 @@ static struct s_fs_opt FS_options[] = { {"gzip7", FS_KW_COMPRESSION, "Z7"}, {"gzip8", FS_KW_COMPRESSION, "Z8"}, {"gzip9", FS_KW_COMPRESSION, "Z9"}, - {"blowfish", FS_KW_ENCRYPTION, "B"}, /* ***FIXME*** not implemented */ - {"3des", FS_KW_ENCRYPTION, "3"}, /* ***FIXME*** not implemented */ + {"blowfish", FS_KW_ENCRYPTION, "B"}, /* ***FIXME*** not implemented */ + {"3des", FS_KW_ENCRYPTION, "3"}, /* ***FIXME*** not implemented */ + {"yes", FS_KW_ONEFS, "0"}, + {"no", FS_KW_ONEFS, "f"}, + {"yes", FS_KW_RECURSE, "0"}, + {"no", FS_KW_RECURSE, "h"}, {NULL, 0, 0} }; diff --git a/bacula/src/dird/dird_conf.h b/bacula/src/dird/dird_conf.h index 862e7c3579..603ca943aa 100644 --- a/bacula/src/dird/dird_conf.h +++ b/bacula/src/dird/dird_conf.h @@ -42,8 +42,9 @@ #define R_GROUP 1008 #define R_POOL 1009 #define R_MSGS 1010 +#define R_COUNTER 1011 -#define R_LAST R_MSGS +#define R_LAST R_COUNTER /* * Some resource attributes @@ -210,6 +211,19 @@ struct s_res_group { }; typedef struct s_res_group GROUP; +/* + * Counter Resource + */ +struct s_res_counter { + RES hdr; + + int32_t MinValue; /* Minimum value */ + int32_t MaxValue; /* Maximum value */ + int Global; /* global/local */ + char *WrapCounter; /* Wrap counter name */ +}; +typedef struct s_res_counter COUNTER; + /* * Pool Resource * @@ -217,7 +231,8 @@ typedef struct s_res_group GROUP; struct s_res_pool { RES hdr; - char *pool_type; + struct s_res_counter counter; /* Counter resources */ + char *pool_type; /* Pool type */ char *label_format; /* Label format string */ int use_catalog; /* maintain catalog for media */ int catalog_files; /* maintain file entries in catalog */ @@ -245,6 +260,7 @@ union u_res { struct s_res_group res_group; struct s_res_pool res_pool; struct s_res_msgs res_msgs; + struct s_res_counter res_counter; RES hdr; }; diff --git a/bacula/src/dird/job.c b/bacula/src/dird/job.c index e2ce5d2906..0900b33d96 100644 --- a/bacula/src/dird/job.c +++ b/bacula/src/dird/job.c @@ -101,7 +101,6 @@ void run_job(JCR *jcr) } Dmsg0(50, "DB opened\n"); - /* * Create Job record */ @@ -161,11 +160,15 @@ static void job_thread(void *arg) break; case JT_VERIFY: do_verify(jcr); -// do_autoprune(jcr); + if (jcr->JobStatus == JS_Terminated) { + do_autoprune(jcr); + } break; case JT_RESTORE: do_restore(jcr); -// do_autoprune(jcr); + if (jcr->JobStatus == JS_Terminated) { + do_autoprune(jcr); + } break; case JT_ADMIN: /* No actual job */ @@ -199,7 +202,7 @@ int get_or_create_client_record(JCR *jcr) jcr->client_name = get_memory(strlen(jcr->client->hdr.name) + 1); strcpy(jcr->client_name, jcr->client->hdr.name); if (!db_create_client_record(jcr->db, &cr)) { - Jmsg(jcr, M_ERROR, 0, _("Could not create Client record. %s"), + Jmsg(jcr, M_FATAL, 0, _("Could not create Client record. %s"), db_strerror(jcr->db)); return 0; } diff --git a/bacula/src/dird/msgchan.c b/bacula/src/dird/msgchan.c index 444491601f..324e0d4389 100644 --- a/bacula/src/dird/msgchan.c +++ b/bacula/src/dird/msgchan.c @@ -172,7 +172,6 @@ int start_storage_daemon_message_thread(JCR *jcr) P(jcr->mutex); jcr->use_count++; /* mark in use by msg thread */ V(jcr->mutex); - set_thread_concurrency(4); if ((status=pthread_create(&thid, NULL, msg_thread, (void *)jcr)) != 0) { Emsg1(M_ABORT, 0, _("Cannot create message thread: %s\n"), strerror(status)); } @@ -237,3 +236,22 @@ static void *msg_thread(void *arg) pthread_cleanup_pop(1); return NULL; } + +void wait_for_storage_daemon_termination(JCR *jcr) +{ + /* Now wait for Storage daemon to terminate our message thread */ + P(jcr->mutex); + jcr->JobStatus = JS_WaitSD; + while (!jcr->msg_thread_done && !job_cancelled(jcr)) { + struct timeval tv; + struct timezone tz; + struct timespec timeout; + + gettimeofday(&tv, &tz); + timeout.tv_nsec = 0; + timeout.tv_sec = tv.tv_sec + 10; /* wait 10 seconds */ + Dmsg0(300, "I'm waiting for message thread termination.\n"); + pthread_cond_timedwait(&jcr->term_wait, &jcr->mutex, &timeout); + } + V(jcr->mutex); +} diff --git a/bacula/src/dird/protos.h b/bacula/src/dird/protos.h index 10788274a4..b620ad088b 100644 --- a/bacula/src/dird/protos.h +++ b/bacula/src/dird/protos.h @@ -30,11 +30,11 @@ extern int authenticate_user_agent(BSOCK *ua); /* autoprune.c */ extern int do_autoprune(JCR *jcr); -int prune_volumes(JCR *jcr); +extern int prune_volumes(JCR *jcr); /* autorecycle.c */ -int recycle_a_volume(JCR *jcr, MEDIA_DBR *mr); -int find_recycled_volume(JCR *jcr, MEDIA_DBR *mr); +extern int recycle_a_volume(JCR *jcr, MEDIA_DBR *mr); +extern int find_recycled_volume(JCR *jcr, MEDIA_DBR *mr); /* catreq.c */ @@ -50,7 +50,7 @@ extern int connect_to_file_daemon(JCR *jcr, int retry_interval, extern int send_include_list(JCR *jcr); extern int send_exclude_list(JCR *jcr); extern int get_attributes_and_put_in_catalog(JCR *jcr); -extern int get_attributes_and_compare_to_catalog(JCR *jcr, int last_full_id); +extern int get_attributes_and_compare_to_catalog(JCR *jcr, JobId_t JobId); extern int put_file_into_catalog(JCR *jcr, long file_index, char *fname, char *link, char *attr, int stream); @@ -71,6 +71,7 @@ extern int start_storage_daemon_job(JCR *jcr); extern int start_storage_daemon_message_thread(JCR *jcr); extern int32_t bget_msg(BSOCK *bs, int type); extern int response(BSOCK *fd, char *resp, char *cmd); +extern void wait_for_storage_daemon_termination(JCR *jcr); /* newvol.c */ extern int newVolume(JCR *jcr, MEDIA_DBR *mr); diff --git a/bacula/src/dird/ua.h b/bacula/src/dird/ua.h index 13c092dbf9..8abee797a8 100644 --- a/bacula/src/dird/ua.h +++ b/bacula/src/dird/ua.h @@ -91,5 +91,5 @@ int confirm_retention(UAContext *ua, btime_t *ret, char *msg); /* ua_prune.c */ int prune_files(UAContext *ua, CLIENT *client); -int prune_jobs(UAContext *ua, CLIENT *client); +int prune_jobs(UAContext *ua, CLIENT *client, int JobType); int prune_volume(UAContext *ua, POOL_DBR *pr, MEDIA_DBR *mr); diff --git a/bacula/src/dird/ua_cmds.c b/bacula/src/dird/ua_cmds.c index b2ed0c0f63..6b4e399eaf 100644 --- a/bacula/src/dird/ua_cmds.c +++ b/bacula/src/dird/ua_cmds.c @@ -91,7 +91,7 @@ static struct cmdstruct commands[] = { { N_("sqlquery"), sqlquerycmd, _("use SQL to query catalog")}, { N_("status"), statuscmd, _("status [storage | client]=")}, { N_("unmount"), unmountcmd, _("unmount ")}, - { N_("update"), updatecmd, _("update DB Pool from resource")}, + { N_("update"), updatecmd, _("update Volume or Pool")}, { N_("use"), usecmd, _("use catalog xxx")}, { N_("version"), versioncmd, _("print Director version")}, { N_("quit"), quitcmd, _("quit")}, @@ -500,6 +500,7 @@ Use update to change it.\n"), pool->hdr.name); default: break; } + bsendmsg(ua, _("Pool %s created.\n"), pool->hdr.name); return 1; } @@ -540,8 +541,8 @@ static int updatecmd(UAContext *ua, char *cmd) } start_prompt(ua, _("Update choice:\n")); - add_prompt(ua, _("pool")); - add_prompt(ua, _("volume")); + add_prompt(ua, _("Pool from resource")); + add_prompt(ua, _("Volume parameters")); switch (do_prompt(ua, _("Choose catalog item to update"), NULL)) { case 0: update_pool(ua); @@ -600,12 +601,12 @@ static int update_volume(UAContext *ua) for (int done=0; !done; ) { start_prompt(ua, _("Parameters to modify:\n")); add_prompt(ua, _("Volume Status")); - add_prompt(ua, _("Volume Retention")); - add_prompt(ua, _("Recycle")); + add_prompt(ua, _("Volume Retention Period")); + add_prompt(ua, _("Recycle Flag")); add_prompt(ua, _("Done")); switch (do_prompt(ua, _("Select paramter to modify"), NULL)) { case 0: /* Volume Status */ - /* Modify Volume */ + /* Modify Volume Status */ bsendmsg(ua, _("Current value is: %s\n"), mr.VolStatus); start_prompt(ua, _("Possible Values are:\n")); add_prompt(ua, "Append"); @@ -714,8 +715,10 @@ static int update_pool(UAContext *ua) } id = db_update_pool_record(ua->db, &pr); if (id <= 0) { - bsendmsg(ua, "Error: db_update_pool_record returned %d\n", id); + bsendmsg(ua, _("db_update_pool_record returned %d. ERR=%s\n"), + id, db_strerror(ua->db)); } + bsendmsg(ua, _("Pool DB record updated from resource.\n")); return 1; } diff --git a/bacula/src/dird/ua_prune.c b/bacula/src/dird/ua_prune.c index 5034b4ffe7..82a6583d79 100644 --- a/bacula/src/dird/ua_prune.c +++ b/bacula/src/dird/ua_prune.c @@ -34,7 +34,7 @@ /* Forward referenced functions */ int prune_files(UAContext *ua, CLIENT *client); -int prune_jobs(UAContext *ua, CLIENT *client); +int prune_jobs(UAContext *ua, CLIENT *client, int JobType); int prune_volume(UAContext *ua, POOL_DBR *pr, MEDIA_DBR *mr); static int mark_media_purged(UAContext *ua, MEDIA_DBR *mr); @@ -72,7 +72,8 @@ static char *create_deltabs[] = { /* - * Fill candidates table with all Files subject to being deleted + * Fill candidates table with all Files subject to being deleted. + * This is used for pruning Jobs (first the files, then the Jobs). */ static char *insert_delcand = "INSERT INTO DelCandidates " @@ -83,17 +84,44 @@ static char *insert_delcand = /* * Select files from the DelCandidates table that have a * more recent backup -- i.e. are not the only backup. - * This is the list of files to delete. + * This is the list of files to delete for a Backup Job. */ -static char *select_del = +static char *select_backup_del = "SELECT DelCandidates.JobId " "FROM Job,DelCandidates " "WHERE Job.JobTDate >= %s " "AND Job.ClientId=%d " + "AND Job.JobType='B' " "AND Job.Level='F' " "AND Job.JobStatus='T' " "AND Job.FileSetId=DelCandidates.FileSetId"; +/* + * Select files from the DelCandidates table that have a + * more recent InitCatalog -- i.e. are not the only InitCatalog + * This is the list of files to delete for a Verify Job. + */ +static char *select_verify_del = + "SELECT DelCandidates.JobId " + "FROM Job,DelCandidates " + "WHERE Job.JobTDate >= %s " + "AND Job.ClientId=%d " + "AND Job.JobType='V' " + "AND Job.Level='V' " + "AND Job.JobStatus='T' " + "AND Job.FileSetId=DelCandidates.FileSetId"; + +/* + * Select files from the DelCandidates table. + * This is the list of files to delete for a Restore Job. + */ +static char *select_restore_del = + "SELECT DelCandidates.JobId " + "FROM Job,DelCandidates " + "WHERE Job.JobTDate >= %s " + "AND Job.ClientId=%d " + "AND Job.JobType='R'"; + /* In memory list of JobIds */ struct s_file_del_ctx { JobId_t *JobId; @@ -219,7 +247,8 @@ int prunecmd(UAContext *ua, char *cmd) if (!client || !confirm_retention(ua, &client->JobRetention, "Job")) { return 0; } - prune_jobs(ua, client); + /* ****FIXME**** allow user to select JobType */ + prune_jobs(ua, client, JT_BACKUP); return 1; case 2: if (!select_pool_and_media_dbr(ua, &pr, &mr)) { @@ -246,7 +275,8 @@ int prunecmd(UAContext *ua, char *cmd) if (!client || !confirm_retention(ua, &client->JobRetention, "Job")) { return 0; } - prune_jobs(ua, client); + /* ****FIXME**** allow user to select JobType */ + prune_jobs(ua, client, JT_BACKUP); break; case 2: if (!select_pool_and_media_dbr(ua, &pr, &mr)) { @@ -293,10 +323,9 @@ int prune_files(UAContext *ua, CLIENT *client) period = client->FileRetention; now = (btime_t)time(NULL); + /* Select Jobs -- for counting */ Mmsg(&query, select_job, edit_uint64(now - period, ed1), cr.ClientId); - Dmsg1(050, "select sql=%s\n", query); - if (!db_sql_query(ua->db, query, file_count_handler, (void *)&del)) { if (ua->verbose) { bsendmsg(ua, "%s", db_strerror(ua->db)); @@ -322,6 +351,7 @@ int prune_files(UAContext *ua, CLIENT *client) del.JobId = (JobId_t *)malloc(sizeof(JobId_t) * del.max_ids); + /* Now process same set but making delete list */ db_sql_query(ua->db, query, file_delete_handler, (void *)&del); for (i=0; i < del.num_ids; i++) { @@ -389,8 +419,12 @@ static int create_temp_tables(UAContext *ua) * In other words, we never delete the only Job record that * contains a current backup of a FileSet. This prevents the * Volume from being recycled and destroying a current backup. + * + * For Verify Jobs, we do not delete the last InitCatalog. + * + * For Restore Jobs there are no restrictions. */ -int prune_jobs(UAContext *ua, CLIENT *client) +int prune_jobs(UAContext *ua, CLIENT *client, int JobType) { struct s_job_del_ctx del; struct s_count_ctx cnt; @@ -426,7 +460,6 @@ int prune_jobs(UAContext *ua, CLIENT *client) */ edit_uint64(now - period, ed1); Mmsg(&query, insert_delcand, ed1, cr.ClientId); - if (!db_sql_query(ua->db, query, NULL, (void *)NULL)) { if (ua->verbose) { bsendmsg(ua, "%s", db_strerror(ua->db)); @@ -435,10 +468,9 @@ int prune_jobs(UAContext *ua, CLIENT *client) goto bail_out; } + /* Count Files to be deleted */ strcpy(query, "SELECT count(*) FROM DelCandidates"); - Dmsg1(100, "select sql=%s\n", query); - if (!db_sql_query(ua->db, query, count_handler, (void *)&cnt)) { if (ua->verbose) { bsendmsg(ua, "%s", db_strerror(ua->db)); @@ -463,7 +495,18 @@ int prune_jobs(UAContext *ua, CLIENT *client) del.JobId = (JobId_t *)malloc(sizeof(JobId_t) * del.max_ids); del.PurgedFiles = (char *)malloc(del.max_ids); - Mmsg(&query, select_del, ed1, cr.ClientId); + switch (JobType) { + case JT_ADMIN: + case JT_BACKUP: + Mmsg(&query, select_backup_del, ed1, cr.ClientId); + break; + case JT_RESTORE: + Mmsg(&query, select_restore_del, ed1, cr.ClientId); + break; + case JT_VERIFY: + Mmsg(&query, select_verify_del, ed1, cr.ClientId); + break; + } db_sql_query(ua->db, query, job_delete_handler, (void *)&del); /* diff --git a/bacula/src/dird/ua_run.c b/bacula/src/dird/ua_run.c index be8dfc4659..01864faafc 100644 --- a/bacula/src/dird/ua_run.c +++ b/bacula/src/dird/ua_run.c @@ -219,7 +219,6 @@ try_again: case JT_VERIFY: if (level_name) { /* Look up level name and pull code */ - lcase(level_name); found = 0; for (i=0; joblevels[i].level_name; i++) { if (strcasecmp(level_name, _(joblevels[i].level_name)) == 0) { @@ -283,21 +282,24 @@ JobId: %s\n"), default: bsendmsg(ua, _("Unknown Job Type=%d\n"), jcr->JobType); free_jcr(jcr); - return 1; + return 0; } if (!get_cmd(ua, _("OK to run? (yes/mod/no): "))) { free_jcr(jcr); - return 1; + return 0; /* do not run */ } + /* + * At user request modify parameters of job to be run. + */ if (strcasecmp(ua->cmd, _("mod")) == 0) { FILE *fd; start_prompt(ua, _("Parameters to modify:\n")); - add_prompt(ua, _("Job")); /* 0 */ - add_prompt(ua, _("Level")); /* 1 */ - add_prompt(ua, _("FileSet")); /* 2 */ - add_prompt(ua, _("Client")); /* 3 */ - add_prompt(ua, _("Storage")); /* 4 */ + add_prompt(ua, _("Level")); /* 0 */ + add_prompt(ua, _("Storage")); /* 1 */ + add_prompt(ua, _("Job")); /* 2 */ + add_prompt(ua, _("FileSet")); /* 3 */ + add_prompt(ua, _("Client")); /* 4 */ if (jcr->JobType == JT_RESTORE) { add_prompt(ua, _("Bootstrap")); /* 5 */ add_prompt(ua, _("Where")); /* 6 */ @@ -305,15 +307,6 @@ JobId: %s\n"), } switch (do_prompt(ua, _("Select parameter to modify"), NULL)) { case 0: - /* Job */ - job = select_job_resource(ua); - if (job) { - jcr->job = job; - set_jcr_defaults(jcr, job); - goto try_again; - } - break; - case 1: /* Level */ if (jcr->JobType == JT_BACKUP) { start_prompt(ua, _("Levels:\n")); @@ -345,7 +338,7 @@ JobId: %s\n"), } else if (jcr->JobType == JT_VERIFY) { start_prompt(ua, _("Levels:\n")); add_prompt(ua, _("Initialize Catalog")); - add_prompt(ua, _("Verify from Catalog")); + add_prompt(ua, _("Verify Catalog")); add_prompt(ua, _("Verify Volume")); add_prompt(ua, _("Verify Volume Data")); switch (do_prompt(ua, _("Select level"), NULL)) { @@ -356,7 +349,7 @@ JobId: %s\n"), jcr->JobLevel = L_VERIFY_CATALOG; break; case 2: - jcr->JobLevel = L_VERIFY_VOLUME; + jcr->JobLevel = L_VERIFY_VOLUME_TO_CATALOG; break; case 3: jcr->JobLevel = L_VERIFY_DATA; @@ -367,7 +360,23 @@ JobId: %s\n"), goto try_again; } goto try_again; + case 1: + store = select_storage_resource(ua); + if (store) { + jcr->store = store; + goto try_again; + } + break; case 2: + /* Job */ + job = select_job_resource(ua); + if (job) { + jcr->job = job; + set_jcr_defaults(jcr, job); + goto try_again; + } + break; + case 3: /* FileSet */ fileset = select_fs_resource(ua); if (fileset) { @@ -375,20 +384,13 @@ JobId: %s\n"), goto try_again; } break; - case 3: + case 4: client = select_client_resource(ua); if (client) { jcr->client = client; goto try_again; } break; - case 4: - store = select_storage_resource(ua); - if (store) { - jcr->store = store; - goto try_again; - } - break; case 5: /* Bootstrap */ if (!get_cmd(ua, _("Please enter the Bootstrap file name: "))) { @@ -439,12 +441,12 @@ JobId: %s\n"), } bsendmsg(ua, _("Job not run.\n")); free_jcr(jcr); - return 1; + return 0; /* error do no run Job */ } if (strcasecmp(ua->cmd, _("yes")) != 0) { bsendmsg(ua, _("Job not run.\n")); free_jcr(jcr); - return 1; + return 0; /* do not run */ } Dmsg1(200, "Calling run_job job=%x\n", jcr->job); diff --git a/bacula/src/dird/ua_server.c b/bacula/src/dird/ua_server.c index 0628df3df4..5e67d27923 100644 --- a/bacula/src/dird/ua_server.c +++ b/bacula/src/dird/ua_server.c @@ -67,7 +67,6 @@ void start_UA_server(int UA_port) pthread_t thid; int status; - set_thread_concurrency(4); if ((status=pthread_create(&thid, NULL, connect_thread, (void *)UA_port)) != 0) { Emsg1(M_ABORT, 0, _("Cannot create UA thread: %s\n"), strerror(status)); } diff --git a/bacula/src/dird/verify.c b/bacula/src/dird/verify.c index 475c980004..2b5195bed7 100644 --- a/bacula/src/dird/verify.c +++ b/bacula/src/dird/verify.c @@ -47,10 +47,14 @@ extern int debug_level; /* Commands sent to File daemon */ -static char verifycmd[] = "verify level=%s\n"; +static char verifycmd[] = "verify level=%s\n"; +static char storaddr[] = "storage address=%s port=%d\n"; +static char sessioncmd[] = "session %s %ld %ld %ld %ld %ld %ld\n"; /* Responses received from File daemon */ -static char OKverify[] = "2000 OK verify\n"; +static char OKverify[] = "2000 OK verify\n"; +static char OKstore[] = "2000 OK storage\n"; +static char OKsession[] = "2000 OK session\n"; /* Forward referenced functions */ static void verify_cleanup(JCR *jcr, int TermCode); @@ -58,7 +62,7 @@ static void prt_fname(JCR *jcr); static int missing_handler(void *ctx, int num_fields, char **row); /* - * Do a verification of the specified files + * Do a verification of the specified files against the Catlaog * * Returns: 0 on failure * 1 on success @@ -68,7 +72,7 @@ int do_verify(JCR *jcr) char *level; BSOCK *fd; JOB_DBR jr; - int last_full_id; + JobId_t JobId; if (!get_or_create_client_record(jcr)) { goto bail_out; @@ -80,22 +84,22 @@ int do_verify(JCR *jcr) * we must look up the time and date of the * last full verify. */ - if (jcr->JobLevel == L_VERIFY_CATALOG) { + if (jcr->JobLevel == L_VERIFY_CATALOG || jcr->JobLevel == L_VERIFY_VOLUME_TO_CATALOG) { memcpy(&jr, &(jcr->jr), sizeof(jr)); - if (!db_find_last_full_verify(jcr->db, &jr)) { + if (!db_find_last_jobid(jcr->db, &jr)) { Jmsg(jcr, M_FATAL, 0, _("Unable to find last full verify. %s"), db_strerror(jcr->db)); goto bail_out; } - last_full_id = jr.JobId; - Dmsg1(20, "Last full id=%d\n", last_full_id); - } + JobId = jr.JobId; + Dmsg1(20, "Last full id=%d\n", JobId); + } jcr->jr.JobId = jcr->JobId; jcr->jr.StartTime = jcr->start_time; jcr->jr.Level = jcr->JobLevel; if (!db_update_job_start_record(jcr->db, &jcr->jr)) { - Jmsg(jcr, M_ERROR, 0, "%s", db_strerror(jcr->db)); + Jmsg(jcr, M_FATAL, 0, "%s", db_strerror(jcr->db)); goto bail_out; } @@ -103,32 +107,79 @@ int do_verify(JCR *jcr) jcr->fname = (char *) get_pool_memory(PM_FNAME); } - jcr->jr.JobId = last_full_id; /* save last full id */ + jcr->jr.JobId = JobId; /* save target JobId */ /* Print Job Start message */ Jmsg(jcr, M_INFO, 0, _("Start Verify JobId %d Job=%s\n"), jcr->JobId, jcr->Job); - if (jcr->JobLevel == L_VERIFY_CATALOG) { + if (jcr->JobLevel == L_VERIFY_CATALOG || jcr->JobLevel == L_VERIFY_VOLUME_TO_CATALOG) { memset(&jr, 0, sizeof(jr)); - jr.JobId = last_full_id; + jr.JobId = JobId; if (!db_get_job_record(jcr->db, &jr)) { - Jmsg(jcr, M_ERROR, 0, _("Could not get job record. %s"), db_strerror(jcr->db)); + Jmsg(jcr, M_FATAL, 0, _("Could not get job record. %s"), db_strerror(jcr->db)); goto bail_out; } - Jmsg(jcr, M_INFO, 0, _("Verifying against Init JobId %d run %s\n"), - last_full_id, jr.cStartTime); + if (jr.JobStatus != 'T') { + Jmsg(jcr, M_FATAL, 0, _("Last Job %d did not terminate normally. JobStatus=%c\n"), + JobId, jr.JobStatus); + goto bail_out; + } + Jmsg(jcr, M_INFO, 0, _("Verifying against JobId=%d Job=%s\n"), + JobId, jr.Job); } + /* + * If we are verifing a Volume, we need the Storage + * daemon, so open a connection, otherwise, just + * create a dummy authorization key (passed to + * File daemon but not used). + */ + if (jcr->JobLevel == L_VERIFY_VOLUME_TO_CATALOG) { + /* + * Now find the Volumes we will need for the Verify + */ + jcr->VolumeName[0] = 0; + if (!db_get_job_volume_names(jcr->db, jr.JobId, jcr->VolumeName) || + jcr->VolumeName[0] == 0) { + Jmsg(jcr, M_FATAL, 0, _("Cannot find Volume Name for verify JobId=%d. %s"), + jr.JobId, db_strerror(jcr->db)); + goto bail_out; + } + Dmsg1(20, "Got job Volume Names: %s\n", jcr->VolumeName); + /* + * Start conversation with Storage daemon + */ + jcr->JobStatus = JS_Blocked; + if (!connect_to_storage_daemon(jcr, 10, SDConnectTimeout, 1)) { + goto bail_out; + } + /* + * Now start a job with the Storage daemon + */ + if (!start_storage_daemon_job(jcr)) { + goto bail_out; + } + /* + * Now start a Storage daemon message thread + */ + if (!start_storage_daemon_message_thread(jcr)) { + goto bail_out; + } + Dmsg0(50, "Storage daemon connection OK\n"); + } else { + jcr->sd_auth_key = bstrdup("dummy"); /* dummy Storage daemon key */ + } /* * OK, now connect to the File daemon * and ask him for the files. */ - jcr->sd_auth_key = bstrdup("dummy"); /* dummy Storage daemon key */ + jcr->JobStatus = JS_Blocked; if (!connect_to_file_daemon(jcr, 10, FDConnectTimeout, 1)) { goto bail_out; } + jcr->JobStatus = JS_Running; fd = jcr->file_bsock; Dmsg0(30, ">filed: Send include list\n"); @@ -142,8 +193,8 @@ int do_verify(JCR *jcr) } /* - * Send Level command to File daemon - * + * Send Level command to File daemon, as well + * as the Storage address if appropriate. */ switch (jcr->JobLevel) { case L_VERIFY_INIT: @@ -152,7 +203,29 @@ int do_verify(JCR *jcr) case L_VERIFY_CATALOG: level = "catalog"; break; - case L_VERIFY_VOLUME: + case L_VERIFY_VOLUME_TO_CATALOG: + /* + * send Storage daemon address to the File daemon + */ + if (jcr->store->SDDport == 0) { + jcr->store->SDDport = jcr->store->SDport; + } + bnet_fsend(fd, storaddr, jcr->store->address, jcr->store->SDDport); + if (!response(fd, OKstore, "Storage")) { + goto bail_out; + } + /* + * Pass the VolSessionId, VolSessionTime, Start and + * end File and Blocks on the session command. + */ + bnet_fsend(fd, sessioncmd, + jcr->VolumeName, + jr.VolSessionId, jr.VolSessionTime, + jr.StartFile, jr.EndFile, jr.StartBlock, + jr.EndBlock); + if (!response(fd, OKsession, "Session")) { + goto bail_out; + } level = "volume"; break; case L_VERIFY_DATA: @@ -180,7 +253,22 @@ int do_verify(JCR *jcr) switch (jcr->JobLevel) { case L_VERIFY_CATALOG: Dmsg0(10, "Verify level=catalog\n"); - get_attributes_and_compare_to_catalog(jcr, last_full_id); + get_attributes_and_compare_to_catalog(jcr, JobId); + break; + + case L_VERIFY_VOLUME_TO_CATALOG: + int stat; + Dmsg0(10, "Verify level=volume\n"); + get_attributes_and_compare_to_catalog(jcr, JobId); + stat = jcr->JobStatus; + jcr->JobStatus = JS_WaitSD; + wait_for_storage_daemon_termination(jcr); + /* If we terminate normally, use SD term code, else, use ours */ + if (stat == JS_Terminated) { + jcr->JobStatus = jcr->SDJobStatus; + } else { + jcr->JobStatus = stat; + } break; case L_VERIFY_INIT: @@ -213,11 +301,11 @@ static void verify_cleanup(JCR *jcr, int TermCode) char term_code[100]; char *term_msg; int msg_type; - int last_full_id; + JobId_t JobId; Dmsg0(100, "Enter verify_cleanup()\n"); - last_full_id = jcr->jr.JobId; + JobId = jcr->jr.JobId; jcr->JobStatus = TermCode; update_job_end_record(jcr); @@ -276,7 +364,7 @@ Termination: %s\n\n"), /* * This routine is called only during a Verify */ -int get_attributes_and_compare_to_catalog(JCR *jcr, int last_full_id) +int get_attributes_and_compare_to_catalog(JCR *jcr, JobId_t JobId) { BSOCK *fd; int n, len; @@ -290,13 +378,20 @@ int get_attributes_and_compare_to_catalog(JCR *jcr, int last_full_id) memset(&fdbr, 0, sizeof(FILE_DBR)); fd = jcr->file_bsock; - fdbr.JobId = last_full_id; + fdbr.JobId = JobId; Dmsg0(20, "bdird: waiting to receive file attributes\n"); /* * Get Attributes and MD5 Signature from File daemon + * We expect: + * FileIndex + * Stream + * Options or MD5 + * Filename + * Attributes + * Link name ??? */ - while ((n=bget_msg(fd, 0)) > 0) { + while ((n=bget_msg(fd, 0)) > 0 && !job_cancelled(jcr)) { long file_index, attr_file_index; int stream; char *attr, *p, *fn; @@ -304,7 +399,7 @@ int get_attributes_and_compare_to_catalog(JCR *jcr, int last_full_id) fname = check_pool_memory_size(fname, fd->msglen); jcr->fname = check_pool_memory_size(jcr->fname, fd->msglen); - Dmsg1(50, "Atts+MD5=%s\n", fd->msg); + Dmsg1(400, "Atts+MD5=%s\n", fd->msg); if ((len = sscanf(fd->msg, "%ld %d %100s", &file_index, &stream, Opts_MD5)) != 3) { Jmsg3(jcr, M_FATAL, 0, _("birdJobFiles++; attr_file_index = file_index; /* remember attribute file_index */ decode_stat(attr, &statf); /* decode file stat packet */ do_MD5 = FALSE; jcr->fn_printed = FALSE; - strip_trailing_junk(fname); strcpy(jcr->fname, fname); /* move filename into JCR */ Dmsg2(040, "dirdfname); - Dmsg1(20, "dirddb, fdbr.FileId, jcr->JobId); } - Dmsg3(100, "Found %s in catalog. inx=%d Opts=%s\n", jcr->fname, + Dmsg3(400, "Found %s in catalog. inx=%d Opts=%s\n", jcr->fname, file_index, Opts_MD5); decode_stat(fdbr.LStat, &statc); /* decode catalog stat */ /* @@ -457,7 +552,7 @@ int get_attributes_and_compare_to_catalog(JCR *jcr, int last_full_id) * It came across in the Opts_MD5 field. */ } else if (stream == STREAM_MD5_SIGNATURE) { - Dmsg2(100, "stream=MD5 inx=%d fname=%s\n", file_index, jcr->fname); + Dmsg2(400, "stream=MD5 inx=%d MD5=%s\n", file_index, Opts_MD5); /* * When ever we get an MD5 signature is MUST have been * preceded by an attributes record, which sets attr_file_index @@ -496,9 +591,9 @@ int get_attributes_and_compare_to_catalog(JCR *jcr, int last_full_id) sprintf(buf, "SELECT Path.Path,Filename.Name FROM File,Path,Filename " "WHERE File.JobId=%d " -"AND File.FileIndex!=%d AND File.PathId=Path.PathId " +"AND File.MarkedId!=%d AND File.PathId=Path.PathId " "AND File.FilenameId=Filename.FilenameId", - last_full_id, jcr->JobId); + JobId, jcr->JobId); /* missing_handler is called for each file found */ db_sql_query(jcr->db, buf, missing_handler, (void *)jcr); if (jcr->fn_printed) { diff --git a/bacula/src/filed/Makefile.in b/bacula/src/filed/Makefile.in index c6f0eea85a..1d69b4db81 100755 --- a/bacula/src/filed/Makefile.in +++ b/bacula/src/filed/Makefile.in @@ -19,10 +19,10 @@ dummy: # SVRSRCS = filed.c authenticate.c backup.c estimate.c \ filed_conf.c job.c \ - restore.c status.c verify.c + restore.c status.c verify.c verify_vol.c SVROBJS = filed.o authenticate.o backup.o estimate.o \ filed_conf.o job.o \ - restore.o status.o verify.o + restore.o status.o verify.o verify_vol.o # these are the objects that are changed by the .configure process EXTRAOBJS = @OBJLIST@ diff --git a/bacula/src/filed/backup.c b/bacula/src/filed/backup.c index 85002d9a79..bca73ad34c 100644 --- a/bacula/src/filed/backup.c +++ b/bacula/src/filed/backup.c @@ -102,6 +102,10 @@ static int save_file(FF_PKT *ff_pkt, void *ijcr) JCR *jcr = (JCR *)ijcr; POOLMEM *msgsave; + if (job_cancelled(jcr)) { + return 0; + } + sd = jcr->store_bsock; dir = jcr->dir_bsock; jcr->num_files_examined++; /* bump total file count */ diff --git a/bacula/src/filed/filed.c b/bacula/src/filed/filed.c index bbd95ba5c8..70b2e938e5 100644 --- a/bacula/src/filed/filed.c +++ b/bacula/src/filed/filed.c @@ -193,6 +193,8 @@ Without that I don't know who I am :-(\n"), configfile); me += 1000000; #endif + set_thread_concurrency(10); + start_watchdog(); /* start watchdog thread */ /* Become server, and handle requests */ diff --git a/bacula/src/filed/job.c b/bacula/src/filed/job.c index c0c704fad5..7e1fd7e014 100644 --- a/bacula/src/filed/job.c +++ b/bacula/src/filed/job.c @@ -275,7 +275,7 @@ static int job_cmd(JCR *jcr) &jcr->VolSessionId, &jcr->VolSessionTime, sd_auth_key) != 5) { bnet_fsend(dir, BADjob); - Emsg1(M_FATAL, 0, _("Bad Job Command: %s\n"), dir->msg); + Jmsg(jcr, M_FATAL, 0, _("Bad Job Command: %s\n"), dir->msg); free_pool_memory(sd_auth_key); return 0; } @@ -423,11 +423,12 @@ static int session_cmd(JCR *jcr) { BSOCK *dir = jcr->dir_bsock; + Dmsg1(050, "SessionCmd: %s", dir->msg); if (sscanf(dir->msg, sessioncmd, jcr->VolumeName, &jcr->VolSessionId, &jcr->VolSessionTime, &jcr->StartFile, &jcr->EndFile, &jcr->StartBlock, &jcr->EndBlock) != 7) { - Emsg1(M_FATAL, 0, "Bad session command: %s", dir->msg); + Jmsg(jcr, M_FATAL, 0, "Bad session command: %s", dir->msg); return 0; } @@ -444,8 +445,9 @@ static int storage_cmd(JCR *jcr) BSOCK *dir = jcr->dir_bsock; BSOCK *sd; /* storage daemon bsock */ + Dmsg1(050, "StorageCmd: %s", dir->msg); if (sscanf(dir->msg, storaddr, &jcr->stored_addr, &stored_port) != 2) { - Emsg1(M_FATAL, 0, _("Bad storage command: %s\n"), dir->msg); + Jmsg(jcr, M_FATAL, 0, _("Bad storage command: %s"), dir->msg); return 0; } Dmsg2(30, "Got storage: %s:%d\n", jcr->stored_addr, stored_port); @@ -454,7 +456,7 @@ static int storage_cmd(JCR *jcr) sd = bnet_connect(jcr, 10, 3600, _("Storage daemon"), jcr->stored_addr, NULL, stored_port, 1); if (sd == NULL) { - Jmsg2(jcr, M_FATAL, 0, _("Failed to connect to Storage daemon: %s:%d\n"), + Jmsg(jcr, M_FATAL, 0, _("Failed to connect to Storage daemon: %s:%d\n"), jcr->stored_addr, stored_port); return 0; } @@ -487,7 +489,7 @@ static int backup_cmd(JCR *jcr) Dmsg1(100, "begin backup ff=%p\n", jcr->ff); if (sd == NULL) { - Emsg0(M_FATAL, 0, _("Cannot contact Storage daemon\n")); + Jmsg(jcr, M_FATAL, 0, _("Cannot contact Storage daemon\n")); jcr->JobStatus = JS_ErrorTerminated; goto cleanup; } @@ -506,13 +508,13 @@ static int backup_cmd(JCR *jcr) if (bnet_recv(sd) > 0) { Dmsg1(10, "msg); if (sscanf(sd->msg, OK_open, &jcr->Ticket) != 1) { - Emsg1(M_FATAL, 0, _("Bad response to append open: %s\n"), sd->msg); + Jmsg(jcr, M_FATAL, 0, _("Bad response to append open: %s\n"), sd->msg); jcr->JobStatus = JS_ErrorTerminated; goto cleanup; } Dmsg1(10, "Got Ticket=%d\n", jcr->Ticket); } else { - Emsg0(M_FATAL, 0, _("Bad response from stored to open command\n")); + Jmsg(jcr, M_FATAL, 0, _("Bad response from stored to open command\n")); jcr->JobStatus = JS_ErrorTerminated; goto cleanup; } @@ -566,7 +568,7 @@ static int backup_cmd(JCR *jcr) /* discard anything else returned from SD */ } if (len < 0) { - Emsg2(M_FATAL, 0, _("JobStatus = JS_ErrorTerminated; } } @@ -591,6 +593,7 @@ cleanup: static int verify_cmd(JCR *jcr) { BSOCK *dir = jcr->dir_bsock; + BSOCK *sd = jcr->store_bsock; char level[100]; jcr->JobType = JT_VERIFY; @@ -603,18 +606,44 @@ static int verify_cmd(JCR *jcr) } else if (strcasecmp(level, "catalog") == 0){ jcr->JobLevel = L_VERIFY_CATALOG; } else if (strcasecmp(level, "volume") == 0){ - jcr->JobLevel = L_VERIFY_VOLUME; + jcr->JobLevel = L_VERIFY_VOLUME_TO_CATALOG; } else if (strcasecmp(level, "data") == 0){ jcr->JobLevel = L_VERIFY_DATA; } else { - bnet_fsend(dir, "2994 Bad verify command: %s\n", dir->msg); + bnet_fsend(dir, "2994 Bad verify level: %s\n", dir->msg); return 0; } bnet_fsend(dir, OKverify); Dmsg1(10, "bfiled>dird: %s", dir->msg); - do_verify(jcr); + switch (jcr->JobLevel) { + case L_VERIFY_INIT: + case L_VERIFY_CATALOG: + do_verify(jcr); + break; + case L_VERIFY_VOLUME_TO_CATALOG: + if (!open_sd_read_session(jcr)) { + return 0; + } + do_verify_volume(jcr); + /* + * Send Close session command to Storage daemon + */ + bnet_fsend(sd, read_close, jcr->Ticket); + Dmsg1(30, "bfiled>stored: %s", sd->msg); + + /* ****FIXME**** check response */ + bnet_recv(sd); /* get OK */ + + /* Inform Storage daemon that we are done */ + bnet_sig(sd, BNET_EOF); + + break; + default: + bnet_fsend(dir, "2994 Bad verify level: %s\n", dir->msg); + return 0; + } /* Inform Director that we are done */ return bnet_sig(dir, BNET_EOF); @@ -785,7 +814,7 @@ int response(BSOCK *sd, char *resp, char *cmd) static int send_bootstrap_file(JCR *jcr) { FILE *bs; - char buf[1000]; + char buf[2000]; BSOCK *sd = jcr->store_bsock; char *bootstrap = "bootstrap\n"; diff --git a/bacula/src/filed/protos.h b/bacula/src/filed/protos.h index 7072b44f06..c1cb4fd2ce 100644 --- a/bacula/src/filed/protos.h +++ b/bacula/src/filed/protos.h @@ -24,6 +24,7 @@ extern int blast_data_to_storage_daemon(JCR *jcr, char *addr, int port); extern void do_verify(JCR *jcr); +extern void do_verify_volume(JCR *jcr); extern void do_restore(JCR *jcr); extern int authenticate_director(JCR *jcr); extern int authenticate_storagedaemon(JCR *jcr); diff --git a/bacula/src/filed/restore.c b/bacula/src/filed/restore.c index c892bff19a..6bce564013 100644 --- a/bacula/src/filed/restore.c +++ b/bacula/src/filed/restore.c @@ -80,7 +80,7 @@ void do_restore(JCR *jcr) /* * Get a record from the Storage daemon */ - while (bnet_recv(sd) > 0) { + while (bnet_recv(sd) > 0 && !job_cancelled(jcr)) { /* * First we expect a Stream Record Header */ @@ -94,7 +94,7 @@ void do_restore(JCR *jcr) /* * Now we expect the Stream Data */ - if (bnet_recv(sd) < 0) { + if (bnet_recv(sd) < 0 && !job_cancelled(jcr)) { Jmsg1(jcr, M_FATAL, 0, _("Data record error. ERR=%s\n"), bnet_strerror(sd)); } if (size != ((uint32_t) sd->msglen)) { @@ -123,13 +123,13 @@ void do_restore(JCR *jcr) } if ((int)sizeof_pool_memory(fname) < sd->msglen) { - fname = (char *) realloc_pool_memory(fname, sd->msglen + 1); + fname = realloc_pool_memory(fname, sd->msglen + 1); } if (sizeof_pool_memory(ofile) < sizeof_pool_memory(fname) + wherelen + 1) { - ofile = (char *) realloc_pool_memory(ofile, sizeof_pool_memory(fname) + wherelen + 1); + ofile = realloc_pool_memory(ofile, sizeof_pool_memory(fname) + wherelen + 1); } if ((int)sizeof_pool_memory(lname) < sd->msglen) { - ofile = (char *) realloc_pool_memory(ofile, sd->msglen + 1); + lname = realloc_pool_memory(lname, sd->msglen + 1); } *fname = 0; *lname = 0; @@ -163,7 +163,7 @@ void do_restore(JCR *jcr) /* Save filename and position to attributes */ fp = fname; while (*ap != 0) { - *fp++ = *ap++; + *fp++ = *ap++; /* copy filename to fname */ } *fp = *ap++; /* terminate filename & point to attribs */ diff --git a/bacula/src/filed/verify.c b/bacula/src/filed/verify.c index a3af127d77..63cb2ccc3d 100644 --- a/bacula/src/filed/verify.c +++ b/bacula/src/filed/verify.c @@ -76,6 +76,10 @@ static int verify_file(FF_PKT *ff_pkt, void *pkt) BSOCK *sd, *dir; JCR *jcr = (JCR *)pkt; + if (job_cancelled(jcr)) { + return 0; + } + sd = jcr->store_bsock; dir = jcr->dir_bsock; diff --git a/bacula/src/filed/verify_vol.c b/bacula/src/filed/verify_vol.c new file mode 100644 index 0000000000..4173076acf --- /dev/null +++ b/bacula/src/filed/verify_vol.c @@ -0,0 +1,269 @@ +/* + * Bacula File Daemon verify-vol.c Verify files on a Volume + * versus attributes in Catalog + * + * Kern Sibbald, July MMII + * + * Version $Id$ + * + */ +/* + Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of + the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public + License along with this program; if not, write to the Free + Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. + + */ + +#include "bacula.h" +#include "filed.h" + +/* Data received from Storage Daemon */ +static char rec_header[] = "rechdr %ld %ld %ld %ld %ld"; + +/* Forward referenced functions */ +#ifdef needed +static void print_ls_output(JCR *jcr, char *fname, char *lname, int type, struct stat *statp); +#endif + + +/* + * Verify attributes of the requested files on the Volume + * + */ +void do_verify_volume(JCR *jcr) +{ + BSOCK *sd, *dir; + POOLMEM *fname; /* original file name */ + POOLMEM *lname; /* link name */ + int32_t stream; + uint32_t size; + uint32_t VolSessionId, VolSessionTime, file_index; + uint32_t record_file_index; + int type, stat; + + sd = jcr->store_bsock; + if (!sd) { + Jmsg(jcr, M_FATAL, 0, _("Storage command not issued before Verify.\n")); + jcr->JobStatus = JS_FatalError; + return; + } + dir = jcr->dir_bsock; + jcr->JobStatus = JS_Running; + + if (!bnet_set_buffer_size(sd, MAX_NETWORK_BUFFER_SIZE, BNET_SETBUF_READ)) { + jcr->JobStatus = JS_FatalError; + return; + } + jcr->buf_size = sd->msglen; + + fname = get_pool_memory(PM_FNAME); + lname = get_pool_memory(PM_FNAME); + + /* + * Get a record from the Storage daemon + */ + while (bnet_recv(sd) > 0 && !job_cancelled(jcr)) { + /* + * First we expect a Stream Record Header + */ + if (sscanf(sd->msg, rec_header, &VolSessionId, &VolSessionTime, &file_index, + &stream, &size) != 5) { + Jmsg1(jcr, M_FATAL, 0, _("Record header scan error: %s\n"), sd->msg); + goto bail_out; + } + Dmsg2(30, "Got hdr: FilInx=%d Stream=%d.\n", file_index, stream); + + /* + * Now we expect the Stream Data + */ + if (bnet_recv(sd) < 0 && !job_cancelled(jcr)) { + Jmsg1(jcr, M_FATAL, 0, _("Data record error. ERR=%s\n"), bnet_strerror(sd)); + goto bail_out; + } + if (size != ((uint32_t)sd->msglen)) { + Jmsg2(jcr, M_FATAL, 0, _("Actual data size %d not same as header %d\n"), sd->msglen, size); + goto bail_out; + } + Dmsg1(30, "Got stream data, len=%d\n", sd->msglen); + + /* File Attributes stream */ + if (stream == STREAM_UNIX_ATTRIBUTES) { + char *ap, *lp, *fp; + + Dmsg0(400, "Stream=Unix Attributes.\n"); + + if ((int)sizeof_pool_memory(fname) < sd->msglen) { + fname = realloc_pool_memory(fname, sd->msglen + 1); + } + + if ((int)sizeof_pool_memory(lname) < sd->msglen) { + lname = realloc_pool_memory(lname, sd->msglen + 1); + } + *fname = 0; + *lname = 0; + + /* + * An Attributes record consists of: + * File_index + * Type (FT_types) + * Filename + * Attributes + * Link name (if file linked i.e. FT_LNK) + * + */ + if (sscanf(sd->msg, "%d %d", &record_file_index, &type) != 2) { + Jmsg(jcr, M_FATAL, 0, _("Error scanning record header: %s\n"), sd->msg); + Dmsg0(0, "\nError scanning header\n"); + goto bail_out; + } + Dmsg2(30, "Got Attr: FilInx=%d type=%d\n", record_file_index, type); + if (record_file_index != file_index) { + Jmsg(jcr, M_FATAL, 0, _("Record header file index %ld not equal record index %ld\n"), + file_index, record_file_index); + Dmsg0(0, "File index error\n"); + goto bail_out; + } + ap = sd->msg; + while (*ap++ != ' ') /* skip record file index */ + ; + while (*ap++ != ' ') /* skip type */ + ; + /* Save filename and position to attributes */ + fp = fname; + while (*ap != 0) { + *fp++ = *ap++; /* copy filename to fname */ + } + *fp = *ap++; /* terminate filename & point to attribs */ + + Dmsg1(200, "Attr=%s\n", ap); + /* Skip to Link name */ + if (type == FT_LNK) { + lp = ap; + while (*lp++ != 0) { + ; + } + strcat(lname, lp); /* "save" link name */ + } else { + *lname = 0; + } + jcr->JobFiles++; + jcr->num_files_examined++; + + /* + * Send file attributes to Director + * File_index + * Stream + * Verify Options + * Filename (full path) + * Encoded attributes + * Link name (if type==FT_LNK) + * For a directory, link is the same as fname, but with trailing + * slash. For a linked file, link is the link. + */ + /* Send file attributes to Director */ + Dmsg2(200, "send ATTR inx=%d fname=%s\n", jcr->JobFiles, fname); + if (type == FT_LNK) { + stat = bnet_fsend(dir, "%d %d %s %s%c%s%c%s%c", jcr->JobFiles, + STREAM_UNIX_ATTRIBUTES, "pinsug5", fname, + 0, ap, 0, lname, 0); + } else { + stat = bnet_fsend(dir,"%d %d %s %s%c%s%c%c", jcr->JobFiles, + STREAM_UNIX_ATTRIBUTES, "pinsug5", fname, + 0, ap, 0, 0); + } + Dmsg2(200, "bfiled>bdird: attribs len=%d: msg=%s\n", dir->msglen, dir->msg); + if (!stat) { + Jmsg(jcr, M_FATAL, 0, _("Network error in send to Director: ERR=%s\n"), bnet_strerror(dir)); + goto bail_out; + } + + + /* Data stream */ + } else if (stream == STREAM_FILE_DATA) { + + /* Do nothing */ + + /* GZIP data stream */ + } else if (stream == STREAM_GZIP_DATA) { + + /* Do nothing */ + + /* If MD5 stream */ + } else if (stream == STREAM_MD5_SIGNATURE) { + char MD5buf[30]; + bin_to_base64(MD5buf, (char *)sd->msg, 16); /* encode 16 bytes */ + Dmsg2(400, "send inx=%d MD5=%s\n", jcr->JobFiles, MD5buf); + bnet_fsend(dir, "%d %d %s *MD5-%d*", jcr->JobFiles, STREAM_MD5_SIGNATURE, MD5buf, + jcr->JobFiles); + Dmsg2(20, "bfiled>bdird: MD5 len=%d: msg=%s\n", dir->msglen, dir->msg); + + } else if (stream != STREAM_MD5_SIGNATURE) { + Pmsg2(0, "None of above!!! stream=%d data=%s\n", stream,sd->msg); + } + } + +bail_out: + if (jcr->compress_buf) { + free(jcr->compress_buf); + jcr->compress_buf = NULL; + } + free_pool_memory(fname); + free_pool_memory(lname); + Dmsg2(050, "End Verify-Vol. Files=%d Bytes=%" lld "\n", jcr->JobFiles, + jcr->JobBytes); +} + +extern char *getuser(uid_t uid); +extern char *getgroup(gid_t gid); + +/* + * Print an ls style message, also send INFO + */ +#ifdef needed +static void print_ls_output(JCR *jcr, char *fname, char *lname, int type, struct stat *statp) +{ + char buf[2000]; + char ec1[30]; + char *p, *f; + int n; + + p = encode_mode(statp->st_mode, buf); + n = sprintf(p, " %2d ", (uint32_t)statp->st_nlink); + p += n; + n = sprintf(p, "%-8.8s %-8.8s", getuser(statp->st_uid), getgroup(statp->st_gid)); + p += n; + n = sprintf(p, "%8.8s ", edit_uint64(statp->st_size, ec1)); + p += n; + p = encode_time(statp->st_ctime, p); + *p++ = ' '; + *p++ = ' '; + for (f=fname; *f && (p-buf) < (int)sizeof(buf); ) + *p++ = *f++; + if (type == FT_LNK) { + *p++ = ' '; + *p++ = '-'; + *p++ = '>'; + *p++ = ' '; + /* Copy link name */ + for (f=lname; *f && (p-buf) < (int)sizeof(buf); ) + *p++ = *f++; + } + *p++ = '\n'; + *p = 0; + Dmsg0(20, buf); + Jmsg(jcr, M_INFO, 0, buf); +} +#endif diff --git a/bacula/src/findlib/find.h b/bacula/src/findlib/find.h index 1408f17a2b..2c5d1a0741 100755 --- a/bacula/src/findlib/find.h +++ b/bacula/src/findlib/find.h @@ -56,9 +56,10 @@ #define FO_GZIP 0x2 /* Do Zlib compression */ -#define OPT_compute_MD5 0x01 -#define OPT_GZIP_compression 0x02 -#define OPT_no_recursion 0x04 +#define OPT_compute_MD5 0x01 /* compute MD5 of file's data */ +#define OPT_GZIP_compression 0x02 /* use GZIP compression */ +#define OPT_no_recursion 0x04 /* no recursion in directories */ +#define OPT_multifs 0x08 /* multiple file systems */ struct s_included_file { diff --git a/bacula/src/findlib/find_one.c b/bacula/src/findlib/find_one.c index dcb0381b90..8f6c3ae982 100755 --- a/bacula/src/findlib/find_one.c +++ b/bacula/src/findlib/find_one.c @@ -1,24 +1,27 @@ /* + Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker - Copyright 1988, 92,93,94,95,96,97, 1999 Free Software Foundation, Inc. - Written by John Gilmore, starting 1985-08-25. + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of + the License, or (at your option) any later version. - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any later - version. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. - This program is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General - Public License for more details. + You should have received a copy of the GNU General Public + License along with this program; if not, write to the Free + Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + This file is based on GNU TAR source code. Except for a few key + ideas and some key snippets of code, it has been rewritten for Bacula. - Massively changed from GNU TAR source code to adapt to Bacula - by Kern Sibbald, MM + Kern Sibbald, MM + + Many thanks to the TAR programmers. */ @@ -35,11 +38,6 @@ int readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result); #endif -/* ****FIXME**** debug until stable */ -#undef bmalloc -#define bmalloc(x) sm_malloc(__FILE__, __LINE__, x) - - /* * Structure for keeping track of hard linked files */ @@ -68,284 +66,266 @@ struct utimbuf * handle_file is the callback for handling the file. * p is the filename * parent_device is the device we are currently on - * top_level is 1 when not recursing. + * top_level is 1 when not recursing or 0 when + * decending into a directory. */ int find_one_file(FF_PKT *ff_pkt, int handle_file(FF_PKT *ff, void *hpkt), void *pkt, char *p, dev_t parent_device, int top_level) { - struct utimbuf restore_times; - int rtn_stat; - - ff_pkt->fname = ff_pkt->link = p; - if (ff_pkt->compute_MD5) { - ff_pkt->flags |= FO_MD5; - } - if (ff_pkt->GZIP_compression) { - ff_pkt->flags |= FO_GZIP; - } - - /* Use stat if following (rather than dumping) 4.2BSD's symbolic links. - Otherwise, use lstat (which falls back to stat if no symbolic links). */ - - if (ff_pkt->dereference != 0 -#if STX_HIDDEN && !_LARGE_FILES /* AIX */ - ? statx(p, &ff_pkt->statp, STATSIZE, STX_HIDDEN) - : statx(p, &ff_pkt->statp, STATSIZE, STX_HIDDEN | STX_LINK) -#else - ? stat(p, &ff_pkt->statp) : lstat(p, &ff_pkt->statp) -#endif - ) - { - /* Cannot stat file */ - ff_pkt->type = FT_NOSTAT; - ff_pkt->ff_errno = errno; - return handle_file(ff_pkt, pkt); - } - -Dmsg1(60, "File ----: %s\n", p); -if (S_ISLNK(ff_pkt->statp.st_mode)) - Dmsg1(60, "Link-------------: %s \n", p); - - /* Save current times of this directory in case we need to - * reset them because the user doesn't want them changed. - */ - restore_times.actime = ff_pkt->statp.st_atime; - restore_times.modtime = ff_pkt->statp.st_mtime; - - -#ifdef S_ISHIDDEN - if (S_ISHIDDEN(ff_pkt->statp.st_mode)) { - char *new = alloca(strlen(p) + 2); - if (new) { - strcpy (new, p); - strcat (new, "@"); - p = new; - ff_pkt->link = p; - } - } + struct utimbuf restore_times; + int rtn_stat; + + ff_pkt->fname = ff_pkt->link = p; + if (ff_pkt->compute_MD5) { + ff_pkt->flags |= FO_MD5; + } + if (ff_pkt->GZIP_compression) { + ff_pkt->flags |= FO_GZIP; + } + + if (lstat(p, &ff_pkt->statp) != 0) { + /* Cannot stat file */ + ff_pkt->type = FT_NOSTAT; + ff_pkt->ff_errno = errno; + return handle_file(ff_pkt, pkt); + } + + Dmsg1(60, "File ----: %s\n", p); +#ifdef DEBUG + if (S_ISLNK(ff_pkt->statp.st_mode)) + Dmsg1(60, "Link-------------: %s \n", p); #endif - /* See if we want only new files, and check if this one is too old to - put in the archive. */ - - if (ff_pkt->incremental && !S_ISDIR(ff_pkt->statp.st_mode)) { - Dmsg1(100, "Non-directory incremental: %s\n", ff_pkt->fname); - /* Not a directory */ - if (ff_pkt->statp.st_mtime < ff_pkt->save_time - && (ff_pkt->mtime_only || - ff_pkt->statp.st_ctime < ff_pkt->save_time)) { - /* Incremental option, file not changed */ - ff_pkt->type = FT_NOCHG; - Dmsg1(100, "File not changed: %s\n", ff_pkt->fname); - Dmsg4(200, "save_time=%d mtime=%d mtime_only=%d st_ctime=%d\n", - ff_pkt->save_time, ff_pkt->statp.st_mtime, - ff_pkt->mtime_only, ff_pkt->statp.st_ctime); - return handle_file(ff_pkt, pkt); - } - } + /* Save current times of this directory in case we need to + * reset them because the user doesn't want them changed. + */ + restore_times.actime = ff_pkt->statp.st_atime; + restore_times.modtime = ff_pkt->statp.st_mtime; + + + /* + * If this is an Incremental backup, see if file was modified + * since our last "save_time", presumably the last Full save + * or Incremental. + */ + if (ff_pkt->incremental && !S_ISDIR(ff_pkt->statp.st_mode)) { + Dmsg1(100, "Non-directory incremental: %s\n", ff_pkt->fname); + /* Not a directory */ + if (ff_pkt->statp.st_mtime < ff_pkt->save_time + && (ff_pkt->mtime_only || + ff_pkt->statp.st_ctime < ff_pkt->save_time)) { + /* Incremental option, file not changed */ + ff_pkt->type = FT_NOCHG; + Dmsg1(100, "File not changed: %s\n", ff_pkt->fname); + Dmsg4(200, "save_time=%d mtime=%d mtime_only=%d st_ctime=%d\n", + ff_pkt->save_time, ff_pkt->statp.st_mtime, + ff_pkt->mtime_only, ff_pkt->statp.st_ctime); + return handle_file(ff_pkt, pkt); + } + } #if xxxxxxx - /* See if we are trying to dump the archive. */ - if (ar_dev && ff_pkt->statp.st_dev == ar_dev && ff_pkt->statp.st_ino == ar_ino) { - ff_pkt->type = FT_ISARCH; - return handle_file(ff_pkt, pkt); - } + /* See if we are trying to dump the archive. */ + if (ar_dev && ff_pkt->statp.st_dev == ar_dev && ff_pkt->statp.st_ino == ar_ino) { + ff_pkt->type = FT_ISARCH; + return handle_file(ff_pkt, pkt); + } #endif - /* Check for multiple links. - NOTE: CTG is Masscomp contiguous files - - We maintain a list of all such files that we've written so far. Any - time we see another, we check the list and avoid dumping the data - again if we've done it once already. */ - - if (ff_pkt->statp.st_nlink > 1 - && (S_ISREG(ff_pkt->statp.st_mode) - || S_ISCTG(ff_pkt->statp.st_mode) - || S_ISCHR(ff_pkt->statp.st_mode) - || S_ISBLK(ff_pkt->statp.st_mode) - || S_ISFIFO(ff_pkt->statp.st_mode) - || S_ISSOCK(ff_pkt->statp.st_mode))) { - - struct f_link *lp; - - /* FIXME: First quick and dirty. Hashing, etc later. */ - for (lp = ff_pkt->linklist; lp; lp = lp->next) - if (lp->ino == ff_pkt->statp.st_ino && lp->dev == ff_pkt->statp.st_dev) { - ff_pkt->link = lp->name; - ff_pkt->type = FT_LNKSAVED; - return handle_file(ff_pkt, pkt); - } - - /* Not found. Add it to the list of possible links. */ - - lp = (struct f_link *)bmalloc(sizeof (struct f_link) + strlen(p)); - lp->ino = ff_pkt->statp.st_ino; - lp->dev = ff_pkt->statp.st_dev; - strcpy (lp->name, p); - lp->next = ff_pkt->linklist; - ff_pkt->linklist = lp; - } - - /* This is not a link to a previously dumped file, so dump it. */ - if (S_ISREG(ff_pkt->statp.st_mode) || S_ISCTG(ff_pkt->statp.st_mode)) { - off_t sizeleft; - int header_moved; - - header_moved = 0; - - sizeleft = ff_pkt->statp.st_size; - - /* Don't bother opening empty, world readable files. Also do not open - files when archive is meant for /dev/null. */ - if (ff_pkt->null_output_device || (sizeleft == 0 - && MODE_R == (MODE_R & ff_pkt->statp.st_mode))) { - ff_pkt->type = FT_REGE; - } else { - ff_pkt->type = FT_REG; - } - return handle_file(ff_pkt, pkt); - - } else if (S_ISLNK(ff_pkt->statp.st_mode)) { - int size; - char *buffer = (char *)alloca(PATH_MAX + 1); + /* + * Handle hard linked files + * + * Maintain a list of hard linked files already backed up. This + * allows us to ensure that the data ofeach file gets backed + * up only once. + */ + if (ff_pkt->statp.st_nlink > 1 + && (S_ISREG(ff_pkt->statp.st_mode) + || S_ISCHR(ff_pkt->statp.st_mode) + || S_ISBLK(ff_pkt->statp.st_mode) + || S_ISFIFO(ff_pkt->statp.st_mode) + || S_ISSOCK(ff_pkt->statp.st_mode))) { + + struct f_link *lp; + + /* keep linked list of files */ + for (lp = ff_pkt->linklist; lp; lp = lp->next) + if (lp->ino == ff_pkt->statp.st_ino && lp->dev == ff_pkt->statp.st_dev) { + ff_pkt->link = lp->name; + ff_pkt->type = FT_LNKSAVED; /* Handle link, file already saved */ + return handle_file(ff_pkt, pkt); + } - size = readlink(p, buffer, PATH_MAX + 1); - if (size < 0) { - /* Could not follow link */ - ff_pkt->type = FT_NOFOLLOW; - ff_pkt->ff_errno = errno; - return handle_file(ff_pkt, pkt); - } - buffer[size] = '\0'; - ff_pkt->link = buffer; - ff_pkt->type = FT_LNK; /* got a real link */ - return handle_file(ff_pkt, pkt); - - } else if (S_ISDIR(ff_pkt->statp.st_mode)) { - DIR *directory; - struct dirent *entry, *result; - char *namebuf; - size_t buflen; - size_t len; - int status; - dev_t our_device = ff_pkt->statp.st_dev; - - if (access(p, R_OK) == -1 && geteuid () != 0) { - /* Could not access() directory */ - ff_pkt->type = FT_NOACCESS; - ff_pkt->ff_errno = errno; + /* File not previously dumped. Chain it into our list. */ + lp = (struct f_link *)bmalloc(sizeof (struct f_link) + strlen(p)); + lp->ino = ff_pkt->statp.st_ino; + lp->dev = ff_pkt->statp.st_dev; + strcpy (lp->name, p); + lp->next = ff_pkt->linklist; + ff_pkt->linklist = lp; + } + + /* This is not a link to a previously dumped file, so dump it. */ + if (S_ISREG(ff_pkt->statp.st_mode)) { + off_t sizeleft; + + sizeleft = ff_pkt->statp.st_size; + + /* Don't bother opening empty, world readable files. Also do not open + files when archive is meant for /dev/null. */ + if (ff_pkt->null_output_device || (sizeleft == 0 + && MODE_R == (MODE_R & ff_pkt->statp.st_mode))) { + ff_pkt->type = FT_REGE; + } else { + ff_pkt->type = FT_REG; + } + return handle_file(ff_pkt, pkt); + + } else if (S_ISLNK(ff_pkt->statp.st_mode)) { + int size; + char *buffer = (char *)alloca(PATH_MAX + 1); + + size = readlink(p, buffer, PATH_MAX + 1); + if (size < 0) { + /* Could not follow link */ + ff_pkt->type = FT_NOFOLLOW; + ff_pkt->ff_errno = errno; + return handle_file(ff_pkt, pkt); + } + buffer[size] = '\0'; + ff_pkt->link = buffer; + ff_pkt->type = FT_LNK; /* got a real link */ + return handle_file(ff_pkt, pkt); + + } else if (S_ISDIR(ff_pkt->statp.st_mode)) { + DIR *directory; + struct dirent *entry, *result; + char *namebuf; + size_t buflen; + size_t len; + int status; + dev_t our_device = ff_pkt->statp.st_dev; + + if (access(p, R_OK) == -1 && geteuid() != 0) { + /* Could not access() directory */ + ff_pkt->type = FT_NOACCESS; + ff_pkt->ff_errno = errno; + return handle_file(ff_pkt, pkt); + } + + /* Build new prototype name. Ensure exactly one trailing slash. */ + len = strlen(p); + buflen = len + NAME_FIELD_SIZE; + namebuf = (char *)bmalloc(buflen + 2); + strncpy(namebuf, p, buflen); + while (len >= 1 && namebuf[len - 1] == '/') + len--; + namebuf[len++] = '/'; + namebuf[len] = '\0'; + + ff_pkt->link = namebuf; + if (ff_pkt->incremental && + (ff_pkt->statp.st_mtime < ff_pkt->save_time && + ff_pkt->statp.st_ctime < ff_pkt->save_time)) { + /* Incremental option, directory entry not changed */ + ff_pkt->type = FT_DIRNOCHG; + } else { + ff_pkt->type = FT_DIR; + } + handle_file(ff_pkt, pkt); /* handle directory entry */ + + ff_pkt->link = ff_pkt->fname; /* reset "link" */ + + /* + * Do not decend into subdirectories (recurse) if the + * user has turned it off for this directory. + */ + if (ff_pkt->no_recursion) { + free(namebuf); + /* No recursion into this directory */ + ff_pkt->type = FT_NORECURSE; return handle_file(ff_pkt, pkt); - } - - /* Build new prototype name. Ensure exactly one trailing slash. */ - len = strlen(p); - buflen = len + NAME_FIELD_SIZE; - namebuf = (char *)bmalloc(buflen + 2); - strncpy(namebuf, p, buflen); - while (len >= 1 && namebuf[len - 1] == '/') - len--; - namebuf[len++] = '/'; - namebuf[len] = '\0'; - - ff_pkt->link = namebuf; - if (ff_pkt->incremental && - (ff_pkt->statp.st_mtime < ff_pkt->save_time && - ff_pkt->statp.st_ctime < ff_pkt->save_time)) { - /* Incremental option, directory entry not changed */ - ff_pkt->type = FT_DIRNOCHG; - } else { - ff_pkt->type = FT_DIR; - } - handle_file(ff_pkt, pkt); /* handle directory entry */ - - ff_pkt->link = ff_pkt->fname; /* reset "link" */ - - /* See if we are about to recurse into a directory, and avoid doing - so if the user wants that we do not descend into directories. */ - - if (ff_pkt->no_recursion) { - free(namebuf); - /* No recursion into this directory */ - ff_pkt->type = FT_NORECURSE; - return handle_file(ff_pkt, pkt); - } - - /* See if we are crossing from one file system to another, and - avoid doing so if the user only wants to dump one file system. */ - - if (ff_pkt->one_file_system && !top_level - && parent_device != ff_pkt->statp.st_dev) { + } + + /* + * See if we are crossing file systems, and + * avoid doing so if the user only wants to dump one file system. + */ + if (ff_pkt->one_file_system && !top_level + && parent_device != ff_pkt->statp.st_dev) { free(namebuf); ff_pkt->type = FT_NOFSCHG; return handle_file(ff_pkt, pkt); - } + } - /* Now output all the files in the directory. */ - - errno = 0; /* FIXME: errno should be read-only */ - - if ((directory = opendir(p)) == NULL) { + /* + * Now process the files in this directory. + */ + errno = 0; + if ((directory = opendir(p)) == NULL) { free(namebuf); ff_pkt->type = FT_NOOPEN; ff_pkt->ff_errno = errno; return handle_file(ff_pkt, pkt); - } - - /* FIXME: Should speed this up by cd-ing into the dir. */ - - rtn_stat = 1; - entry = (struct dirent *)malloc(sizeof(struct dirent) + name_max + 10); - for ( ;; ) { - char *p; - - status = readdir_r(directory, entry, &result); - Dmsg3(200, "readdir stat=%d result=%x name=%s\n", status, result, - entry->d_name); - if (status != 0 || result == NULL) { - break; - } - p = entry->d_name; - /* Skip `.', `..', and excluded file names. */ - if (p[0] == '\0' || (p[0] == '.' && (p[1] == '\0' || - (p[1] == '.' && p[2] == '\0')))) { - continue; - } - - if ((int)NAMLEN(entry) + len >= buflen) { - buflen = len + NAMLEN(entry); - namebuf = (char *)brealloc(namebuf, buflen + 2); - } - strcpy(namebuf + len, entry->d_name); - if (!file_is_excluded(ff_pkt, namebuf)) { - rtn_stat = find_one_file(ff_pkt, handle_file, pkt, namebuf, our_device, 0); - } - } - closedir(directory); - free(namebuf); - free(entry); - if (ff_pkt->atime_preserve) { - utime(p, &restore_times); - } - return rtn_stat; - } /* end check for directory */ - - /* The only remaining types are special (character, ...) files */ - ff_pkt->type = FT_SPEC; - return handle_file(ff_pkt, pkt); + } + + /* + * This could possibly run faster if we chdir to the directory + * before traversing it. + */ + rtn_stat = 1; + entry = (struct dirent *)malloc(sizeof(struct dirent) + name_max + 10); + for ( ;; ) { + char *p; + + status = readdir_r(directory, entry, &result); + Dmsg3(200, "readdir stat=%d result=%x name=%s\n", status, result, + entry->d_name); + if (status != 0 || result == NULL) { + break; + } + p = entry->d_name; + /* Skip `.', `..', and excluded file names. */ + if (p[0] == '\0' || (p[0] == '.' && (p[1] == '\0' || + (p[1] == '.' && p[2] == '\0')))) { + continue; + } + + if ((int)NAMLEN(entry) + len >= buflen) { + buflen = len + NAMLEN(entry); + namebuf = (char *)brealloc(namebuf, buflen + 2); + } + strcpy(namebuf + len, entry->d_name); + if (!file_is_excluded(ff_pkt, namebuf)) { + rtn_stat = find_one_file(ff_pkt, handle_file, pkt, namebuf, our_device, 0); + } + } + closedir(directory); + free(namebuf); + free(entry); + if (ff_pkt->atime_preserve) { + utime(p, &restore_times); + } + return rtn_stat; + } /* end check for directory */ + + /* The only remaining types are special (character, ...) files */ + ff_pkt->type = FT_SPEC; + return handle_file(ff_pkt, pkt); } void term_find_one(FF_PKT *ff) { - struct f_link *lp, *lc; + struct f_link *lp, *lc; - /* Free up list of hard linked files */ - for (lp = ff->linklist; lp;) { - lc = lp; - lp = lp->next; - if (lc) - free(lc); - } - return; + /* Free up list of hard linked files */ + for (lp = ff->linklist; lp;) { + lc = lp; + lp = lp->next; + if (lc) { + free(lc); + } + } + return; } diff --git a/bacula/src/findlib/match.c b/bacula/src/findlib/match.c index 2dd9700d6f..2b01f3d100 100644 --- a/bacula/src/findlib/match.c +++ b/bacula/src/findlib/match.c @@ -117,6 +117,9 @@ void add_fname_to_include_list(FF_PKT *ff, int prefixed, char *fname) case 'h': /* no recursion */ inc->options |= OPT_no_recursion; break; + case 'f': + inc->options |= OPT_multifs; + break; case 'V': /* verify options */ /* Copy Verify Options */ for (j=0; *p && *p != ':'; p++) { @@ -216,6 +219,11 @@ struct s_included_file *get_next_included_file(FF_PKT *ff, struct s_included_fil } else { ff->no_recursion = 0; } + if (inc->options & OPT_multifs) { + ff->one_file_system = 0; + } else { + ff->one_file_system = 1; + } } return inc; } diff --git a/bacula/src/jcr.h b/bacula/src/jcr.h index d88b54df1e..db4574600d 100644 --- a/bacula/src/jcr.h +++ b/bacula/src/jcr.h @@ -32,7 +32,7 @@ #ifndef __JCR_H_ #define __JCR_H_ 1 -/* Backup/Verify level code */ +/* Backup/Verify level code. These are stored in the DB */ #define L_FULL 'F' #define L_INCREMENTAL 'I' /* since last backup */ #define L_DIFFERENTIAL 'D' /* since last full backup */ @@ -40,22 +40,22 @@ #define L_SINCE 'S' #define L_VERIFY_CATALOG 'C' /* verify from catalog */ #define L_VERIFY_INIT 'V' /* verify save (init DB) */ -#define L_VERIFY_VOLUME 'O' /* verify we can read volume */ +#define L_VERIFY_VOLUME_TO_CATALOG 'O' /* verify Volume to catalog entries */ #define L_VERIFY_DATA 'A' /* verify data on volume */ -/* Job Types */ -#define JT_BACKUP 'B' -#define JT_VERIFY 'V' -#define JT_RESTORE 'R' +/* Job Types. These are stored in the DB */ +#define JT_BACKUP 'B' /* Backup Job */ +#define JT_VERIFY 'V' /* Verify Job */ +#define JT_RESTORE 'R' /* Restore Job */ #define JT_CONSOLE 'C' /* console program */ #define JT_ADMIN 'D' /* admin job */ #define JT_ARCHIVE 'A' -/* Job Status */ -#define JS_Created 'C' -#define JS_Running 'R' -#define JS_Blocked 'B' +/* Job Status. Some of these are stored in the DB */ +#define JS_Created 'C' /* created but not yet running */ +#define JS_Running 'R' /* running */ +#define JS_Blocked 'B' /* blocked */ #define JS_Terminated 'T' /* terminated normally */ #define JS_ErrorTerminated 'E' /* Job terminated in error */ #define JS_Error 'e' /* Non-fatal error */ @@ -68,7 +68,9 @@ #define JS_WaitMount 'M' /* waiting for Mount */ #define job_cancelled(jcr) \ - (jcr->JobStatus == JS_Cancelled || jcr->JobStatus == JS_ErrorTerminated) + (jcr->JobStatus == JS_Cancelled || \ + jcr->JobStatus == JS_ErrorTerminated || \ + jcr->JobStatus == JS_FatalError) typedef void (JCR_free_HANDLER)(struct s_jcr *jcr); @@ -132,7 +134,7 @@ struct s_jcr { uint32_t FileIndex; /* Last FileIndex processed */ POOLMEM *fname; /* name to put into catalog */ int fn_printed; /* printed filename */ - char *stime; /* start time for incremental/differential */ + POOLMEM *stime; /* start time for incremental/differential */ JOB_DBR jr; /* Job record in Database */ int RestoreJobId; /* Id specified by UA */ char *RestoreWhere; /* Where to restore the files */ diff --git a/bacula/src/lib/Makefile.in b/bacula/src/lib/Makefile.in index 62c6f4eec8..f053806ffc 100644 --- a/bacula/src/lib/Makefile.in +++ b/bacula/src/lib/Makefile.in @@ -97,7 +97,7 @@ Makefile: $(srcdir)/Makefile.in $(topdir)/config.status && CONFIG_FILES=$(thisdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status smtp: smtp.o - $(CXX) $(LDFLAGS) -L. -o $@ smtp.o $(LIBS) $(DLIB) -lbac -lm + $(CXX) $(LDFLAGS) -static -L. -o $@ smtp.o $(LIBS) $(DLIB) -lbac -lm rwlock_test: rwlock.o rm -f rwlock.o diff --git a/bacula/src/lib/bnet.c b/bacula/src/lib/bnet.c index adec5062a9..8a9e398b40 100644 --- a/bacula/src/lib/bnet.c +++ b/bacula/src/lib/bnet.c @@ -407,6 +407,8 @@ bnet_connect(void *jcr, int retry_interval, int max_retry_time, char *name, BSOCK *bsock; for (i=0; (bsock = bnet_open(name, host, service, port)) == NULL; i -= retry_interval) { + Dmsg4(100, "Unable to connect to %s on %s:%d. ERR=%s\n", + name, host, port, strerror(errno)); if (i <= 0) { i = 60 * 5; /* complain again in 5 minutes */ if (verbose) @@ -416,8 +418,8 @@ Retrying ...\n", name, host, port, strerror(errno)); sleep(retry_interval); max_retry_time -= retry_interval; if (max_retry_time <= 0) { - Jmsg(jcr, M_FATAL, 0, "Unable to connect to %s on %s:%d.\n", - name, host, port); + Jmsg(jcr, M_FATAL, 0, _("Unable to connect to %s on %s:%d. ERR=%s\n"), + name, host, port, strerror(errno)); return NULL; } } diff --git a/bacula/src/lib/bnet_pkt.c b/bacula/src/lib/bnet_pkt.c new file mode 100644 index 0000000000..fb5ae14d87 --- /dev/null +++ b/bacula/src/lib/bnet_pkt.c @@ -0,0 +1,88 @@ +/* + * Network Packet Utility Routines + * + * by Kern Sibbald, July MMII + * + * + * Version $Id$ + */ +/* + Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of + the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public + License along with this program; if not, write to the Free + Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. + + */ + + +#include "bacula.h" + +/* + * Receive a message from the other end. Each message consists of + * two packets. The first is a header that contains the size + * of the data that follows in the second packet. + * Returns number of bytes read + * Returns 0 on end of file + * Returns -1 on hard end of file (i.e. network connection close) + * Returns -2 on error + */ +int32_t +bnet_recv_pkt(BSOCK *bsock, BPKT *pkt) +{ +} + +/* + * Send a message over the network. The send consists of + * two network packets. The first is sends a 32 bit integer containing + * the length of the data packet which follows. + * + * Returns: 0 on failure + * 1 on success + */ +int +bnet_send_pkt(BSOCK *bsock, BPKT *pkt) +{ + ser_declare; + + ser_begin(bsock->msg, 0); + + while (pkt->type != BP_EOF) { + ser_int8(pkt->type); + switch (pkt->type) { + case BP_CHAR: + ser_int8(*((int8_t)pkt->value))); + break; + case BP_INT32: + ser_int32(*(int32_t)pkt->value))); + break; + case BP_UINT32: + break; + case BP_INT64: + break; + case BP_STRING: + break; + case BP_NAME: + break; + case BP_BYTES: + break; + case BP_FLOAT32: + break; + case BP_FLOAT64: + break; + default: + Emsg1(M_ABORT, 0, _("Unknown BPKT type: %d\n"), pkt->type); + } + +} diff --git a/bacula/src/lib/bsock.h b/bacula/src/lib/bsock.h index 92b9ded460..cbb79513ef 100644 --- a/bacula/src/lib/bsock.h +++ b/bacula/src/lib/bsock.h @@ -66,3 +66,37 @@ typedef struct s_bsock { #define BNET_SETBUF_READ 1 /* Arg for bnet_set_buffer_size */ #define BNET_SETBUF_WRITE 2 /* Arg for bnet_set_buffer_size */ + +/* + * This is the structure of the in memory BPKT + */ +typedef struct s_bpkt { + char *id; /* String identifier or name of field */ + uint8_t type; /* field type */ + uint32_t len; /* field length for string, name, bytes */ + void *value; /* pointer to value */ +} BPKT; + +/* + * These are the data types that can be sent. + * For all values other than string, the storage space + * is assumed to be allocated in the receiving packet. + * For BP_STRING if the *value is non-zero, it is a + * pointer to a POOLMEM buffer, and the Memory Pool + * routines will be used to assure that the length is + * adequate. NOTE!!! This pointer will be changed + * if the memory is reallocated (sort of like Mmsg(&pool) + * does). If the pointer is NULL, a POOLMEM + * buffer will be allocated. + */ +#define BP_EOF 0 /* end of file */ +#define BP_CHAR 1 /* Character */ +#define BP_INT32 1 /* 32 bit integer */ +#define BP_UINT32 3 /* Unsigned 32 bit integer */ +#define BP_INT64 4 /* 64 bit integer */ +#define BP_STRING 5 /* string */ +#define BP_NAME 6 /* Name string -- limited length */ +#define BP_BYTES 7 /* Binary bytes */ +#define BP_FLOAT32 8 /* 32 bit floating point */ +#define BP_FLOAT64 9 /* 64 bit floating point */ + diff --git a/bacula/src/lib/message.c b/bacula/src/lib/message.c index d2c17c873c..177aadb799 100755 --- a/bacula/src/lib/message.c +++ b/bacula/src/lib/message.c @@ -381,8 +381,8 @@ static char *job_level_to_str(int level) case L_VERIFY_INIT: str = "verify init"; break; - case L_VERIFY_VOLUME: - str = "verify volume"; + case L_VERIFY_VOLUME_TO_CATALOG: + str = "verify volume to catalog"; break; case L_VERIFY_DATA: str = "verify data"; @@ -793,8 +793,6 @@ d_msg(char *file, int line, int level, char *fmt,...) level = -level; } -/* printf("level=%d debug=%d fmt=%s\n", level, debug_level, fmt); */ - if (level <= debug_level) { #ifdef FULL_LOCATION if (details) { @@ -892,7 +890,6 @@ Jmsg(void *vjcr, int type, int level, char *fmt,...) va_list arg_ptr; int i, len; JCR *jcr = (JCR *) vjcr; - int typesave = type; MSGS *msgs; char *job; @@ -953,7 +950,6 @@ Jmsg(void *vjcr, int type, int level, char *fmt,...) len = bvsnprintf(buf+i, sizeof(rbuf)-i, fmt, arg_ptr); va_end(arg_ptr); - ASSERT(typesave==type); /* type trashed, compiler bug???? */ dispatch_message(jcr, type, level, rbuf); Dmsg3(500, "i=%d sizeof(rbuf)-i=%d len=%d\n", i, sizeof(rbuf)-i, len); diff --git a/bacula/src/lib/parse_conf.c b/bacula/src/lib/parse_conf.c index e4d43a9747..4d9bd0f49a 100755 --- a/bacula/src/lib/parse_conf.c +++ b/bacula/src/lib/parse_conf.c @@ -130,7 +130,6 @@ static void prtmsg(void *sock, char *fmt, ...) va_end(arg_ptr); } -#ifdef DEBUG char *res_to_str(int rcode) { if (rcode < r_first || rcode > r_last) { @@ -139,7 +138,6 @@ char *res_to_str(int rcode) return resources[rcode-r_first].name; } } -#endif /* DEBUG */ /* diff --git a/bacula/src/stored/append.c b/bacula/src/stored/append.c index 35a78771dc..5316bf08f1 100644 --- a/bacula/src/stored/append.c +++ b/bacula/src/stored/append.c @@ -105,11 +105,10 @@ int do_append_data(JCR *jcr) char info[100]; /* Read Stream header from the File daemon. - * The stream header consists of the - * - * file_index (sequential Bacula file index) - * stream (arbitrary Bacula number to distinguish parts of data) - * info (Info for Storage daemon -- compressed, encryped, ...) + * The stream header consists of the following: + * file_index (sequential Bacula file index) + * stream (arbitrary Bacula number to distinguish parts of data) + * info (Info for Storage daemon -- compressed, encryped, ...) */ if ((n=bget_msg(ds)) < 0) { Jmsg1(jcr, M_FATAL, 0, _("Error reading data header from FD. ERR=%s\n"), @@ -117,7 +116,7 @@ int do_append_data(JCR *jcr) ok = FALSE; break; } - if (n == 0) { /* End of conversation */ + if (n == 0 || job_cancelled(jcr)) { break; /* all done */ } sm_check(__FILE__, __LINE__, False); @@ -148,7 +147,6 @@ int do_append_data(JCR *jcr) */ sm_check(__FILE__, __LINE__, False); while ((n=bget_msg(ds)) > 0 && !job_cancelled(jcr)) { - char *dsmsg = ds->msg; sm_check(__FILE__, __LINE__, False); rec.VolSessionId = jcr->VolSessionId; @@ -189,8 +187,6 @@ int do_append_data(JCR *jcr) break; } } - ASSERT(dsmsg == ds->msg); - ASSERT(dsmsg == rec.data); sm_check(__FILE__, __LINE__, False); } if (n < 0) { @@ -216,13 +212,13 @@ int do_append_data(JCR *jcr) } /* Write out final block of this session */ if (!write_block_to_device(jcr, dev, block)) { - Dmsg0(0, "Set ok=FALSE after write_block_to_device.\n"); + Pmsg0(0, "Set ok=FALSE after write_block_to_device.\n"); ok = FALSE; } /* Release the device */ if (!release_device(jcr, dev, block)) { - Dmsg0(0, "Error in release_device\n"); + Pmsg0(0, "Error in release_device\n"); ok = FALSE; } diff --git a/bacula/src/stored/askdir.c b/bacula/src/stored/askdir.c index 698c9e18aa..2d88d1e367 100644 --- a/bacula/src/stored/askdir.c +++ b/bacula/src/stored/askdir.c @@ -37,7 +37,7 @@ static char Update_media[] = "CatReq Job=%s UpdateMedia VolName=%s\ VolJobs=%d VolFiles=%d VolBlocks=%d VolBytes=%" lld " VolMounts=%d\ VolErrors=%d VolWrites=%d VolMaxBytes=%" lld " EndTime=%d VolStatus=%s\ FirstIndex=%d LastIndex=%d StartFile=%d EndFile=%d \ - StartBlock=%d EndBlock=%d relabel=%d\n"; + StartBlock=%d EndBlock=%d relabel=%d Slot=%d\n"; static char FileAttributes[] = "UpdCat Job=%s FileAttributes "; @@ -47,7 +47,8 @@ static char Job_status[] = "3012 Job %s jobstatus %d\n"; /* Responses received from the Director */ static char OK_media[] = "1000 OK VolName=%127s VolJobs=%d VolFiles=%d\ VolBlocks=%d VolBytes=%" lld " VolMounts=%d VolErrors=%d VolWrites=%d\ - VolMaxBytes=%" lld " VolCapacityBytes=%" lld " VolStatus=%20s\n"; + VolMaxBytes=%" lld " VolCapacityBytes=%" lld " VolStatus=%20s\ + Slot=%d\n"; static char OK_update[] = "1000 OK UpdateMedia\n"; @@ -81,7 +82,8 @@ static int do_request_volume_info(JCR *jcr) &vol->VolCatBlocks, &vol->VolCatBytes, &vol->VolCatMounts, &vol->VolCatErrors, &vol->VolCatWrites, &vol->VolCatMaxBytes, - &vol->VolCatCapacityBytes, vol->VolCatStatus) != 11) { + &vol->VolCatCapacityBytes, vol->VolCatStatus, + &vol->Slot) != 12) { Dmsg1(30, "Bad response from Dir: %s\n", dir->msg); return 0; } @@ -145,6 +147,7 @@ int dir_update_volume_info(JCR *jcr, VOLUME_CAT_INFO *vol, int relabel) if (vol->VolCatName[0] == 0) { Jmsg0(jcr, M_ERROR, 0, _("NULL Volume name. This shouldn't happen!!!\n")); + return 0; } bnet_fsend(dir, Update_media, jcr->Job, vol->VolCatName, vol->VolCatJobs, vol->VolCatFiles, @@ -155,7 +158,7 @@ int dir_update_volume_info(JCR *jcr, VOLUME_CAT_INFO *vol, int relabel) jcr->VolFirstFile, jcr->JobFiles, jcr->start_file, jcr->end_file, jcr->start_block, jcr->end_block, - relabel); + relabel, vol->Slot); Dmsg1(20, "update_volume_data(): %s", dir->msg); if (bnet_recv(dir) <= 0) { Dmsg0(90, "updateVolCatInfo error bnet_recv\n"); @@ -179,7 +182,7 @@ int dir_update_file_attributes(JCR *jcr, DEV_RECORD *rec) ser_declare; dir->msglen = sprintf(dir->msg, FileAttributes, jcr->Job); - dir->msg = (char *) check_pool_memory_size(dir->msg, dir->msglen + + dir->msg = check_pool_memory_size(dir->msg, dir->msglen + sizeof(DEV_RECORD) + rec->data_len); ser_begin(dir->msg + dir->msglen, 0); ser_uint32(rec->VolSessionId); @@ -254,8 +257,9 @@ int dir_ask_sysop_to_mount_next_volume(JCR *jcr, DEVICE *dev) jcr->VolumeName, jcr->dev_name, jcr->Job); } else { jstat = JS_WaitMedia; - Jmsg(jcr, M_MOUNT, 0, _("Job %s waiting. Cannot find any appendable volumes.\n\ -Please use the \"unmount\" and \"label\" commands to create new Volumes for:\n\ + Jmsg(jcr, M_MOUNT, 0, _( +"Job %s waiting. Cannot find any appendable volumes.\n\ +Please use the \"label\" command to create new Volumes for:\n\ Storage Device \"%s\" with Pool \"%s\" and Media type \"%s\".\n\ Use \"mount\" to resume the job.\n"), jcr->Job, jcr->dev_name, jcr->pool_name, jcr->media_type); @@ -300,7 +304,7 @@ Use \"mount\" to resume the job.\n"), if (num_wait >= max_num_wait) { Mmsg(&dev->errmsg, _("Gave up waiting to mount Storage Device \"%s\" for Job %s\n"), jcr->dev_name, jcr->Job); - Jmsg(jcr, M_ERROR, 0, "%s", dev->errmsg); + Jmsg(jcr, M_FATAL, 0, "%s", dev->errmsg); Dmsg1(90, "Gave up waiting on device %s\n", dev->dev_name); return 0; /* exceeded maximum waits */ } @@ -309,7 +313,7 @@ Use \"mount\" to resume the job.\n"), if (stat == EINVAL) { Mmsg2(&dev->errmsg, _("pthread error in mount_next_volume stat=%d ERR=%s\n"), stat, strerror(stat)); - Jmsg(jcr, M_ERROR, 0, "%s", dev->errmsg); + Jmsg(jcr, M_FATAL, 0, "%s", dev->errmsg); return 0; } if (stat != 0) { @@ -325,7 +329,7 @@ Use \"mount\" to resume the job.\n"), if (jcr->VolumeName[0] == 0 && !dir_find_next_appendable_volume(jcr)) { Jmsg(jcr, M_MOUNT, 0, _( -"You woke me up, but I cannot find any appendable\n\ +"Someone woke me up, but I cannot find any appendable\n\ volumes for Job=%s.\n"), jcr->Job); continue; } @@ -422,7 +426,7 @@ int dir_ask_sysop_to_mount_volume(JCR *jcr, DEVICE *dev) if (num_wait >= max_num_wait) { Mmsg(&dev->errmsg, _("Gave up waiting to mount Storage Device \"%s\" for Job %s\n"), jcr->dev_name, jcr->Job); - Jmsg(jcr, M_ERROR, 0, "%s", dev->errmsg); + Jmsg(jcr, M_FATAL, 0, "%s", dev->errmsg); Dmsg1(90, "Gave up waiting on device %s\n", dev->dev_name); return 0; /* exceeded maximum waits */ } @@ -431,7 +435,7 @@ int dir_ask_sysop_to_mount_volume(JCR *jcr, DEVICE *dev) if (stat == EINVAL) { Mmsg2(&dev->errmsg, _("pthread error in mount_volume stat=%d ERR=%s\n"), stat, strerror(stat)); - Jmsg(jcr, M_ERROR, 0, "%s", dev->errmsg); + Jmsg(jcr, M_FATAL, 0, "%s", dev->errmsg); return 0; } if (stat != 0) { diff --git a/bacula/src/stored/bextract.c b/bacula/src/stored/bextract.c index 418a6e6c23..d6a4e5d907 100644 --- a/bacula/src/stored/bextract.c +++ b/bacula/src/stored/bextract.c @@ -91,7 +91,7 @@ int main (int argc, char *argv[]) case 'e': /* exclude list */ if ((fd = fopen(optarg, "r")) == NULL) { - Dmsg2(0, "Could not open exclude file: %s, ERR=%s\n", + Pmsg2(0, "Could not open exclude file: %s, ERR=%s\n", optarg, strerror(errno)); exit(1); } @@ -105,7 +105,7 @@ int main (int argc, char *argv[]) case 'i': /* include list */ if ((fd = fopen(optarg, "r")) == NULL) { - Dmsg2(0, "Could not open include file: %s, ERR=%s\n", + Pmsg2(0, "Could not open include file: %s, ERR=%s\n", optarg, strerror(errno)); exit(1); } @@ -128,7 +128,7 @@ int main (int argc, char *argv[]) argv += optind; if (argc != 2) { - Dmsg0(0, "Wrong number of arguments: \n"); + Pmsg0(0, "Wrong number of arguments: \n"); usage(); } if (!got_inc) { /* If no include file, */ @@ -270,7 +270,7 @@ static void do_extract(char *devname, char *where) if (dev->state & ST_EOF) { continue; /* try again */ } - Dmsg0(0, "Read Record got a bad record\n"); + Pmsg0(0, "Read Record got a bad record\n"); status_dev(dev, &status); Dmsg1(20, "Device status: %x\n", status); if (status & MT_EOD) @@ -430,7 +430,7 @@ static void do_extract(char *devname, char *where) } else { strcat(ofile, fname); } -/* Dmsg1(000, "Restoring: %s\n", ofile); */ +/* Pmsg1(000, "Restoring: %s\n", ofile); */ extract = create_file(jcr, fname, ofile, lname, type, &statp, &ofd); @@ -462,7 +462,7 @@ static void do_extract(char *devname, char *where) Dmsg2(100, "Write uncompressed %d bytes, total before write=%d\n", compress_len, total); if ((uLongf)write(ofd, compress_buf, (size_t)compress_len) != compress_len) { - Dmsg0(0, "===Write error===\n"); + Pmsg0(0, "===Write error===\n"); Emsg2(M_ERROR_TERM, 0, "Write error on %s: %s\n", ofile, strerror(errno)); } total += compress_len; @@ -486,7 +486,7 @@ static void do_extract(char *devname, char *where) extract = FALSE; set_statp(jcr, fname, ofile, lname, type, &statp); } else if (rec.Stream != STREAM_MD5_SIGNATURE) { - Dmsg2(0, "None of above!!! stream=%d data=%s\n", rec.Stream, rec.data); + Pmsg2(0, "None of above!!! stream=%d data=%s\n", rec.Stream, rec.data); } } diff --git a/bacula/src/stored/bls.c b/bacula/src/stored/bls.c index 5224a86e9d..26bd627065 100644 --- a/bacula/src/stored/bls.c +++ b/bacula/src/stored/bls.c @@ -96,7 +96,7 @@ int main (int argc, char *argv[]) case 'e': /* exclude list */ if ((fd = fopen(optarg, "r")) == NULL) { - Dmsg2(0, "Could not open exclude file: %s, ERR=%s\n", + Pmsg2(0, "Could not open exclude file: %s, ERR=%s\n", optarg, strerror(errno)); exit(1); } @@ -110,7 +110,7 @@ int main (int argc, char *argv[]) case 'i': /* include list */ if ((fd = fopen(optarg, "r")) == NULL) { - Dmsg2(0, "Could not open include file: %s, ERR=%s\n", + Pmsg2(0, "Could not open include file: %s, ERR=%s\n", optarg, strerror(errno)); exit(1); } @@ -148,7 +148,7 @@ int main (int argc, char *argv[]) argv += optind; if (!argc && !default_tape) { - Dmsg0(0, "No archive name specified\n"); + Pmsg0(0, "No archive name specified\n"); usage(); } @@ -305,7 +305,7 @@ static void do_blocks(char *infname) * If on second or subsequent volume, adjust buffer pointer */ if (dev->VolHdr.PrevVolName[0] != 0) { /* second volume */ - Dmsg1(0, "\n\ + Pmsg1(0, "\n\ Warning, this Volume is a continuation of Volume %s\n", dev->VolHdr.PrevVolName); } @@ -347,7 +347,7 @@ static void do_jobs(char *infname) * If on second or subsequent volume, adjust buffer pointer */ if (dev->VolHdr.PrevVolName[0] != 0) { /* second volume */ - Dmsg1(0, "\n\ + Pmsg1(0, "\n\ Warning, this Volume is a continuation of Volume %s\n", dev->VolHdr.PrevVolName); } @@ -418,7 +418,7 @@ static void do_ls(char *infname) * If on second or subsequent volume, adjust buffer pointer */ if (dev->VolHdr.PrevVolName[0] != 0) { /* second volume */ - Dmsg1(0, "\n\ + Pmsg1(0, "\n\ Warning, this Volume is a continuation of Volume %s\n", dev->VolHdr.PrevVolName); } diff --git a/bacula/src/stored/bscan.c b/bacula/src/stored/bscan.c index c8f26b3a34..6b9bcf45eb 100644 --- a/bacula/src/stored/bscan.c +++ b/bacula/src/stored/bscan.c @@ -82,7 +82,7 @@ int main (int argc, char *argv[]) argv += optind; if (argc != 1) { - Dmsg0(0, "Wrong number of arguments: \n"); + Pmsg0(0, "Wrong number of arguments: \n"); usage(); } @@ -170,7 +170,7 @@ static void do_scan(char *devname) if (dev->state & ST_EOF) { continue; /* try again */ } - Dmsg0(0, "Read Record got a bad record\n"); + Pmsg0(0, "Read Record got a bad record\n"); status_dev(dev, &status); Dmsg1(20, "Device status: %x\n", status); if (status & MT_EOD) @@ -206,56 +206,56 @@ static void do_scan(char *devname) } switch (rec.FileIndex) { case PRE_LABEL: - Dmsg0(000, "Volume is prelabeled. This tape cannot be scanned.\n"); + Pmsg0(000, "Volume is prelabeled. This tape cannot be scanned.\n"); return; break; case VOL_LABEL: unser_volume_label(dev, &rec); strcpy(mr.VolumeName, dev->VolHdr.VolName); if (!db_get_media_record(db, &mr)) { - Dmsg1(000, "VOL_LABEL: Media record not found for Volume: %s\n", + Pmsg1(000, "VOL_LABEL: Media record not found for Volume: %s\n", mr.VolumeName); continue; } if (strcmp(mr.MediaType, dev->VolHdr.MediaType) != 0) { - Dmsg2(000, "VOL_LABEL: MediaType mismatch. DB=%s Vol=%s\n", + Pmsg2(000, "VOL_LABEL: MediaType mismatch. DB=%s Vol=%s\n", mr.MediaType, dev->VolHdr.MediaType); continue; } strcpy(pr.Name, dev->VolHdr.PoolName); if (!db_get_pool_record(db, &pr)) { - Dmsg1(000, "VOL_LABEL: Pool record not found for Pool: %s\n", + Pmsg1(000, "VOL_LABEL: Pool record not found for Pool: %s\n", pr.Name); continue; } if (strcmp(pr.PoolType, dev->VolHdr.PoolType) != 0) { - Dmsg2(000, "VOL_LABEL: PoolType mismatch. DB=%s Vol=%s\n", + Pmsg2(000, "VOL_LABEL: PoolType mismatch. DB=%s Vol=%s\n", pr.PoolType, dev->VolHdr.PoolType); continue; } - Dmsg1(000, "VOL_LABEL: OK for Volume: %s\n", mr.VolumeName); + Pmsg1(000, "VOL_LABEL: OK for Volume: %s\n", mr.VolumeName); break; case SOS_LABEL: unser_session_label(&label, &rec); memset(&jr, 0, sizeof(jr)); jr.JobId = label.JobId; if (!db_get_job_record(db, &jr)) { - Dmsg1(000, "SOS_LABEL: Job record not found for JobId: %d\n", + Pmsg1(000, "SOS_LABEL: Job record not found for JobId: %d\n", jr.JobId); continue; } if (rec.VolSessionId != jr.VolSessionId) { - Dmsg2(000, "SOS_LABEL: VolSessId mismatch. DB=%d Vol=%d\n", + Pmsg2(000, "SOS_LABEL: VolSessId mismatch. DB=%d Vol=%d\n", jr.VolSessionId, rec.VolSessionId); continue; } if (rec.VolSessionTime != jr.VolSessionTime) { - Dmsg2(000, "SOS_LABEL: VolSessTime mismatch. DB=%d Vol=%d\n", + Pmsg2(000, "SOS_LABEL: VolSessTime mismatch. DB=%d Vol=%d\n", jr.VolSessionTime, rec.VolSessionTime); continue; } if (jr.PoolId != pr.PoolId) { - Dmsg2(000, "SOS_LABEL: PoolId mismatch. DB=%d Vol=%d\n", + Pmsg2(000, "SOS_LABEL: PoolId mismatch. DB=%d Vol=%d\n", jr.PoolId, pr.PoolId); continue; } @@ -263,21 +263,21 @@ static void do_scan(char *devname) case EOS_LABEL: unser_session_label(&elabel, &rec); if (elabel.JobId != label.JobId) { - Dmsg2(000, "EOS_LABEL: Start/End JobId mismatch. Start=%d End=%d\n", + Pmsg2(000, "EOS_LABEL: Start/End JobId mismatch. Start=%d End=%d\n", label.JobId, elabel.JobId); continue; } if (elabel.JobFiles != jr.JobFiles) { - Dmsg2(000, "EOS_LABEL: JobFiles mismatch. DB=%d EOS=%d\n", + Pmsg2(000, "EOS_LABEL: JobFiles mismatch. DB=%d EOS=%d\n", jr.JobFiles, elabel.JobFiles); continue; } if (elabel.JobBytes != jr.JobBytes) { - Dmsg2(000, "EOS_LABEL: JobBytes mismatch. DB=%d EOS=%d\n", + Pmsg2(000, "EOS_LABEL: JobBytes mismatch. DB=%d EOS=%d\n", jr.JobBytes, elabel.JobBytes); continue; } - Dmsg1(000, "EOS_LABEL: OK for JobId=%d\n", elabel.JobId); + Pmsg1(000, "EOS_LABEL: OK for JobId=%d\n", elabel.JobId); break; case EOM_LABEL: break; @@ -340,7 +340,7 @@ static void do_scan(char *devname) } else if (rec.Stream == STREAM_FILE_DATA) { } else if (rec.Stream != STREAM_MD5_SIGNATURE) { - Dmsg2(0, "None of above!!! stream=%d data=%s\n", rec.Stream, rec.data); + Pmsg2(0, "None of above!!! stream=%d data=%s\n", rec.Stream, rec.data); } } diff --git a/bacula/src/stored/bsr.h b/bacula/src/stored/bsr.h index 98228c906f..6154d79851 100644 --- a/bacula/src/stored/bsr.h +++ b/bacula/src/stored/bsr.h @@ -39,16 +39,17 @@ struct s_vol_list { struct s_vol_list *next; char VolumeName[MAX_NAME_LENGTH]; + int Slot; }; typedef struct s_vol_list VOL_LIST; /* * !!!!!!!!!!!!!!!!!! NOTE !!!!!!!!!!!!!!!!!!!!!!!!!!!!! - * !!! !!! - * !!! All records must have a pointer to !!! - * !!! the next item as the first item defined. !!! - * !!! !!! + * !!! !!! + * !!! All records must have a pointer to !!! + * !!! the next item as the first item defined. !!! + * !!! !!! * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */ @@ -72,15 +73,15 @@ typedef struct s_bsr_sesstime { typedef struct s_bsr_volfile { struct s_bsr_volfile *next; - uint32_t sfile; /* start file */ - uint32_t efile; /* end file */ + uint32_t sfile; /* start file */ + uint32_t efile; /* end file */ int found; } BSR_VOLFILE; typedef struct s_bsr_findex { struct s_bsr_findex *next; - int32_t findex; /* start file index */ - int32_t findex2; /* end file index */ + int32_t findex; /* start file index */ + int32_t findex2; /* end file index */ int found; } BSR_FINDEX; @@ -107,21 +108,28 @@ typedef struct s_bsr_job { int found; } BSR_JOB; +typedef struct s_bsr_stream { + struct s_bsr_stream *next; + int32_t stream; /* stream desired */ + int found; +} BSR_STREAM; typedef struct s_bsr { - struct s_bsr *next; /* pointer to next one */ - int done; /* set when everything found */ - char *VolumeName; - BSR_VOLFILE *volfile; + struct s_bsr *next; /* pointer to next one */ + int done; /* set when everything found */ + char *VolumeName; + int32_t Slot; /* Slot */ + BSR_VOLFILE *volfile; BSR_SESSTIME *sesstime; - BSR_SESSID *sessid; - BSR_JOBID *JobId; - BSR_JOB *job; - BSR_CLIENT *client; - BSR_FINDEX *FileIndex; - BSR_JOBTYPE *JobType; + BSR_SESSID *sessid; + BSR_JOBID *JobId; + BSR_JOB *job; + BSR_CLIENT *client; + BSR_FINDEX *FileIndex; + BSR_JOBTYPE *JobType; BSR_JOBLEVEL *JobLevel; - FF_PKT *ff; /* include/exclude */ + BSR_STREAM *stream; +// FF_PKT *ff; /* include/exclude */ } BSR; diff --git a/bacula/src/stored/btape.c b/bacula/src/stored/btape.c index 53cd5f8aa4..72a08ca96e 100644 --- a/bacula/src/stored/btape.c +++ b/bacula/src/stored/btape.c @@ -182,7 +182,7 @@ int main(int argc, char *argv[]) exit(1); } if (!open_device(dev)) { - Dmsg1(0, "Warning could not open device. ERR=%s", strerror_dev(dev)); + Pmsg1(0, "Warning could not open device. ERR=%s", strerror_dev(dev)); term_dev(dev); dev = NULL; } @@ -251,10 +251,10 @@ static void devicecmd() return; } if (!open_device(dev)) { - Dmsg1(0, "Device open failed. ERR=%s\n", strerror_dev(dev)); + Pmsg1(0, "Device open failed. ERR=%s\n", strerror_dev(dev)); } } else { - Dmsg0(0, "Device init failed.\n"); + Pmsg0(0, "Device init failed.\n"); } } @@ -267,7 +267,7 @@ static void labelcmd() int found = 0; if (!dev) { - Dmsg0(0, "No device: Use device command.\n"); + Pmsg0(0, "No device: Use device command.\n"); return; } @@ -283,7 +283,7 @@ static void labelcmd() } UnlockRes(); if (!found) { - Dmsg2(0, "Could not find device %s in %s\n", dev->dev_name, configfile); + Pmsg2(0, "Could not find device %s in %s\n", dev->dev_name, configfile); return; } @@ -293,7 +293,7 @@ static void labelcmd() if (!(dev->state & ST_OPENED)) { if (!open_device(dev)) { - Dmsg1(0, "Device open failed. ERR=%s\n", strerror_dev(dev)); + Pmsg1(0, "Device open failed. ERR=%s\n", strerror_dev(dev)); } } write_volume_label_to_dev(jcr, device, cmd, "Default"); @@ -309,35 +309,35 @@ static void readlabelcmd() DEV_BLOCK *block; if (!dev) { - Dmsg0(0, "No device: Use device command.\n"); + Pmsg0(0, "No device: Use device command.\n"); return; } block = new_block(dev); stat = read_dev_volume_label(jcr, dev, block); switch (stat) { case VOL_NO_LABEL: - Dmsg0(0, "Volume has no label.\n"); + Pmsg0(0, "Volume has no label.\n"); break; case VOL_OK: - Dmsg0(0, "Volume label read correctly.\n"); + Pmsg0(0, "Volume label read correctly.\n"); break; case VOL_IO_ERROR: - Dmsg1(0, "I/O error on device: ERR=%s", strerror_dev(dev)); + Pmsg1(0, "I/O error on device: ERR=%s", strerror_dev(dev)); break; case VOL_NAME_ERROR: - Dmsg0(0, "Volume name error\n"); + Pmsg0(0, "Volume name error\n"); break; case VOL_CREATE_ERROR: - Dmsg1(0, "Error creating label. ERR=%s", strerror_dev(dev)); + Pmsg1(0, "Error creating label. ERR=%s", strerror_dev(dev)); break; case VOL_VERSION_ERROR: - Dmsg0(0, "Volume version error.\n"); + Pmsg0(0, "Volume version error.\n"); break; case VOL_LABEL_ERROR: - Dmsg0(0, "Bad Volume label type.\n"); + Pmsg0(0, "Bad Volume label type.\n"); break; default: - Dmsg0(0, "Unknown error.\n"); + Pmsg0(0, "Unknown error.\n"); break; } @@ -370,10 +370,10 @@ static int find_device_res() } UnlockRes(); if (!found) { - Dmsg2(0, "Could not find device %s in %s\n", dev->dev_name, configfile); + Pmsg2(0, "Could not find device %s in %s\n", dev->dev_name, configfile); return 0; } - Dmsg1(0, "Using device: %s\n", dev->dev_name); + Pmsg1(0, "Using device: %s\n", dev->dev_name); return 1; } @@ -385,13 +385,13 @@ static void loadcmd() { if (!dev) { - Dmsg0(0, "No device: Use device command.\n"); + Pmsg0(0, "No device: Use device command.\n"); return; } if (!load_dev(dev)) { - Dmsg1(0, "Bad status from load. ERR=%s\n", strerror_dev(dev)); + Pmsg1(0, "Bad status from load. ERR=%s\n", strerror_dev(dev)); } else - Dmsg1(0, "Loaded %s\n", dev_name(dev)); + Pmsg1(0, "Loaded %s\n", dev_name(dev)); } /* @@ -400,14 +400,14 @@ static void loadcmd() static void rewindcmd() { if (!dev) { - Dmsg0(0, "No device: Use device command.\n"); + Pmsg0(0, "No device: Use device command.\n"); return; } if (!rewind_dev(dev)) { - Dmsg1(0, "Bad status from rewind. ERR=%s\n", strerror_dev(dev)); + Pmsg1(0, "Bad status from rewind. ERR=%s\n", strerror_dev(dev)); clrerror_dev(dev, -1); } else - Dmsg1(0, "Rewound %s\n", dev_name(dev)); + Pmsg1(0, "Rewound %s\n", dev_name(dev)); } /* @@ -416,7 +416,7 @@ static void rewindcmd() static void clearcmd() { if (!dev) { - Dmsg0(0, "No device: Use device command.\n"); + Pmsg0(0, "No device: Use device command.\n"); return; } clrerror_dev(dev, -1); @@ -430,14 +430,14 @@ static void weofcmd() int stat; if (!dev) { - Dmsg0(0, "No device: Use device command.\n"); + Pmsg0(0, "No device: Use device command.\n"); return; } if ((stat = weof_dev(dev, 1)) < 0) { - Dmsg2(0, "Bad status from weof %d. ERR=%s\n", stat, strerror_dev(dev)); + Pmsg2(0, "Bad status from weof %d. ERR=%s\n", stat, strerror_dev(dev)); return; } else { - Dmsg1(0, "Wrote EOF to %s\n", dev_name(dev)); + Pmsg1(0, "Wrote EOF to %s\n", dev_name(dev)); } } @@ -451,59 +451,59 @@ static void rawtestcmd() int i, j, k; if (!dev) { - Dmsg0(0, "No device: Use device command.\n"); + Pmsg0(0, "No device: Use device command.\n"); return; } if (!rewind_dev(dev)) { - Dmsg1(0, "Bad status from rewind. ERR=%s\n", strerror_dev(dev)); + Pmsg1(0, "Bad status from rewind. ERR=%s\n", strerror_dev(dev)); return; } - Dmsg0(0, "Rewound, now writing 100 blocks\n"); + Pmsg0(0, "Rewound, now writing 100 blocks\n"); for (i=0; i<100; i++) { j = 10000 + i; memset(buf, i, j); if (!write_dev(dev, buf, j)) { - Dmsg1(0, "Bad status from write. ERR=%s\n", strerror_dev(dev)); + Pmsg1(0, "Bad status from write. ERR=%s\n", strerror_dev(dev)); return; } - Dmsg2(10, "Wrote %d bytes of %d\n", j, i); + Pmsg2(10, "Wrote %d bytes of %d\n", j, i); } - Dmsg0(0, "100 Blocks written, flushing buffers and writing EOF\n"); + Pmsg0(0, "100 Blocks written, flushing buffers and writing EOF\n"); if (flush_dev(dev) != 0) { - Dmsg1(0, "Error writing flushing. ERR=%s\n", strerror(errno)); + Pmsg1(0, "Error writing flushing. ERR=%s\n", strerror(errno)); return; } if (weof_dev(dev, 1) != 0) { - Dmsg1(0, "Error writing eof. ERR=%s\n", strerror(errno)); + Pmsg1(0, "Error writing eof. ERR=%s\n", strerror(errno)); return; } - Dmsg0(0, "Rewinding ...\n"); + Pmsg0(0, "Rewinding ...\n"); if (!rewind_dev(dev)) { - Dmsg1(0, "Bad status from rewind. ERR=%s\n", strerror_dev(dev)); + Pmsg1(0, "Bad status from rewind. ERR=%s\n", strerror_dev(dev)); return; } - Dmsg0(0, "Read and verify data ...\n"); + Pmsg0(0, "Read and verify data ...\n"); for (i=0; i<100; i++) { j = 10000 + i; if (!read_dev(dev, buf, j)) { - Dmsg1(0, "Bad status from read. ERR=%s\n", strerror_dev(dev)); + Pmsg1(0, "Bad status from read. ERR=%s\n", strerror_dev(dev)); return; } for (k=0; kcapabilities & CAP_EOF ? "" : "!"); printf("%sBSR ", dev->capabilities & CAP_BSR ? "" : "!"); printf("%sBSF ", dev->capabilities & CAP_BSF ? "" : "!"); @@ -611,11 +611,11 @@ static void rectestcmd() int i, blkno = 0; if (!dev) { - Dmsg0(0, "No device: Use device command.\n"); + Pmsg0(0, "No device: Use device command.\n"); return; } - Dmsg0(0, "Test writting larger and larger records.\n\ + Pmsg0(0, "Test writting larger and larger records.\n\ This is a torture test for records. \n"); sm_check(__FILE__, __LINE__, False); @@ -630,7 +630,7 @@ This is a torture test for records. \n"); while (!write_record_to_block(block, rec)) { empty_block(block); blkno++; - Dmsg2(0, "Block %d i=%d\n", blkno, i); + Pmsg2(0, "Block %d i=%d\n", blkno, i); } sm_check(__FILE__, __LINE__, False); } @@ -646,10 +646,10 @@ This is a torture test for records. \n"); static void testcmd() { if (!dev) { - Dmsg0(0, "No device: Use device command.\n"); + Pmsg0(0, "No device: Use device command.\n"); return; } - Dmsg0(0, "Append files test.\n\n\ + Pmsg0(0, "Append files test.\n\n\ I'm going to write one record in file 0,\n\ two records in file 1,\n\ and three records in file 2\n\n"); @@ -665,22 +665,22 @@ I'm going to write one record in file 0,\n\ weofcmd(); /* end file 2 */ // weofcmd(); rewindcmd(); - Dmsg0(0, "Now moving to end of media.\n"); + Pmsg0(0, "Now moving to end of media.\n"); eodcmd(); - Dmsg2(0, "\nWe should be in file 3. I am at file %d. This is %s\n\n", + Pmsg2(0, "\nWe should be in file 3. I am at file %d. This is %s\n\n", dev->file, dev->file == 3 ? "correct!" : "NOT correct!!!!"); - Dmsg0(0, "\nNow I am going to attempt to append to the tape.\n"); + Pmsg0(0, "\nNow I am going to attempt to append to the tape.\n"); wrcmd(); weofcmd(); // weofcmd(); rewindcmd(); scancmd(); - Dmsg0(0, "The above scan should have four files of:\n\ + Pmsg0(0, "The above scan should have four files of:\n\ One record, two records, three records, and one record respectively.\n\n"); - Dmsg0(0, "Append block test.\n\n\ + Pmsg0(0, "Append block test.\n\n\ I'm going to write a block, an EOF, rewind, go to EOM,\n\ then backspace over the EOF and attempt to append a\ second block in the first file.\n\n"); @@ -690,17 +690,17 @@ second block in the first file.\n\n"); // weofcmd(); rewindcmd(); eodcmd(); - Dmsg2(0, "We should be at file 1. I am at EOM File=%d. This is %s\n", + Pmsg2(0, "We should be at file 1. I am at EOM File=%d. This is %s\n", dev->file, dev->file == 1 ? "correct!" : "NOT correct!!!!"); - Dmsg0(0, "Doing backspace file.\n"); + Pmsg0(0, "Doing backspace file.\n"); bsfcmd(); - Dmsg0(0, "Write second block, hoping to append to first file.\n"); + Pmsg0(0, "Write second block, hoping to append to first file.\n"); wrcmd(); weofcmd(); rewindcmd(); - Dmsg0(0, "Done writing, scanning results\n"); + Pmsg0(0, "Done writing, scanning results\n"); scancmd(); - Dmsg0(0, "The above should have one file of two blocks.\n"); + Pmsg0(0, "The above should have one file of two blocks.\n"); } @@ -708,28 +708,28 @@ static void fsfcmd() { int stat; if (!dev) { - Dmsg0(0, "No device: Use device command.\n"); + Pmsg0(0, "No device: Use device command.\n"); return; } if ((stat=fsf_dev(dev, 1)) < 0) { - Dmsg2(0, "Bad status from fsf %d. ERR=%s\n", stat, strerror_dev(dev)); + Pmsg2(0, "Bad status from fsf %d. ERR=%s\n", stat, strerror_dev(dev)); return; } - Dmsg0(0, "Forward spaced one file.\n"); + Pmsg0(0, "Forward spaced one file.\n"); } static void fsrcmd() { int stat; if (!dev) { - Dmsg0(0, "No device: Use device command.\n"); + Pmsg0(0, "No device: Use device command.\n"); return; } if ((stat=fsr_dev(dev, 1)) < 0) { - Dmsg2(0, "Bad status from fsr %d. ERR=%s\n", stat, strerror_dev(dev)); + Pmsg2(0, "Bad status from fsr %d. ERR=%s\n", stat, strerror_dev(dev)); return; } - Dmsg0(0, "Forward spaced one record.\n"); + Pmsg0(0, "Forward spaced one record.\n"); } static void rdcmd() @@ -738,14 +738,14 @@ static void rdcmd() int stat; if (!dev) { - Dmsg0(0, "No device: Use device command.\n"); + Pmsg0(0, "No device: Use device command.\n"); return; } if (!read_dev(dev, buf, 512*126)) { - Dmsg1(0, "Bad status from read. ERR=%s\n", strerror_dev(dev)); + Pmsg1(0, "Bad status from read. ERR=%s\n", strerror_dev(dev)); return; } - Dmsg1(10, "Read %d bytes\n", stat); + Pmsg1(10, "Read %d bytes\n", stat); #else printf("Rdcmd no longer implemented.\n"); #endif @@ -759,7 +759,7 @@ static void wrcmd() int i; if (!dev) { - Dmsg0(0, "No device: Use device command.\n"); + Pmsg0(0, "No device: Use device command.\n"); return; } sm_check(__FILE__, __LINE__, False); @@ -772,14 +772,14 @@ static void wrcmd() rec->data_len = i; sm_check(__FILE__, __LINE__, False); if (!write_record_to_block(block, rec)) { - Dmsg0(0, "Error writing record to block.\n"); + Pmsg0(0, "Error writing record to block.\n"); return; } if (!write_block_to_dev(dev, block)) { - Dmsg0(0, "Error writing block to device.\n"); + Pmsg0(0, "Error writing block to device.\n"); return; } else { - Dmsg1(0, "Wrote one record of %d bytes.\n", + Pmsg1(0, "Wrote one record of %d bytes.\n", ((i+TAPE_BSIZE-1)/TAPE_BSIZE) * TAPE_BSIZE); } @@ -787,7 +787,7 @@ static void wrcmd() free_record(rec); free_block(block); sm_check(__FILE__, __LINE__, False); - Dmsg0(0, "Wrote block to device.\n"); + Pmsg0(0, "Wrote block to device.\n"); } @@ -803,13 +803,13 @@ static void scancmd() uint64_t bytes; if (!dev) { - Dmsg0(0, "No device: Use device command.\n"); + Pmsg0(0, "No device: Use device command.\n"); return; } blocks = block_size = tot_blocks = 0; bytes = 0; if (dev->state & ST_EOT) { - Dmsg0(0, "End of tape\n"); + Pmsg0(0, "End of tape\n"); return; } update_pos_dev(dev); @@ -819,7 +819,7 @@ static void scancmd() clrerror_dev(dev, -1); Mmsg2(&dev->errmsg, "read error on %s. ERR=%s.\n", dev->dev_name, strerror(dev->dev_errno)); - Dmsg2(0, "Bad status from read %d. ERR=%s\n", stat, strerror_dev(dev)); + Pmsg2(0, "Bad status from read %d. ERR=%s\n", stat, strerror_dev(dev)); if (blocks > 0) printf("%d block%s of %d bytes in file %d\n", blocks, blocks>1?"s":"", block_size, dev->file); @@ -869,13 +869,13 @@ static void statcmd() uint32_t status; if (!dev) { - Dmsg0(0, "No device: Use device command.\n"); + Pmsg0(0, "No device: Use device command.\n"); return; } debug = debug_level; debug_level = 30; if (!status_dev(dev, &status)) { - Dmsg2(0, "Bad status from status %d. ERR=%s\n", stat, strerror_dev(dev)); + Pmsg2(0, "Bad status from status %d. ERR=%s\n", stat, strerror_dev(dev)); } #ifdef xxxx dump_volume_label(dev); @@ -897,68 +897,68 @@ static void appendcmd() DEV_BLOCK *block; if (!dev) { - Dmsg0(0, "No device: Use device command.\n"); + Pmsg0(0, "No device: Use device command.\n"); return; } block = new_block(dev); if (!ready_device_for_append(jcr, dev, block, VolName)) { - Dmsg0(0, "Cannot append, not a Bacula tape.\n"); + Pmsg0(0, "Cannot append, not a Bacula tape.\n"); return; } file = dev_file(dev); - Dmsg1(0, "Begin write test data in file %d\n", file); + Pmsg1(0, "Begin write test data in file %d\n", file); /* Write our test data */ for (i=0; i<100; i++) { j = 10000 + i; memset(buf, i, j); if (!write_dev(dev, buf, j)) { - Dmsg1(0, "Bad status from write. ERR=%s\n", strerror_dev(dev)); + Pmsg1(0, "Bad status from write. ERR=%s\n", strerror_dev(dev)); return; } - Dmsg2(10, "Wrote %d bytes of %d\n", j, i); + Pmsg2(10, "Wrote %d bytes of %d\n", j, i); } if (flush_dev(dev) != 0) { /* ensure written to tape */ - Dmsg1(0, "Flush error: %s\n", strerror(errno)); + Pmsg1(0, "Flush error: %s\n", strerror(errno)); } if (weof_dev(dev, 1) != 0) { - Dmsg1(0, "EOF error: %s\n", strerror(errno)); + Pmsg1(0, "EOF error: %s\n", strerror(errno)); } - Dmsg0(0, "Rewind and reread label\n"); + Pmsg0(0, "Rewind and reread label\n"); if (read_dev_volume_label(dev, VolName) != VOL_OK) { return; } if (file != 0) { - Dmsg1(0, "FSF %d files\n", file); + Pmsg1(0, "FSF %d files\n", file); fsf_dev(dev, file); } file = dev_file(dev); - Dmsg1(0, "Begin read/test from file %d\n", file); + Pmsg1(0, "Begin read/test from file %d\n", file); /* Now read our test data and make sure it is what we wrote */ for (i=0; i<100; i++) { j = 10000 + i; if (!read_dev(dev, buf, j)) { - Dmsg1(0, "Bad status from read. ERR=%s\n", strerror_dev(dev)); + Pmsg1(0, "Bad status from read. ERR=%s\n", strerror_dev(dev)); return; } for (k=0; kstate & ST_OPENED) { /* @@ -221,7 +221,7 @@ open_dev(DEVICE *dev, char *VolName, int mode) } Dmsg1(29, "open_dev: tape %d opened\n", dev->fd); } else { - archive_name = (char *) get_pool_memory(PM_FNAME); + archive_name = get_pool_memory(PM_FNAME); strcpy(archive_name, dev->dev_name); if (archive_name[strlen(archive_name)] != '/') { strcat(archive_name, "/"); @@ -264,7 +264,7 @@ int rewind_dev(DEVICE *dev) dev->dev_errno = EBADF; Mmsg1(&dev->errmsg, _("Bad call to rewind_dev. Device %s not open\n"), dev->dev_name); - Emsg0(M_ABORT, 0, dev->errmsg); + Emsg0(M_FATAL, 0, dev->errmsg); return 0; } dev->state &= ~(ST_APPEND|ST_READ|ST_EOT | ST_EOF | ST_WEOT); /* remove EOF/EOT flags */ @@ -969,6 +969,9 @@ close_dev(DEVICE *dev) dev->use_count--; } +/* + * Used when unmounting the device + */ void force_close_dev(DEVICE *dev) { if (!dev) { diff --git a/bacula/src/stored/dev.h b/bacula/src/stored/dev.h index f01b928f52..53aa0f736b 100644 --- a/bacula/src/stored/dev.h +++ b/bacula/src/stored/dev.h @@ -47,18 +47,20 @@ /* Bits for device capabilities */ -#define CAP_EOF 0x001 /* has MTWEOF */ -#define CAP_BSR 0x002 /* has MTBSR */ -#define CAP_BSF 0x004 /* has MTBSF */ -#define CAP_FSR 0x008 /* has MTFSR */ -#define CAP_FSF 0x010 /* has MTFSF */ -#define CAP_EOM 0x020 /* has MTEOM */ -#define CAP_REM 0x040 /* is removable media */ -#define CAP_RACCESS 0x080 /* is random access device */ -#define CAP_AUTOMOUNT 0x100 /* Read device at start to see what is there */ -#define CAP_LABEL 0x200 /* Label blank tapes */ -#define CAP_ANONVOLS 0x400 /* Mount without knowing volume name */ -#define CAP_ALWAYSOPEN 0x800 /* always keep device open */ +#define CAP_EOF 0x0001 /* has MTWEOF */ +#define CAP_BSR 0x0002 /* has MTBSR */ +#define CAP_BSF 0x0004 /* has MTBSF */ +#define CAP_FSR 0x0008 /* has MTFSR */ +#define CAP_FSF 0x0010 /* has MTFSF */ +#define CAP_EOM 0x0020 /* has MTEOM */ +#define CAP_REM 0x0040 /* is removable media */ +#define CAP_RACCESS 0x0080 /* is random access device */ +#define CAP_AUTOMOUNT 0x0100 /* Read device at start to see what is there */ +#define CAP_LABEL 0x0200 /* Label blank tapes */ +#define CAP_ANONVOLS 0x0400 /* Mount without knowing volume name */ +#define CAP_ALWAYSOPEN 0x0800 /* always keep device open */ +#define CAP_AUTOCHANGER 0x1000 /* AutoChanger */ +#define CAP_OFFLINEUNMOUNT 0x2000 /* Offline before unmount */ /* Tape state bits */ @@ -94,6 +96,7 @@ typedef struct s_volume_catalog_info { uint32_t VolCatWrites; /* Number of writes this volume */ uint32_t VolCatReads; /* Number of reads this volume */ uint32_t VolCatRecycles; /* Number of recycles this volume */ + int32_t Slot; /* Slot in changer */ uint64_t VolCatMaxBytes; /* max bytes to write */ uint64_t VolCatCapacityBytes; /* capacity estimate */ char VolCatStatus[20]; /* Volume status */ diff --git a/bacula/src/stored/device.c b/bacula/src/stored/device.c index 26038854ef..80e55fb1b4 100644 --- a/bacula/src/stored/device.c +++ b/bacula/src/stored/device.c @@ -307,7 +307,7 @@ static int ready_dev_for_append(JCR *jcr, DEVICE *dev, DEV_BLOCK *block) */ if (!dir_find_next_appendable_volume(jcr)) { if (!dir_ask_sysop_to_mount_next_volume(jcr, dev)) { - Jmsg1(jcr, M_ERROR, 0, _("Unable to mount desired Volume for device %s.\n"), + Jmsg1(jcr, M_FATAL, 0, _("Unable to mount desired Volume for device %s.\n"), dev_name(dev)); return 0; /* error return */ } @@ -369,7 +369,7 @@ mount_next_vol: Jmsg(jcr, M_WARNING, 0, "%s", jcr->errmsg); rewind_dev(dev); if (!dir_ask_sysop_to_mount_next_volume(jcr, dev)) { - Jmsg1(jcr, M_ERROR, 0, _("Unable to mount desired Volume for device %s.\n"), + Jmsg1(jcr, M_FATAL, 0, _("Unable to mount desired Volume for device %s.\n"), dev_name(dev)); return 0; /* error return */ } diff --git a/bacula/src/stored/dircmd.c b/bacula/src/stored/dircmd.c index 1d9a962772..a7511945cc 100644 --- a/bacula/src/stored/dircmd.c +++ b/bacula/src/stored/dircmd.c @@ -543,6 +543,9 @@ static int unmount_cmd(JCR *jcr) } else if (dev->dev_blocked == BST_WAITING_FOR_SYSOP) { Dmsg2(90, "%d waiter dev_block=%d. doing unmount\n", dev->num_waiting, dev->dev_blocked); + if (dev->capabilities & CAP_OFFLINEUNMOUNT) { + offline_dev(dev); + } force_close_dev(dev); dev->dev_blocked = BST_UNMOUNTED_WAITING_FOR_SYSOP; bnet_fsend(dir, _("3001 Device %s unmounted.\n"), dev_name(dev)); @@ -569,6 +572,9 @@ static int unmount_cmd(JCR *jcr) } else { /* device not being used */ Dmsg0(90, "Device not in use, unmounting\n"); block_device(dev, BST_UNMOUNTED); + if (dev->capabilities & CAP_OFFLINEUNMOUNT) { + offline_dev(dev); + } force_close_dev(dev); bnet_fsend(dir, _("3002 Device %s unmounted.\n"), dev_name(dev)); } diff --git a/bacula/src/stored/job.c b/bacula/src/stored/job.c index c462f58348..cd6e49693c 100644 --- a/bacula/src/stored/job.c +++ b/bacula/src/stored/job.c @@ -174,13 +174,13 @@ void connection_from_filed(void *arg) Dmsg0(200, "enter connection_from_filed\n"); if (bnet_recv(fd) <= 0) { - Emsg0(M_ERROR, 0, "Unable to authenticate Client.\n"); + Emsg0(M_FATAL, 0, _("Unable to authenticate Client.\n")); return; } Dmsg1(100, "got: %s\n", fd->msg); if (sscanf(fd->msg, "Hello Start Job %127s\n", job_name) != 1) { - Emsg1(M_ERROR, 0, _("Authentication failure: %s"), fd->msg); + Emsg1(M_FATAL, 0, _("Authentication failure: %s\n"), fd->msg); return; } handle_filed_connection(fd, job_name); @@ -192,7 +192,7 @@ void handle_filed_connection(BSOCK *fd, char *job_name) JCR *jcr; if (!(jcr=get_jcr_by_full_name(job_name))) { - Emsg1(M_ERROR, 0, "Job name not found: %s", job_name); + Emsg1(M_FATAL, 0, _("Job name not found: %s\n"), job_name); return; } @@ -201,7 +201,7 @@ void handle_filed_connection(BSOCK *fd, char *job_name) Dmsg1(100, "Found Job %s\n", job_name); if (jcr->authenticated) { - Dmsg2(000, "Hey!!!! JobId %d Job %s already authenticated.\n", + Pmsg2(000, "Hey!!!! JobId %d Job %s already authenticated.\n", jcr->JobId, jcr->Job); } @@ -285,7 +285,7 @@ static int use_device_cmd(JCR *jcr) dev_name); bnet_fsend(dir, NO_device, dev_name); } else { - Emsg1(M_FATAL, 0, _("storemsg); + Jmsg(jcr, M_FATAL, 0, _("storemsg); bnet_fsend(dir, BAD_use, dir->msg); } diff --git a/bacula/src/stored/label.c b/bacula/src/stored/label.c index ff9f5b05d2..d4d4a2ea39 100644 --- a/bacula/src/stored/label.c +++ b/bacula/src/stored/label.c @@ -235,7 +235,7 @@ int write_volume_label_to_block(JCR *jcr, DEVICE *dev, DEV_BLOCK *block) empty_block(block); /* Volume label always at beginning */ if (!write_record_to_block(block, &rec)) { free_pool_memory(rec.data); - Emsg1(M_ERROR, 0, _("Cannot write Volume label to block for device %s\n"), + Jmsg1(jcr, M_FATAL, 0, _("Cannot write Volume label to block for device %s\n"), dev_name(dev)); return 0; } else { @@ -475,7 +475,7 @@ int write_session_label(JCR *jcr, DEV_BLOCK *block, int label) jcr->end_file = dev->file; break; default: - Emsg1(M_ABORT, 0, _("Bad session label = %d\n"), label); + Jmsg1(jcr, M_ABORT, 0, _("Bad session label = %d\n"), label); break; } create_session_label(jcr, rec, label); @@ -535,7 +535,7 @@ void dump_volume_label(DEVICE *dev) dbl = debug_level; debug_level = 1; - Dmsg11(-1, "\nVolume Label:\n\ + Pmsg11(-1, "\nVolume Label:\n\ Id : %s\ VerNo : %d\n\ VolName : %s\n\ @@ -557,7 +557,7 @@ HostName : %s\n\ dt.julian_day_number = dev->VolHdr.label_date; dt.julian_day_fraction = dev->VolHdr.label_time; tm_decode(&dt, &tm); - Dmsg5(-1, "\ + Pmsg5(-1, "\ Date label written: %04d-%02d-%02d at %02d:%02d\n", tm.tm_year+1900, tm.tm_mon+1, tm.tm_mday, tm.tm_hour, tm.tm_min); debug_level = dbl; @@ -608,7 +608,7 @@ static void dump_session_label(DEV_RECORD *rec, char *type) unser_session_label(&label, rec); dbl = debug_level; debug_level = 1; - Dmsg6(-1, "\n%s Record:\n\ + Pmsg6(-1, "\n%s Record:\n\ JobId : %d\n\ PoolName : %s\n\ PoolType : %s\n\ @@ -619,7 +619,7 @@ ClientName : %s\n\ label.JobName, label.ClientName); if (label.VerNum >= 10) { - Dmsg4(-1, "\ + Pmsg4(-1, "\ Job (unique name) : %s\n\ FileSet : %s\n\ JobType : %c\n\ @@ -628,7 +628,7 @@ JobLevel : %c\n\ } if (rec->FileIndex == EOS_LABEL) { - Dmsg7(-1, "\ + Pmsg7(-1, "\ JobFiles : %s\n\ JobBytes : %s\n\ StartBlock : %s\n\ @@ -648,7 +648,7 @@ JobErrors : %s\n\ dt.julian_day_number = label.write_date; dt.julian_day_fraction = label.write_time; tm_decode(&dt, &tm); - Dmsg5(-1, "\ + Pmsg5(-1, "\ Date written : %04d-%02d-%02d at %02d:%02d\n", tm.tm_year+1900, tm.tm_mon+1, tm.tm_mday, tm.tm_hour, tm.tm_min); @@ -696,16 +696,16 @@ void dump_label_record(DEVICE *dev, DEV_RECORD *rec, int verbose) dump_session_label(rec, type); break; case EOM_LABEL: - Dmsg5(-1, "%s Record: VSessId=%d VSessTime=%d JobId=%d DataLen=%d\n", + Pmsg5(-1, "%s Record: VSessId=%d VSessTime=%d JobId=%d DataLen=%d\n", type, rec->VolSessionId, rec->VolSessionTime, rec->Stream, rec->data_len); break; default: - Dmsg5(-1, "%s Record: VSessId=%d VSessTime=%d JobId=%d DataLen=%d\n", + Pmsg5(-1, "%s Record: VSessId=%d VSessTime=%d JobId=%d DataLen=%d\n", type, rec->VolSessionId, rec->VolSessionTime, rec->Stream, rec->data_len); break; } } else { - Dmsg5(-1, "%s Record: VSessId=%d VSessTime=%d JobId=%d DataLen=%d\n", + Pmsg5(-1, "%s Record: VSessId=%d VSessTime=%d JobId=%d DataLen=%d\n", type, rec->VolSessionId, rec->VolSessionTime, rec->Stream, rec->data_len); } debug_level = dbl; diff --git a/bacula/src/stored/match_bsr.c b/bacula/src/stored/match_bsr.c index 21d5a19420..ad869bdffe 100755 --- a/bacula/src/stored/match_bsr.c +++ b/bacula/src/stored/match_bsr.c @@ -41,6 +41,7 @@ static int match_job_level(BSR_JOBLEVEL *job_level, SESSION_LABEL *sessrec); static int match_jobid(BSR_JOBID *jobid, SESSION_LABEL *sessrec); static int match_findex(BSR_FINDEX *findex, DEV_RECORD *rec); static int match_volfile(BSR_VOLFILE *volfile, DEV_RECORD *rec); +static int match_stream(BSR_STREAM *stream, DEV_RECORD *rec); static int match_one_bsr(BSR *bsr, DEV_RECORD *rec, VOLUME_LABEL *volrec, SESSION_LABEL *sessrec); /********************************************************************* @@ -91,6 +92,9 @@ static int match_one_bsr(BSR *bsr, DEV_RECORD *rec, VOLUME_LABEL *volrec, SESSIO if (!match_job_level(bsr->JobLevel, sessrec)) { return 0; } + if (!match_stream(bsr->stream, rec)) { + return 0; + } return 1; } @@ -183,6 +187,19 @@ static int match_volfile(BSR_VOLFILE *volfile, DEV_RECORD *rec) return 0; } +static int match_stream(BSR_STREAM *stream, DEV_RECORD *rec) +{ + if (!stream) { + return 1; /* no specification matches all */ + } + if (stream->stream == rec->Stream) { + return 1; + } + if (stream->next) { + return match_stream(stream->next, rec); + } + return 0; +} static int match_findex(BSR_FINDEX *findex, DEV_RECORD *rec) { diff --git a/bacula/src/stored/parse_bsr.c b/bacula/src/stored/parse_bsr.c index 522b19b05a..1d5ba45a25 100755 --- a/bacula/src/stored/parse_bsr.c +++ b/bacula/src/stored/parse_bsr.c @@ -43,6 +43,8 @@ static BSR *store_volfile(LEX *lc, BSR *bsr); static BSR *store_sesstime(LEX *lc, BSR *bsr); static BSR *store_include(LEX *lc, BSR *bsr); static BSR *store_exclude(LEX *lc, BSR *bsr); +static BSR *store_stream(LEX *lc, BSR *bsr); +static BSR *store_slot(LEX *lc, BSR *bsr); struct kw_items { char *name; @@ -62,6 +64,8 @@ struct kw_items items[] = { {"include", store_include}, {"exclude", store_exclude}, {"volfile", store_volfile}, + {"stream", store_stream}, + {"slot", store_slot}, {NULL, NULL} }; @@ -405,6 +409,51 @@ static BSR *store_sesstime(LEX *lc, BSR *bsr) return bsr; } + +static BSR *store_stream(LEX *lc, BSR *bsr) +{ + int token; + BSR_STREAM *stream; + + for (;;) { + token = lex_get_token(lc, T_INT32); + if (token == T_ERROR) { + return NULL; + } + stream = (BSR_STREAM *)malloc(sizeof(BSR_STREAM)); + memset(stream, 0, sizeof(BSR_STREAM)); + stream->stream = lc->int32_val; + /* Add it to the end of the chain */ + if (!bsr->stream) { + bsr->stream = stream; + } else { + /* Add to end of chain */ + BSR_STREAM *bs = bsr->stream; + for ( ;bs->next; bs=bs->next) + { } + bs->next = stream; + } + token = lex_get_token(lc, T_ALL); + if (token != T_COMMA) { + break; + } + } + return bsr; +} + +static BSR *store_slot(LEX *lc, BSR *bsr) +{ + int token; + + token = lex_get_token(lc, T_PINT32); + if (token == T_ERROR) { + return NULL; + } + bsr->Slot = lc->pint32_val; + scan_to_eol(lc); + return bsr; +} + static BSR *store_include(LEX *lc, BSR *bsr) { scan_to_eol(lc); diff --git a/bacula/src/stored/read.c b/bacula/src/stored/read.c index baf57f549d..f298a53322 100644 --- a/bacula/src/stored/read.c +++ b/bacula/src/stored/read.c @@ -131,7 +131,7 @@ int do_read_data(JCR *jcr) Dmsg1(000, "There is another volume %s.\n", jcr->VolumeName); dev->state &= ~ST_READ; if (!acquire_device_for_read(jcr, dev, block)) { - Emsg2(M_ERROR, 0, "Cannot open Dev=%s, Vol=%s\n", dev_name(dev), jcr->VolumeName); + Jmsg(jcr, M_FATAL, 0, _("Cannot open Dev=%s, Vol=%s\n"), dev_name(dev), jcr->VolumeName); ok = FALSE; break; } @@ -150,7 +150,7 @@ int do_read_data(JCR *jcr) continue; /* End of File */ } - Jmsg2(jcr, M_FATAL, 0, "Read error on Record Header %s ERR=%s\n", dev_name(dev), strerror(errno)); + Jmsg2(jcr, M_FATAL, 0, _("Read error on Record Header %s ERR=%s\n"), dev_name(dev), strerror(errno)); ok = FALSE; break; } diff --git a/bacula/src/stored/stored.c b/bacula/src/stored/stored.c index 568ad16e73..4259baa282 100644 --- a/bacula/src/stored/stored.c +++ b/bacula/src/stored/stored.c @@ -249,6 +249,9 @@ int main (int argc, char *argv[]) UnlockRes(); device = NULL; + set_thread_concurrency(me->max_concurrent_jobs * 2 + + 4 /* watch dog + servers + misc */); + start_watchdog(); /* start watchdog thread */ /* @@ -256,10 +259,10 @@ int main (int argc, char *argv[]) */ if (me->SDDport == 0 || me->SDDport == me->SDport) { /* Single server used for Director and File daemon */ - bnet_thread_server(me->SDport, 20, &dird_workq, connection_request); + bnet_thread_server(me->SDport, me->max_concurrent_jobs * 2, + &dird_workq, connection_request); } else { /* Start the Director server */ - set_thread_concurrency(10); if ((status=pthread_create(&dirid, NULL, director_thread, (void *)me->SDport)) != 0) { Emsg1(M_ABORT, 0, _("Cannot create Director thread: %s\n"), strerror(status)); diff --git a/bacula/src/stored/stored_conf.c b/bacula/src/stored/stored_conf.c index c034df374a..3020ea4f76 100644 --- a/bacula/src/stored/stored_conf.c +++ b/bacula/src/stored/stored_conf.c @@ -93,6 +93,8 @@ static struct res_items dev_items[] = { {"labelmedia", store_yesno, ITEM(res_dev.cap_bits), CAP_LABEL, ITEM_DEFAULT, 0}, {"mountanonymousvolumes", store_yesno, ITEM(res_dev.cap_bits), CAP_ANONVOLS, ITEM_DEFAULT, 0}, {"alwaysopen", store_yesno, ITEM(res_dev.cap_bits), CAP_ALWAYSOPEN, ITEM_DEFAULT, 1}, + {"autochanger", store_yesno, ITEM(res_dev.cap_bits), CAP_AUTOCHANGER, ITEM_DEFAULT, 0}, + {"offlineonunmount", store_yesno, ITEM(res_dev.cap_bits), CAP_OFFLINEUNMOUNT, ITEM_DEFAULT, 1}, {"maximumrewindwait", store_pint, ITEM(res_dev.max_rewind_wait), 0, ITEM_DEFAULT, 5 * 60}, {"minimumblocksize", store_pint, ITEM(res_dev.min_block_size), 0, 0, 0}, {"maximumblocksize", store_pint, ITEM(res_dev.max_block_size), 0, 0, 0}, @@ -114,7 +116,7 @@ struct s_res resources[] = { {"storage", store_items, R_STORAGE, NULL}, {"device", dev_items, R_DEVICE, NULL}, {"messages", msgs_items, R_MSGS, NULL}, - {NULL, NULL, 0, NULL} + {NULL, NULL, 0, NULL} }; @@ -130,81 +132,81 @@ void dump_resource(int type, RES *reshdr, void sendit(void *sock, char *fmt, ... return; } sendit(sock, "dump_resource type=%d\n", type); - if (type < 0) { /* no recursion */ + if (type < 0) { /* no recursion */ type = - type; recurse = 0; } switch (type) { case R_DIRECTOR: sendit(sock, "Director: name=%s\n", res->res_dir.hdr.name); - break; + break; case R_STORAGE: sendit(sock, "Storage: name=%s address=%s SDport=%d SDDport=%d\n", - res->res_store.hdr.name, res->res_store.address, - res->res_store.SDport, res->res_store.SDDport); - break; + res->res_store.hdr.name, res->res_store.address, + res->res_store.SDport, res->res_store.SDDport); + break; case R_DEVICE: sendit(sock, "Device: name=%s MediaType=%s Device=%s\n", - res->res_dev.hdr.name, - res->res_dev.media_type, res->res_dev.device_name); + res->res_dev.hdr.name, + res->res_dev.media_type, res->res_dev.device_name); sendit(sock, " rew_wait=%d min_bs=%d max_bs=%d\n", - res->res_dev.max_rewind_wait, res->res_dev.min_block_size, - res->res_dev.max_block_size); + res->res_dev.max_rewind_wait, res->res_dev.min_block_size, + res->res_dev.max_block_size); sendit(sock, " max_jobs=%d max_files=%" lld " max_size=%" lld "\n", - res->res_dev.max_volume_jobs, res->res_dev.max_volume_files, - res->res_dev.max_volume_size); + res->res_dev.max_volume_jobs, res->res_dev.max_volume_files, + res->res_dev.max_volume_size); sendit(sock, " max_file_size=%" lld " capacity=%" lld "\n", - res->res_dev.max_file_size, res->res_dev.volume_capacity); + res->res_dev.max_file_size, res->res_dev.volume_capacity); strcpy(buf, " "); - if (res->res_dev.cap_bits & CAP_EOF) { + if (res->res_dev.cap_bits & CAP_EOF) { strcat(buf, "CAP_EOF "); - } - if (res->res_dev.cap_bits & CAP_BSR) { + } + if (res->res_dev.cap_bits & CAP_BSR) { strcat(buf, "CAP_BSR "); - } - if (res->res_dev.cap_bits & CAP_BSF) { + } + if (res->res_dev.cap_bits & CAP_BSF) { strcat(buf, "CAP_BSF "); - } - if (res->res_dev.cap_bits & CAP_FSR) { + } + if (res->res_dev.cap_bits & CAP_FSR) { strcat(buf, "CAP_FSR "); - } - if (res->res_dev.cap_bits & CAP_FSF) { + } + if (res->res_dev.cap_bits & CAP_FSF) { strcat(buf, "CAP_FSF "); - } - if (res->res_dev.cap_bits & CAP_EOM) { + } + if (res->res_dev.cap_bits & CAP_EOM) { strcat(buf, "CAP_EOM "); - } - if (res->res_dev.cap_bits & CAP_REM) { + } + if (res->res_dev.cap_bits & CAP_REM) { strcat(buf, "CAP_REM "); - } - if (res->res_dev.cap_bits & CAP_RACCESS) { + } + if (res->res_dev.cap_bits & CAP_RACCESS) { strcat(buf, "CAP_RACCESS "); - } - if (res->res_dev.cap_bits & CAP_AUTOMOUNT) { + } + if (res->res_dev.cap_bits & CAP_AUTOMOUNT) { strcat(buf, "CAP_AUTOMOUNT "); - } - if (res->res_dev.cap_bits & CAP_LABEL) { + } + if (res->res_dev.cap_bits & CAP_LABEL) { strcat(buf, "CAP_LABEL "); - } - if (res->res_dev.cap_bits & CAP_ANONVOLS) { + } + if (res->res_dev.cap_bits & CAP_ANONVOLS) { strcat(buf, "CAP_ANONVOLS "); - } - if (res->res_dev.cap_bits & CAP_ALWAYSOPEN) { + } + if (res->res_dev.cap_bits & CAP_ALWAYSOPEN) { strcat(buf, "CAP_ALWAYSOPEN "); - } + } strcat(buf, "\n"); - sendit(sock, buf); - break; + sendit(sock, buf); + break; case R_MSGS: sendit(sock, "Messages: name=%s\n", res->res_msgs.hdr.name); - if (res->res_msgs.mail_cmd) + if (res->res_msgs.mail_cmd) sendit(sock, " mailcmd=%s\n", res->res_msgs.mail_cmd); - if (res->res_msgs.operator_cmd) + if (res->res_msgs.operator_cmd) sendit(sock, " opcmd=%s\n", res->res_msgs.operator_cmd); - break; + break; default: sendit(sock, _("Warning: unknown resource type %d\n"), type); - break; + break; } if (recurse && res->res_dir.hdr.next) dump_resource(type, (RES *)res->res_dir.hdr.next, sendit, sock); @@ -234,38 +236,38 @@ void free_resource(int type) switch (type) { case R_DIRECTOR: - if (res->res_dir.password) - free(res->res_dir.password); - if (res->res_dir.address) - free(res->res_dir.address); - break; + if (res->res_dir.password) + free(res->res_dir.password); + if (res->res_dir.address) + free(res->res_dir.address); + break; case R_STORAGE: - if (res->res_store.address) - free(res->res_store.address); - if (res->res_store.working_directory) - free(res->res_store.working_directory); - if (res->res_store.pid_directory) - free(res->res_store.pid_directory); - if (res->res_store.subsys_directory) - free(res->res_store.subsys_directory); - break; + if (res->res_store.address) + free(res->res_store.address); + if (res->res_store.working_directory) + free(res->res_store.working_directory); + if (res->res_store.pid_directory) + free(res->res_store.pid_directory); + if (res->res_store.subsys_directory) + free(res->res_store.subsys_directory); + break; case R_DEVICE: - if (res->res_dev.media_type) - free(res->res_dev.media_type); - if (res->res_dev.device_name) - free(res->res_dev.device_name); - break; + if (res->res_dev.media_type) + free(res->res_dev.media_type); + if (res->res_dev.device_name) + free(res->res_dev.device_name); + break; case R_MSGS: - if (res->res_msgs.mail_cmd) - free(res->res_msgs.mail_cmd); - if (res->res_msgs.operator_cmd) - free(res->res_msgs.operator_cmd); - free_msgs_res((MSGS *)res); /* free message resource */ - res = NULL; - break; + if (res->res_msgs.mail_cmd) + free(res->res_msgs.mail_cmd); + if (res->res_msgs.operator_cmd) + free(res->res_msgs.operator_cmd); + free_msgs_res((MSGS *)res); /* free message resource */ + res = NULL; + break; default: Dmsg1(0, "Unknown resource type %d\n", type); - break; + break; } /* Common stuff again -- free the resource, recurse to next one */ if (res) { @@ -293,10 +295,10 @@ void save_resource(int type, struct res_items *items, int pass) */ for (i=0; items[i].name; i++) { if (items[i].flags & ITEM_REQUIRED) { - if (!bit_is_set(i, res_all.res_dir.hdr.item_present)) { + if (!bit_is_set(i, res_all.res_dir.hdr.item_present)) { Emsg2(M_ABORT, 0, _("%s item is required in %s resource, but not found.\n"), - items[i].name, resources[rindex]); - } + items[i].name, resources[rindex]); + } } /* If this triggers, take a look at lib/parse_conf.h */ if (i >= MAX_RES_ITEMS) { @@ -311,33 +313,33 @@ void save_resource(int type, struct res_items *items, int pass) */ if (pass == 2) { switch (type) { - /* Resources not containing a resource */ - case R_DIRECTOR: - case R_DEVICE: - case R_MSGS: - break; - - /* Resources containing a resource */ - case R_STORAGE: - if ((res = (URES *)GetResWithName(R_STORAGE, res_all.res_dir.hdr.name)) == NULL) { + /* Resources not containing a resource */ + case R_DIRECTOR: + case R_DEVICE: + case R_MSGS: + break; + + /* Resources containing a resource */ + case R_STORAGE: + if ((res = (URES *)GetResWithName(R_STORAGE, res_all.res_dir.hdr.name)) == NULL) { Emsg1(M_ABORT, 0, "Cannot find Storage resource %s\n", res_all.res_dir.hdr.name); - } - res->res_store.messages = res_all.res_store.messages; - break; - default: + } + res->res_store.messages = res_all.res_store.messages; + break; + default: printf("Unknown resource type %d\n", type); - error = 1; - break; + error = 1; + break; } if (res_all.res_dir.hdr.name) { - free(res_all.res_dir.hdr.name); - res_all.res_dir.hdr.name = NULL; + free(res_all.res_dir.hdr.name); + res_all.res_dir.hdr.name = NULL; } if (res_all.res_dir.hdr.desc) { - free(res_all.res_dir.hdr.desc); - res_all.res_dir.hdr.desc = NULL; + free(res_all.res_dir.hdr.desc); + res_all.res_dir.hdr.desc = NULL; } return; } @@ -345,36 +347,36 @@ void save_resource(int type, struct res_items *items, int pass) /* The following code is only executed on pass 1 */ switch (type) { case R_DIRECTOR: - size = sizeof(DIRRES); - break; + size = sizeof(DIRRES); + break; case R_STORAGE: - size = sizeof(STORES); - break; + size = sizeof(STORES); + break; case R_DEVICE: - size = sizeof(DEVRES); - break; + size = sizeof(DEVRES); + break; case R_MSGS: - size = sizeof(MSGS); - break; + size = sizeof(MSGS); + break; default: printf("Unknown resource type %d\n", type); - error = 1; - break; + error = 1; + break; } /* Common */ if (!error) { res = (URES *)malloc(size); memcpy(res, &res_all, size); if (!resources[rindex].res_head) { - resources[rindex].res_head = (RES *)res; /* store first entry */ + resources[rindex].res_head = (RES *)res; /* store first entry */ } else { - RES *next; - /* Add new res to end of chain */ - for (next=resources[rindex].res_head; next->next; next=next->next) - { } - next->next = (RES *)res; + RES *next; + /* Add new res to end of chain */ + for (next=resources[rindex].res_head; next->next; next=next->next) + { } + next->next = (RES *)res; Dmsg2(90, "Inserting %s res: %s\n", res_to_str(type), - res->res_dir.hdr.name); + res->res_dir.hdr.name); } } } diff --git a/bacula/src/version.h b/bacula/src/version.h index bbf8577b62..fbb6563d8c 100644 --- a/bacula/src/version.h +++ b/bacula/src/version.h @@ -1,5 +1,5 @@ /* */ -#define VERSION "1.22" +#define VERSION "1.23" #define VSTRING "1" #define DATE "7 July 2002" #define LSMDATE "07Jul02" -- 2.39.5