dnl AC_PATH_PROG(RANLIB, ranlib, ranlib)
AC_PATH_PROG(OPENSSL, openssl, none)
AC_PATH_PROG(MTX, mtx, mtx)
+AC_PATH_PROG(DF, df, df)
AC_PATH_PROG(MKISOFS, mkisofs, mkisofs)
AC_PATH_PROG(PYTHON, python, python)
AC_PATH_PROG(GROWISOFS, growisofs, growisofs)
# include <unistd.h>
#endif"
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS BUILD_DIR TRUEPRG FALSEPRG VERSION DATE LSMDATE CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CXX CXXFLAGS ac_ct_CXX CPP EGREP INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA RANLIB ac_ct_RANLIB MV RM CP SED ECHO CMP TBL AR OPENSSL MTX MKISOFS PYTHON GROWISOFS DVDRWMEDIAINFO PKGCONFIG WXCONFIG WXFLAGS CDRECORD PIDOF AWK ARFLAGS MAKE_SHELL LOCAL_LIBS LOCAL_CFLAGS LOCAL_LDFLAGS LOCAL_DEFS build build_cpu build_vendor build_os host host_cpu host_vendor host_os HAVE_SUN_OS_TRUE HAVE_SUN_OS_FALSE HAVE_OSF1_OS_TRUE HAVE_OSF1_OS_FALSE HAVE_AIX_OS_TRUE HAVE_AIX_OS_FALSE HAVE_HPUX_OS_TRUE HAVE_HPUX_OS_FALSE HAVE_LINUX_OS_TRUE HAVE_LINUX_OS_FALSE HAVE_FREEBSD_OS_TRUE HAVE_FREEBSD_OS_FALSE HAVE_NETBSD_OS_TRUE HAVE_NETBSD_OS_FALSE HAVE_OPENBSD_OS_TRUE HAVE_OPENBSD_OS_FALSE HAVE_BSDI_OS_TRUE HAVE_BSDI_OS_FALSE HAVE_SGI_OS_TRUE HAVE_SGI_OS_FALSE HAVE_IRIX_OS_TRUE HAVE_IRIX_OS_FALSE HAVE_DARWIN_OS_TRUE HAVE_DARWIN_OS_FALSE INSIDE_GNOME_COMMON_TRUE INSIDE_GNOME_COMMON_FALSE MSGFMT GNOME_INCLUDEDIR GNOMEUI_LIBS GNOME_LIBDIR GNOME_LIBS GNOME_DIR WXCONS_CPPFLAGS WXCONS_LDFLAGS WX_DIR TRAY_MONITOR_CPPFLAGS TRAY_MONITOR_LDFLAGS TRAY_MONITOR_DIR TTOOL_LDFLAGS STATIC_FD STATIC_SD STATIC_DIR STATIC_CONS STATIC_GNOME_CONS STATIC_WX_CONS ALL_DIRS CONS_INC CONS_OBJ CONS_SRC CONS_LIBS CONS_LDFLAGS READLINE_SRC PYTHON_LIBS PYTHON_INCDIR OPENSSL_LIBS OPENSSL_INC working_dir scriptdir dump_email job_email smtp_host piddir subsysdir baseport dir_port fd_port sd_port dir_password fd_password sd_password mon_dir_password mon_fd_password mon_sd_password dir_user dir_group sd_user sd_group fd_user fd_group SBINPERM SQL_LFLAGS SQL_INCLUDE SQL_BINDIR cats DB_NAME GETCONF ac_ct_GETCONF X_CFLAGS X_PRE_LIBS X_LIBS X_EXTRA_LIBS LIBOBJS ALLOCA FDLIBS DEBUG DINCLUDE DLIB DB_LIBS WCFLAGS WLDFLAGS OBJLIST hostname TAPEDRIVE PSCMD WIN32 MACOSX DISTNAME DISTVER LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS BUILD_DIR TRUEPRG FALSEPRG VERSION DATE LSMDATE CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CXX CXXFLAGS ac_ct_CXX CPP EGREP INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA RANLIB ac_ct_RANLIB MV RM CP SED ECHO CMP TBL AR OPENSSL MTX DF MKISOFS PYTHON GROWISOFS DVDRWMEDIAINFO PKGCONFIG WXCONFIG WXFLAGS CDRECORD PIDOF AWK ARFLAGS MAKE_SHELL LOCAL_LIBS LOCAL_CFLAGS LOCAL_LDFLAGS LOCAL_DEFS build build_cpu build_vendor build_os host host_cpu host_vendor host_os HAVE_SUN_OS_TRUE HAVE_SUN_OS_FALSE HAVE_OSF1_OS_TRUE HAVE_OSF1_OS_FALSE HAVE_AIX_OS_TRUE HAVE_AIX_OS_FALSE HAVE_HPUX_OS_TRUE HAVE_HPUX_OS_FALSE HAVE_LINUX_OS_TRUE HAVE_LINUX_OS_FALSE HAVE_FREEBSD_OS_TRUE HAVE_FREEBSD_OS_FALSE HAVE_NETBSD_OS_TRUE HAVE_NETBSD_OS_FALSE HAVE_OPENBSD_OS_TRUE HAVE_OPENBSD_OS_FALSE HAVE_BSDI_OS_TRUE HAVE_BSDI_OS_FALSE HAVE_SGI_OS_TRUE HAVE_SGI_OS_FALSE HAVE_IRIX_OS_TRUE HAVE_IRIX_OS_FALSE HAVE_DARWIN_OS_TRUE HAVE_DARWIN_OS_FALSE INSIDE_GNOME_COMMON_TRUE INSIDE_GNOME_COMMON_FALSE MSGFMT GNOME_INCLUDEDIR GNOMEUI_LIBS GNOME_LIBDIR GNOME_LIBS GNOME_DIR WXCONS_CPPFLAGS WXCONS_LDFLAGS WX_DIR TRAY_MONITOR_CPPFLAGS TRAY_MONITOR_LDFLAGS TRAY_MONITOR_DIR TTOOL_LDFLAGS STATIC_FD STATIC_SD STATIC_DIR STATIC_CONS STATIC_GNOME_CONS STATIC_WX_CONS ALL_DIRS CONS_INC CONS_OBJ CONS_SRC CONS_LIBS CONS_LDFLAGS READLINE_SRC PYTHON_LIBS PYTHON_INCDIR OPENSSL_LIBS OPENSSL_INC working_dir scriptdir dump_email job_email smtp_host piddir subsysdir baseport dir_port fd_port sd_port dir_password fd_password sd_password mon_dir_password mon_fd_password mon_sd_password dir_user dir_group sd_user sd_group fd_user fd_group SBINPERM SQL_LFLAGS SQL_INCLUDE SQL_BINDIR cats DB_NAME GETCONF ac_ct_GETCONF X_CFLAGS X_PRE_LIBS X_LIBS X_EXTRA_LIBS LIBOBJS ALLOCA FDLIBS DEBUG DINCLUDE DLIB DB_LIBS WCFLAGS WLDFLAGS OBJLIST hostname TAPEDRIVE PSCMD WIN32 MACOSX DISTNAME DISTVER LTLIBOBJS'
ac_subst_files='MCOMMON'
# Initialize some variables set by options.
echo "${ECHO_T}no" >&6
fi
+# Extract the first word of "df", so it can be a program name with args.
+set dummy df; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_path_DF+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ case $DF in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_DF="$DF" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_path_DF="$as_dir/$ac_word$ac_exec_ext"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+ test -z "$ac_cv_path_DF" && ac_cv_path_DF="df"
+ ;;
+esac
+fi
+DF=$ac_cv_path_DF
+
+if test -n "$DF"; then
+ echo "$as_me:$LINENO: result: $DF" >&5
+echo "${ECHO_T}$DF" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
# Extract the first word of "mkisofs", so it can be a program name with args.
set dummy mkisofs; ac_word=$2
echo "$as_me:$LINENO: checking for $ac_word" >&5
if test "x$dir_password" = "x" ; then
if test "x$OPENSSL" = "xnone" ; then
-# key=`date | uuencode /dev/stdout | tr "\"@\\\`\\ \\=\\,\\(\\)\\#\\.\\!\\-$'" abcdefghijklmnopqrst | awk '{getline} {print} {exit}'`
key=`autoconf/randpass 33`
else
key=`openssl rand -base64 33`
if test "x$fd_password" = "x" ; then
if test "x$OPENSSL" = "xnone" ; then
-# key=`date | uuencode /dev/stdout | tr "\"@\\\`\\ \\=\\,\\(\\)\\#\\.\\!\\-$'" tsrqponmlkjihgfedcba | awk '{getline} {print} {exit}'`
key=`autoconf/randpass 37`
else
key=`openssl rand -base64 33`
if test "x$sd_password" = "x" ; then
if test "x$OPENSSL" = "xnone" ; then
-# key=`date | uuencode /dev/stdout | tr "\"@\\\`\\ \\=\\,\\(\\)\\#\\.\\!\\-$'" 123456789uvwxyzabcdef | awk '{getline} {print} {exit}'`
key=`autoconf/randpass 41`
else
key=`openssl rand -base64 33`
if test "x$mon_dir_password" = "x" ; then
if test "x$OPENSSL" = "xnone" ; then
-# key=`date | uuencode /dev/stdout | tr "\"@\\\`\\ \\=\\,\\(\\)\\#\\.\\!\\-$'" abcdefghijklmnopqrst | awk '{getline} {print} {exit}'`
key=`autoconf/randpass 33`
else
key=`openssl rand -base64 33`
if test "x$mon_fd_password" = "x" ; then
if test "x$OPENSSL" = "xnone" ; then
-# key=`date | uuencode /dev/stdout | tr "\"@\\\`\\ \\=\\,\\(\\)\\#\\.\\!\\-$'" tsrqponmlkjihgfedcba | awk '{getline} {print} {exit}'`
key=`autoconf/randpass 37`
else
key=`openssl rand -base64 33`
if test "x$mon_sd_password" = "x" ; then
if test "x$OPENSSL" = "xnone" ; then
-# key=`date | uuencode /dev/stdout | tr "\"@\\\`\\ \\=\\,\\(\\)\\#\\.\\!\\-$'" 123456789uvwxyzabcdef | awk '{getline} {print} {exit}'`
key=`autoconf/randpass 41`
else
key=`openssl rand -base64 33`
s,@AR@,$AR,;t t
s,@OPENSSL@,$OPENSSL,;t t
s,@MTX@,$MTX,;t t
+s,@DF@,$DF,;t t
s,@MKISOFS@,$MKISOFS,;t t
s,@PYTHON@,$PYTHON,;t t
s,@GROWISOFS@,$GROWISOFS,;t t
Kern's ToDo List
- 18 July 2005
+ 20 July 2005
Major development:
Project Developer
- Test TLS.
Document:
-- Document cleaning up the spool files.
+- Document cleaning up the spool files:
+ db, pid, state, bsr, mail, conmsg, spool
- Add better documentation on how restores can be done
-- Document details of ANSI/IBM labels
-- Document that Bootstrap files can be written with cataloging
- turned off.
-- Pruning with Admin job.
-- OS linux 2.4
- 1) ADIC, DLT, FastStor 4000, 7*20GB
- 2) Sun, DDS, (Suns name unknown - Archive Python DDS drive), 1.2GB
- 3) Wangtek, QIC, 6525ES, 525MB (fixed block size 1k, block size etc.
- driver dependent - aic7xxx works, ncr53c8xx with problems)
- 4) HP, DDS-2, C1553A, 6*4GB
-- Doc the following
- to activate, check or disable the hardware compression feature on my
- exb-8900 i use the exabyte "MammothTool" you can get it here:
- http://www.exabyte.com/support/online/downloads/index.cfm
- There is a solaris version of this tool. With option -C 0 or 1 you can
- disable or activate compression. Start this tool without any options for
- a small reference.
-- Linux Sony LIB-D81, AIT-3 library works.
-- Document PostgreSQL performance problems bug 131.
-- Document testing
-- Document that ChangerDevice is used for Alert command.
-- Document new CDROM directory.
-- Document Heartbeat Interval in the dealing with firewalls section.
- Document the multiple-drive-changer.txt script.
-- On Win32 working directory must have drive letter ????
-- On Win32 working directory must be writable by SYSTEM to
- do restores.
-- Clean up working extensions: db, pid, state, bsr, mail, conmsg, spool
+- Pruning with Admin job.
For 1.39:
+- Fix bpipe.c so that it does not modify results pointer.
+ ***FIXME*** calling sequence should be changed.
1.xx Major Projects:
#3 Migration (Move, Copy, Archive Jobs)
#7 Single Job Writing to Multiple Storage Devices
- Reserve blocks other restore jobs when first cannot connect
- to SD -- no way to cancel in SD if Dir job canceled.
+ to SD.
- Add true/false to conf same as yes/no
- For Windows disaster recovery see http://unattended.sf.net/
- regardless of the retention period, Bacula will not prune the
Make sure this information is stored on the tape too so
that it can be restored directly from the tape.
+
+ Comments from Martin Simmons (I think they are all covered):
+ Ok, that should cover the basics. There are few issues though:
+
+ - Restore will depend on the catalog. I think it is better to include the
+ extra data in the backup as well, so it can be seen by bscan and bextract.
+
+ - I'm not sure if it will preserve multiple hard links to the same inode. Or
+ maybe adding or removing links will cause the data to be dumped again?
+
+ - I'm not sure if it will handle renamed directories. Possibly it will work
+ by dumping the whole tree under a renamed directory?
+
+ - It remains to be seen how the backup performance of the DIR's will be
+ affected when comparing the catalog for a large filesystem.
+
=====
Regression tests:
- bsr-opt-test fails. bsr deleted. Fix.
- Move Python daemon variables from Job to Bacula object.
WorkingDir, ConfigFile
+- Document that Bootstrap files can be written with cataloging
+ turned off.
+- Document details of ANSI/IBM labels
+- OS linux 2.4
+ 1) ADIC, DLT, FastStor 4000, 7*20GB
+- Linux Sony LIB-D81, AIT-3 library works.
+- Doc the following
+ to activate, check or disable the hardware compression feature on my
+ exb-8900 i use the exabyte "MammothTool" you can get it here:
+ http://www.exabyte.com/support/online/downloads/index.cfm
+ There is a solaris version of this tool. With option -C 0 or 1 you can
+ disable or activate compression. Start this tool without any options for
+ a small reference.
+- Document Heartbeat Interval in the dealing with firewalls section.
+- Document new CDROM directory.
+- On Win32 working directory must have drive letter ????
+- On Win32 working directory must be writable by SYSTEM to
+ do restores.
+- Document that ChangerDevice is used for Alert command.
General:
Changes to 1.37.31:
+22Jul05
+- Add check for df path for dvd_freespace
+- Use df to get space used on DVD.
+- Change sense of flag indicating erase DVD or not before writing.
+- Fix bpipe so that it never modifies the result pointer.
+- Replace more dev_name by print_name().
+- Rewrite edit_device_codes_dev() so it does not overwrite the
+ supplied buffer.
+- Update printing of labels (for bls) so that critical information
+ is printed (Job name and timestamp).
+- Cleanup old spool files when starting the SD.
+- Modify vss.cpp to allow C: as a path name. Otherwise VSS
+ doesn't work when only a drive name is given.
+- Modify vss.c to eliminate double / in filenames.
+- Update doc -- particularly the restore chapter.
18Jul05
- Make all files in working directory have .xxx at end.
- Work on DVD writing.
# Should always exit with 0 status, otherwise it indicates a serious error.
# (wrong number of arguments, Python exception...)
#
-# called: dvd-freespace <dvd-device-name> <part-number>
+# called: dvd-freespace <dvd-device-name>
#
#
# returns:
# $Id$
# Configurable values:
-mkisofs="@MKISOFS@"
-growisofs="@GROWISOFS@"
+df="@DF@"
dvdrwmediainfo="@DVDRWMEDIAINFO@"
margin=10485760 # 10 mb security margin
-growisofsparams=""
-
-# Uncomment the following line if you have a Linux kernel >=2.6.8, and
-# if you want to allow a session to start behind the 4gb boundary.
-#growisofsparams = growisofsparams + " -use-the-force-luke=4gms"
# end of configurable values
import errno
import sys
-if len(sys.argv) != 3:
- print "Wrong number of argument."
+if len(sys.argv) < 2:
+ print "Wrong number of arguments."
sys.exit(1)
device=sys.argv[1]
-part_num=int(sys.argv[2])
-
-os.environ["MKISOFS"] = mkisofs
def gettotalsize():
cmd=dvdrwmediainfo + " " + device
print "Cannot get media lead-out index from " + dvdrwmediainfo
sys.exit(0)
-if part_num == 0:
- flag = "-Z"
-else:
- flag = "-M"
-# the growisofs at the end is a dummy
-cmd=growisofs + " " + growisofsparams + " -use-the-force-luke=tty -dry-run -quiet " + flag + " " + device + " -R " + growisofs
+cmd=df + " " + device
process = popen2.Popen4(cmd)
status = process.wait()
if not os.WIFEXITED(status):
print -errno.EPIPE
- print growisofs + " process did not not exit correctly."
+ print df + " process did not not exit correctly."
sys.exit(0)
exitstat = os.WEXITSTATUS(status) & ~0x80
print -exitstat
print os.strerror(exitstat)
sys.exit(0)
+size = 0
while 1:
result = process.fromchild.readline()
if not result:
print -errno.EPIPE
- print "Cannot find the seek argument in the output from " + growisofs
+ print "Cannot get output from " + df
sys.exit(0)
- index = result.find("seek=")
- if index > -1:
- res = result[index+5:-2]
+ index = result.find(device)
+ if index > -1:
+ while result[index] != ' ':
+ index += 1
+ while result[index] == ' ':
+ index += 1
+ eindex = index;
+ while result[eindex] != ' ':
+ eindex += 1
+ res = result[index:eindex]
if not res.isdigit():
- print -errno.EPIPE
- print "Wrong seek argument in the output from " + growisofs
+ print -errno.EPIPE;
+ print "Could not find size in df output"
sys.exit(0)
- size = long(res)*32*1024
- size = gettotalsize()-(size+margin)
- if size < 0:
- size = 0
- print size
- print "No error occurred"
- sys.exit(0)
+ size = long(res)*1024
+ break
+
+size = gettotalsize()-(size+margin)
+if size < 0:
+ size = 0
+print size
+print "No error occurred"
+sys.exit(0)
# Write Part Command = "path-to-this-script/dvd-writepart %n %a %v"
# you will have the following input to this script:
#
-# dvd-writepart "part_number" "device" "part_filename"
-# $1 $2 $3
+# dvd-writepart "erase" "device" "part_filename"
+# $1 $2 $3
#
# for example:
#
fi
# Setup arguments
-partnum=$1
+erase=$1
dev=$2
filename=$3
-if test $partnum = 1 ; then
+if test $erase = 1 ; then
arg="-Z"
else
arg="-M"
*
* Version $Id$
*/
-
/*
- Copyright (C) 2002-2004 Kern Sibbald and John Walker
+ Copyright (C) 2002-2005 Kern Sibbald
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.
+ modify it under the terms of the GNU General Public License
+ version 2 as amended with additional clauses defined in the
+ file LICENSE in the main source directory.
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.
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ the file LICENSE for additional details.
*/
+
#include "bacula.h"
#include "jcr.h"
int stat1, stat2;
char *mode;
- if (results) {
- results[0] = 0;
- }
mode = (char *)(results != NULL ? "r" : "");
bpipe = open_bpipe(prog, wait, mode);
if (!bpipe) {
return ENOENT;
}
if (results) {
- fgets(results, sizeof_pool_memory(results), bpipe->rfd);
+ results[0] = 0;
+ int len = sizeof_pool_memory(results) - 1;
+ fgets(results, len, bpipe->rfd);
+ results[len] = 0;
if (feof(bpipe->rfd)) {
stat1 = 0;
} else {
return run_program(prog, wait, NULL);
}
+ sm_check(__FILE__, __LINE__, false);
+
tmp = get_pool_memory(PM_MESSAGE);
mode = (char *)"r";
bpipe = open_bpipe(prog, wait, mode);
if (!bpipe) {
+ if (results) {
+ results[0] = 0;
+ }
return ENOENT;
}
- results[0] = 0;
-
+ sm_check(__FILE__, __LINE__, false);
+ tmp[0] = 0;
while (1) {
- tmp[0] = 0;
- fgets(tmp, sizeof_pool_memory(tmp), bpipe->rfd);
- Dmsg1(800, "Run program fgets=%s", tmp);
- /* ***FIXME****
- * we need to pass POOL_MEM &results as arg to ensure
- * that change in address of results is passed back
- */
- // pm_strcat(results, tmp);
- bstrncat(results, tmp, sizeof_pool_memory(results));
+ char buf[1000];
+ fgets(buf, sizeof(buf), bpipe->rfd);
+ pm_strcat(tmp, buf);
if (feof(bpipe->rfd)) {
stat1 = 0;
Dmsg1(900, "Run program fgets stat=%d\n", stat1);
Dmsg1(900, "Run program fgets stat=%d\n", stat1);
}
}
-
+ int len = sizeof_pool_memory(results) - 1;
+ bstrncpy(results, tmp, len);
+ Dmsg3(1900, "resadr=0x%x reslen=%d res=%s\n", results, strlen(results), results);
stat2 = close_bpipe(bpipe);
stat1 = stat2 != 0 ? stat2 : stat1;
# MountCommand = "/bin/mount -t iso9660 -o ro %a %m";
# UnmountCommand = "/bin/umount %m";
# SpoolDirectory = /tmp/backup;
-# WritePartCommand = "/etc/bacula/dvd-writepart %n %a %v"
-# FreeSpaceCommand = "/etc/bacula/dvd-freespace %a %n"
+# WritePartCommand = "/etc/bacula/dvd-writepart %e %a %v"
+# FreeSpaceCommand = "/etc/bacula/dvd-freespace %a %e"
#}
#
#define O_NONBLOCK 0
#endif
-/* Functions in dvd.c */
-void update_free_space_dev(DEVICE* dev);
-
-
/* Forward referenced functions */
void set_os_device_parameters(DEVICE *dev);
static bool dev_get_os_pos(DEVICE *dev, struct mtget *mt_stat);
}
Dmsg4(29, "open dev: tape=%d dev_name=%s vol=%s mode=%s\n", is_tape(),
- dev_name, VolCatInfo.VolCatName, mode_to_str(omode));
+ print_name(), VolCatInfo.VolCatName, mode_to_str(omode));
state &= ~(ST_LABEL|ST_APPEND|ST_READ|ST_EOT|ST_WEOT|ST_EOF);
label_type = B_BACULA_LABEL;
if (is_tape() || is_fifo()) {
}
}
}
- Dmsg4(29, "open dev: DVD fd=%d opened, part=%d nump=%d, part_size=%u\n",
- fd, part, num_parts, part_size);
- if (is_open() && (omode != OPEN_READ_ONLY) &&
- (free_space_errno == 0 || num_parts == part)) {
- update_free_space_dev(this);
- }
}
#include "stored.h"
/* Forward referenced functions */
-static char *edit_device_codes_dev(DEVICE *dev, char *omsg, const char *imsg);
+static void edit_device_codes_dev(DEVICE *dev, POOL_MEM &omsg, const char *imsg);
static bool do_mount_dev(DEVICE* dev, int mount, int dotimeout);
static void add_file_and_part_name(DEVICE *dev, POOL_MEM &archive_name);
char *icmd;
int status, timeout;
+ sm_check(__FILE__, __LINE__, false);
if (mount) {
if (dev->is_mounted()) {
+ Dmsg0(200, "======= DVD mount=1\n");
return true;
}
icmd = dev->device->mount_command;
} else {
if (!dev->is_mounted()) {
+ Dmsg0(200, "======= DVD mount=0\n");
return true;
}
icmd = dev->device->unmount_command;
}
- edit_device_codes_dev(dev, ocmd.c_str(), icmd);
+ edit_device_codes_dev(dev, ocmd, icmd);
Dmsg2(200, "do_mount_dev: cmd=%s mounted=%d\n", ocmd.c_str(), !!dev->is_mounted());
if (!(dp = opendir(dev->device->mount_point))) {
berrno be;
dev->dev_errno = errno;
- Dmsg3(29, "open_mounted_dev: failed to open dir %s (dev=%s), ERR=%s\n", dev->device->mount_point, dev->dev_name, be.strerror());
+ Dmsg3(29, "open_mounted_dev: failed to open dir %s (dev=%s), ERR=%s\n",
+ dev->device->mount_point, dev->print_name(), be.strerror());
goto get_out;
}
while (1) {
if ((readdir_r(dp, entry, &result) != 0) || (result == NULL)) {
dev->dev_errno = ENOENT;
- Dmsg2(29, "open_mounted_dev: failed to find suitable file in dir %s (dev=%s)\n", dev->device->mount_point, dev->dev_name);
+ Dmsg2(29, "open_mounted_dev: failed to find suitable file in dir %s (dev=%s)\n",
+ dev->device->mount_point, dev->print_name());
break;
}
count++;
break; /* there must be something mounted */
}
get_out:
+ dev->set_mounted(false);
+ sm_check(__FILE__, __LINE__, false);
free_pool_memory(results);
+ Dmsg0(200, "============ DVD mount=0\n");
return false;
}
dev->set_mounted(mount); /* set/clear mounted flag */
free_pool_memory(results);
+ update_free_space_dev(dev);
+ Dmsg1(200, "============ DVD mount=%d\n", mount);
return true;
}
long long int free;
char ed1[50];
+ sm_check(__FILE__, __LINE__, false);
icmd = dev->device->free_space_command;
if (!icmd) {
return;
}
- edit_device_codes_dev(dev, ocmd.c_str(), icmd);
+ edit_device_codes_dev(dev, ocmd, icmd);
Dmsg1(29, "update_free_space_dev: cmd=%s\n", ocmd.c_str());
results = get_pool_memory(PM_MESSAGE);
- results[0] = 0;
/* Try at most 3 times to get the free space on the device. This should perhaps be configurable. */
timeout = 3;
if (--timeout > 0) {
Dmsg4(40, "Cannot get free space on device %s. free_space=%s, "
- "free_space_errno=%d ERR=%s\n", dev->dev_name,
+ "free_space_errno=%d ERR=%s\n", dev->print_name(),
edit_uint64(dev->free_space, ed1), dev->free_space_errno,
dev->errmsg);
bmicrosleep(1, 0);
dev->dev_errno = -dev->free_space_errno;
Dmsg4(40, "Cannot get free space on device %s. free_space=%s, "
"free_space_errno=%d ERR=%s\n",
- dev->dev_name, edit_uint64(dev->free_space, ed1),
+ dev->print_name(), edit_uint64(dev->free_space, ed1),
dev->free_space_errno, dev->errmsg);
break;
}
free_pool_memory(results);
Dmsg3(29, "update_free_space_dev: free_space=%s, free_space_errno=%d have_media=%d\n",
edit_uint64(dev->free_space, ed1), dev->free_space_errno, dev->have_media());
+ sm_check(__FILE__, __LINE__, false);
return;
}
static bool dvd_write_part(DCR *dcr)
{
DEVICE *dev = dcr->dev;
- Dmsg1(29, "dvd_write_part: device is %s\n", dev->print_name());
-
- if (!unmount_dev(dev, 1)) {
- Dmsg0(29, "dvd_write_part: unable to unmount the device\n");
- }
-
POOL_MEM ocmd(PM_FNAME);
- POOL_MEM results(PM_MESSAGE);
char* icmd;
int status;
int timeout;
- int part;
char ed1[50];
- results.c_str()[0] = 0;
+ sm_check(__FILE__, __LINE__, false);
+ Dmsg1(29, "dvd_write_part: device is %s\n", dev->print_name());
icmd = dev->device->write_part_command;
- /*
- * Note! part is used to control whether or not we create a
- * new filesystem. If the device could be mounted, it is because
- * it already has a filesystem, so we artificially set part=1
- * to avoid zapping an existing filesystem.
- */
- part = dev->part;
- if (dev->is_mounted() && dev->part < 2) {
- dev->part = 2; /* do not wipe out existing filesystem */
- }
- edit_device_codes_dev(dev, ocmd.c_str(), icmd);
- dev->part = part;
+ edit_device_codes_dev(dev, ocmd, icmd);
/*
* Wait at most the time a maximum size part is written in DVD 0.5x speed
Dmsg2(29, "dvd_write_part: cmd=%s timeout=%d\n", ocmd.c_str(), timeout);
+{
+ POOL_MEM results(PM_MESSAGE);
+ sm_check(__FILE__, __LINE__, false);
status = run_program_full_output(ocmd.c_str(), timeout, results.c_str());
+ sm_check(__FILE__, __LINE__, false);
if (status != 0) {
Mmsg1(dev->errmsg, "Error while writing current part to the DVD: %s",
results.c_str());
dev->dev_errno = EIO;
return false;
}
+ sm_check(__FILE__, __LINE__, false);
+}
+{
POOL_MEM archive_name(PM_FNAME);
/* Delete spool file */
make_spooled_dvd_filename(dev, archive_name);
unlink(archive_name.c_str());
Dmsg1(29, "unlink(%s)\n", archive_name.c_str());
+ sm_check(__FILE__, __LINE__, false);
+}
update_free_space_dev(dev);
Jmsg(dcr->jcr, M_INFO, 0, _("Remaining free space %s on %s\n"),
edit_uint64_with_commas(dev->free_space, ed1), dev->print_name());
+ sm_check(__FILE__, __LINE__, false);
return true;
}
return -1;
}
+ Dmsg2(100, "Set npart=%d to part=%d\n", dev->num_parts, dev->part);
dev->num_parts = dev->part;
dev->VolCatInfo.VolCatParts = dev->part;
make_spooled_dvd_filename(dev, archive_name); /* makes spool name */
}
}
if (dev->num_parts < dev->part) {
+ Dmsg2(100, "Set npart=%d to part=%d\n", dev->num_parts, dev->part);
dev->num_parts = dev->part;
dev->VolCatInfo.VolCatParts = dev->part;
}
{
DEVICE *dev = dcr->dev;
- Dmsg3(29, "Enter: ==== open_first_part dev=%s Vol=%s mode=%d\n", dev->dev_name,
+ Dmsg3(29, "Enter: ==== open_first_part dev=%s Vol=%s mode=%d\n", dev->print_name(),
dev->VolCatInfo.VolCatName, dev->openmode);
if (dev->fd >= 0) {
* Edit codes into (Un)MountCommand, Write(First)PartCommand
* %% = %
* %a = archive device name
+ * %e = erase (set if cannot mount and first part)
* %m = mount point
* %v = last part name
*
* imsg = input string containing edit codes (%x)
*
*/
-static char *edit_device_codes_dev(DEVICE* dev, char *omsg, const char *imsg)
+static void edit_device_codes_dev(DEVICE* dev, POOL_MEM &omsg, const char *imsg)
{
const char *p;
const char *str;
POOL_MEM archive_name(PM_FNAME);
- *omsg = 0;
+ omsg.c_str()[0] = 0;
Dmsg1(800, "edit_device_codes: %s\n", imsg);
for (p=imsg; *p; p++) {
if (*p == '%') {
case '%':
str = "%";
break;
+ case 'a':
+ str = dev->dev_name;
+ break;
+ case 'e':
+ if (dev->part == 1 && !dev->is_mounted()) {
+ str = "1";
+ } else {
+ str = "0";
+ }
+ break;
case 'n':
bsnprintf(add, sizeof(add), "%d", dev->part);
str = add;
break;
- case 'a':
- str = dev->dev_name;
- break;
case 'm':
str = dev->device->mount_point;
break;
str = add;
}
Dmsg1(1900, "add_str %s\n", str);
- pm_strcat(&omsg, (char *)str);
- Dmsg1(1800, "omsg=%s\n", omsg);
+ pm_strcat(omsg, (char *)str);
+ Dmsg1(1800, "omsg=%s\n", omsg.c_str());
}
- return omsg;
}
}
} else {
SESSION_LABEL label;
+ char dt[50];
switch (rec->FileIndex) {
case SOS_LABEL:
unser_session_label(&label, rec);
- Pmsg8(-1, "%s Record: File:blk=%u:%u SessId=%d SessTime=%d JobId=%d Level=%c Type=%c\n",
- type, dev->file, dev->block_num, rec->VolSessionId, rec->VolSessionTime, rec->Stream,
- label.JobLevel, label.JobType);
+ bstrftimes(dt, sizeof(dt), btime_to_unix(label.write_btime));
+ Pmsg6(-1, "%s Record: File:blk=%u:%u SessId=%d SessTime=%d JobId=%d\n",
+ type, dev->file, dev->block_num, rec->VolSessionId, rec->VolSessionTime, label.JobId);
+ Pmsg4(-1, " Job=%s Date=%s Level=%c Type=%c\n",
+ label.Job, dt, label.JobLevel, label.JobType);
break;
case EOS_LABEL:
char ed1[30], ed2[30];
unser_session_label(&label, rec);
- Pmsg8(-1, "%s Record: File:blk=%u:%u SessId=%d SessTime=%d JobId=%d Level=%c Type=%c\n",
- type, dev->file, dev->block_num, rec->VolSessionId, rec->VolSessionTime, rec->Stream,
- label.JobLevel, label.JobType);
- Pmsg4(-1, " Files=%s Bytes=%s Errors=%d Status=%c\n",
+ bstrftimes(dt, sizeof(dt), btime_to_unix(label.write_btime));
+ Pmsg6(-1, "%s Record: File:blk=%u:%u SessId=%d SessTime=%d JobId=%d\n",
+ type, dev->file, dev->block_num, rec->VolSessionId, rec->VolSessionTime, label.JobId);
+ Pmsg7(-1, " Date=%s Level=%c Type=%c Files=%s Bytes=%s Errors=%d Status=%c\n",
+ dt, label.JobLevel, label.JobType,
edit_uint64_with_commas(label.JobFiles, ed1),
edit_uint64_with_commas(label.JobBytes, ed2),
label.JobErrors, (char)label.JobStatus);
/* Forward referenced functions */
void terminate_stored(int sig);
static int check_resources();
+static void cleanup_old_files();
extern "C" void *device_initialization(void *arg);
drop(uid, gid);
+ cleanup_old_files();
+
+
/* Ensure that Volume Session Time and Id are both
* set and are both non-zero.
*/
return OK;
}
+static void cleanup_old_files()
+{
+ POOLMEM *cleanup = get_pool_memory(PM_MESSAGE);
+ int len = strlen(me->working_directory);
+ pm_strcpy(cleanup, "/bin/rm -f ");
+ pm_strcat(cleanup, me->working_directory);
+ if (len > 0 && me->working_directory[len-1] != '/') {
+ pm_strcat(cleanup, "/");
+ }
+ pm_strcat(cleanup, my_name);
+ pm_strcat(cleanup, "*.spool");
+ run_program(cleanup, 0, NULL);
+ free_pool_memory(cleanup);
+}
+
+
/*
* Here we attempt to init and open each device. This is done
* once at startup in a separate thread.
/* */
#undef VERSION
#define VERSION "1.37.31"
-#define BDATE "18 July 2005"
-#define LSMDATE "18Jul05"
+#define BDATE "22 July 2005"
+#define LSMDATE "22Jul05"
/* Debug flags */
#undef DEBUG