]> git.sur5r.net Git - bacula/bacula/commitdiff
Update num_parts only when writing to DVD.
authorKern Sibbald <kern@sibbald.com>
Fri, 14 Oct 2005 11:00:51 +0000 (11:00 +0000)
committerKern Sibbald <kern@sibbald.com>
Fri, 14 Oct 2005 11:00:51 +0000 (11:00 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@2441 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/autoconf/config.h.in
bacula/autoconf/configure.in
bacula/configure
bacula/kes-1.37
bacula/src/findlib/fstype.c
bacula/src/stored/block.c
bacula/src/stored/dvd.c
bacula/src/version.h

index 7fde428cf95fff4737dd2a6f6d913b06edbd2b8e..52663e863ed77d22e4c6108b848f0b0a43b66889 100644 (file)
@@ -96,6 +96,9 @@
    very expensive.  */
 #undef CACHE_IDS
 
+/* Define if you have the <sys/statvfs.h> header file */
+#undef HAVE_SYS_STATVFS_H
+
 /* Define to use SVR4 statvfs to get filesystem type.  */
 #undef FSTYPE_STATVFS
 
 /* If using the C implementation of alloca, define if you know the
    direction of stack growth for your system; otherwise it will be
    automatically deduced at run-time.
-       STACK_DIRECTION > 0 => grows toward higher addresses
-       STACK_DIRECTION < 0 => grows toward lower addresses
-       STACK_DIRECTION = 0 => direction of growth unknown */
+        STACK_DIRECTION > 0 => grows toward higher addresses
+        STACK_DIRECTION < 0 => grows toward lower addresses
+        STACK_DIRECTION = 0 => direction of growth unknown */
 #undef STACK_DIRECTION
 
 /* Define to 1 if the `S_IS*' macros in <sys/stat.h> do not work properly. */
index 7a01825bb165051db4b13581ecde3d1dc60f576b..9b1e5152c3bd9a3badf0099fd2bc308295c57843 100644 (file)
@@ -1271,6 +1271,8 @@ AC_TRY_CPP([#include <sys/mount.h>
 fi
 AC_MSG_RESULT($fstype)
 
+AC_CHECK_HEADER(sys/statvfs.h, [ AC_DEFINE(HAVE_SYS_STATVFS_H,1,[Defines if your system have the sys/statvfs.h header file])] , )
+
 dnl# --------------------------------------------------------------------------
 dnl# CHECKING FOR TYPEDEFS, STRUCTURES, AND COMPILER CHARACTERISTICS.
 dnl# --------------------------------------------------------------------------
index 32f932f7a9d75e0c1ed527dee4a860266ed69652..692a7f9f555c34a8d055cec9210e934a2a696940 100755 (executable)
 echo "$as_me:$LINENO: result: $fstype" >&5
 echo "${ECHO_T}$fstype" >&6
 
+if test "${ac_cv_header_sys_statvfs_h+set}" = set; then
+  echo "$as_me:$LINENO: checking for sys/statvfs.h" >&5
+echo $ECHO_N "checking for sys/statvfs.h... $ECHO_C" >&6
+if test "${ac_cv_header_sys_statvfs_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_sys_statvfs_h" >&5
+echo "${ECHO_T}$ac_cv_header_sys_statvfs_h" >&6
+else
+  # Is the header compilable?
+echo "$as_me:$LINENO: checking sys/statvfs.h usability" >&5
+echo $ECHO_N "checking sys/statvfs.h usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <sys/statvfs.h>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking sys/statvfs.h presence" >&5
+echo $ECHO_N "checking sys/statvfs.h presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <sys/statvfs.h>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: sys/statvfs.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: sys/statvfs.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: sys/statvfs.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: sys/statvfs.h: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: sys/statvfs.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: sys/statvfs.h: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: sys/statvfs.h:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: sys/statvfs.h:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: sys/statvfs.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: sys/statvfs.h: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: sys/statvfs.h:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: sys/statvfs.h:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: sys/statvfs.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: sys/statvfs.h: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: sys/statvfs.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: sys/statvfs.h: in the future, the compiler will take precedence" >&2;}
+    (
+      cat <<\_ASBOX
+## ------------------------------------------ ##
+## Report this to the AC_PACKAGE_NAME lists.  ##
+## ------------------------------------------ ##
+_ASBOX
+    ) |
+      sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+echo "$as_me:$LINENO: checking for sys/statvfs.h" >&5
+echo $ECHO_N "checking for sys/statvfs.h... $ECHO_C" >&6
+if test "${ac_cv_header_sys_statvfs_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_header_sys_statvfs_h=$ac_header_preproc
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_sys_statvfs_h" >&5
+echo "${ECHO_T}$ac_cv_header_sys_statvfs_h" >&6
+
+fi
+if test $ac_cv_header_sys_statvfs_h = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_SYS_STATVFS_H 1
+_ACEOF
+
+fi
+
+
+
 echo "$as_me:$LINENO: checking return type of signal handlers" >&5
 echo $ECHO_N "checking return type of signal handlers... $ECHO_C" >&6
 if test "${ac_cv_type_signal+set}" = set; then
index 871ce2afc8b1f70c7dc19151e3322c03da11762a..13b57f82318643df0d9210edaa5ba95a9e3f6fcc 100644 (file)
@@ -4,6 +4,9 @@
 General:
 
 Changes to 1.37.41:
+14Oct05
+- Add NetBSD fstype patch from Geert Hendrickx <ghen@telenet.be>
+- Update num_parts only when writing to DVD.
 13Oct05
 - Fix error conditions in bpipe.c DVD routine (terminate buffer).
 - Use a bigger buffer 32K as suggested by Arno in bpipe.c.
index 416e7bc382f45d32ed05f055b5b8fab0a38ada0c..6182c6bc96e32126e2ce8cc5bd3eb0da40697168 100644 (file)
    "HAVE_NETBSD_OS\n" \
    "HAVE_OPENBSD_OS\n" \
    "HAVE_SUN_OS\n"
-#define bool              int
-#define false             0
-#define true              1
-#define bstrncpy          strncpy
-#define Dmsg0(n,s)        fprintf(stderr, s)
-#define Dmsg1(n,s,a1)     fprintf(stderr, s, a1)
+#define bool               int
+#define false              0
+#define true               1
+#define bstrncpy           strncpy
+#define Dmsg0(n,s)         fprintf(stderr, s)
+#define Dmsg1(n,s,a1)      fprintf(stderr, s, a1)
 #define Dmsg2(n,s,a1,a2)   fprintf(stderr, s, a1, a2)
 #endif
 
 /*
  * These functions should be implemented for each OS
  *
- *      bool fstype(const char *fname, char *fs, int fslen);
+ *       bool fstype(const char *fname, char *fs, int fslen);
  */
 #if defined(HAVE_DARWIN_OS) \
    || defined(HAVE_FREEBSD_OS ) \
@@ -79,6 +79,11 @@ bool fstype(const char *fname, char *fs, int fslen)
 #elif defined(HAVE_NETBSD_OS)
 #include <sys/param.h>
 #include <sys/mount.h>
+#ifdef HAVE_SYS_STATVFS_H
+#include <sys/statvfs.h>
+#else
+#define statvfs statfs
+#endif
 
 bool fstype(const char *fname, char *fs, int fslen)
 {
@@ -126,7 +131,7 @@ bool fstype(const char *fname, char *fs, int fslen)
 
       /* Known good values */
       case 0xef53:         bstrncpy(fs, "ext2", fslen); return true;          /* EXT2_SUPER_MAGIC */
-   /* case 0xef53:        ext2 and ext3 are the same */                      /* EXT3_SUPER_MAGIC */
+   /* case 0xef53:         ext2 and ext3 are the same */                      /* EXT3_SUPER_MAGIC */
       case 0x3153464a:     bstrncpy(fs, "jfs", fslen); return true;           /* JFS_SUPER_MAGIC */
       case 0x5346544e:     bstrncpy(fs, "ntfs", fslen); return true;          /* NTFS_SB_MAGIC */
       case 0x9fa0:         bstrncpy(fs, "proc", fslen); return true;          /* PROC_SUPER_MAGIC */
@@ -137,7 +142,7 @@ bool fstype(const char *fname, char *fs, int fslen)
       case 0x517B:         bstrncpy(fs, "smbfs", fslen); return true;         /* SMB_SUPER_MAGIC */
       case 0x9660:         bstrncpy(fs, "iso9660", fslen); return true;       /* ISOFS_SUPER_MAGIC */
 
-#if 0      /* These need confirmation */
+#if 0       /* These need confirmation */
       case 0xadf5:         bstrncpy(fs, "adfs", fslen); return true;          /* ADFS_SUPER_MAGIC */
       case 0xadff:         bstrncpy(fs, "affs", fslen); return true;          /* AFFS_SUPER_MAGIC */
       case 0x6B414653:     bstrncpy(fs, "afs", fslen); return true;           /* AFS_FS_MAGIC */
@@ -199,8 +204,8 @@ bool fstype(const char *fname, char *fs, int fslen)
 
       default:
          Dmsg2(10, "Unknown file system type \"0x%x\" for \"%s\".\n", st.f_type,
-              fname);
-        return false;
+               fname);
+         return false;
       }
    }
    Dmsg1(50, "statfs() failed for \"%s\"\n", fname);
@@ -247,14 +252,14 @@ bool fstype(const char *fname, char *fs, int fslen)
 }
 /* Tru64 */
 
-#else   /* No recognised OS */
+#else    /* No recognised OS */
 
 bool fstype(const char *fname, char *fs, int fslen)
 {
    Dmsg0(10, "!!! fstype() not implemented for this OS. !!!\n");
 #ifdef TEST_PROGRAM
    Dmsg1(10, "Please define one of the following when compiling:\n\n%s\n",
-        SUPPORTEDOSES);
+         SUPPORTEDOSES);
    exit(EXIT_FAILURE);
 #endif
 
@@ -273,12 +278,12 @@ int main(int argc, char **argv)
       p = (argc < 1) ? "fstype" : argv[0];
       printf("usage:\t%s path ...\n"
             "\t%s prints the file system type and pathname of the paths.\n",
-           p, p);
+            p, p);
       return EXIT_FAILURE;
    }
    while (*++argv) {
       if (!fstype(*argv, fs, sizeof(fs))) {
-        status = EXIT_FAILURE;
+         status = EXIT_FAILURE;
       } else {
          printf("%s\t%s\n", fs, *argv);
       }
index 042240b66a09f75effba1126ce787ddb808073af..293a782f826b0ede24221057c74f6fe48f50850e 100644 (file)
@@ -682,7 +682,7 @@ static bool terminate_writing_volume(DCR *dcr)
    dcr->block->write_failed = true;
    if (weof_dev(dev, 1) != 0) {         /* end the tape */
       dev->VolCatInfo.VolCatErrors++;
-      Jmsg(dcr->jcr, M_ERROR, 0, _("Error writing final EOF to tape. This tape may not be readable.\n"
+      Jmsg(dcr->jcr, M_ERROR, 0, _("Error writing final EOF to tape. This Volume may not be readable.\n"
            "%s"), dev->errmsg);
       ok = false;
       Dmsg0(100, "WEOF error.\n");
index ef4e69f3445b0fd9bf061897c7b72e8b6ad184d9..9e62acfe9164975735eb367bfee22ad82d8c61e8 100644 (file)
@@ -305,6 +305,8 @@ bool dvd_write_part(DCR *dcr)
 {
    DEVICE *dev = dcr->dev;
    POOL_MEM ocmd(PM_FNAME);
+   POOL_MEM results(PM_MESSAGE);
+   POOL_MEM archive_name(PM_FNAME);
    char* icmd;
    int status;
    int timeout;
@@ -326,30 +328,24 @@ bool dvd_write_part(DCR *dcr)
 
    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());
-         Dmsg1(000, "%s", dev->errmsg);
-         dev->dev_errno = EIO;
-         mark_volume_in_error(dcr);
-         return false;
-      }
+   status = run_program_full_output(ocmd.c_str(), timeout, results.c_str());
+   if (status != 0) {
+      Mmsg1(dev->errmsg, _("Error while writing current part to the DVD: %s"), 
+            results.c_str());
+      Dmsg1(000, "%s", dev->errmsg);
+      dev->dev_errno = EIO;
+      mark_volume_in_error(dcr);
       sm_check(__FILE__, __LINE__, false);
+      return false;
+   } else {
+      dev->num_parts++;            /* there is no one more part on DVD */
    }
 
-   {
-      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);
-   }
+   /* 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);
    
    /* growisofs umounted the device, so remount it (it will update the free space) */
    dev->clear_mounted();
@@ -397,6 +393,7 @@ int dvd_open_next_part(DCR *dcr)
     */
    if (dev->is_dvd() && (dev->part >= dev->num_parts) && dev->can_append()) {
       if (!dvd_write_part(dcr)) {
+         Dmsg0(29, "Error in dvd_write part.\n");
          return -1;
       }
    }
@@ -429,8 +426,7 @@ int dvd_open_next_part(DCR *dcr)
          }
       }
 
-      Dmsg2(100, "Set npart=%d to part=%d\n", dev->num_parts, dev->part);
-      dev->num_parts = dev->part;
+      Dmsg2(100, "num_parts=%d part=%d\n", dev->num_parts, dev->part);
       dev->VolCatInfo.VolCatParts = dev->part;
       make_spooled_dvd_filename(dev, archive_name);   /* makes spool name */
       
@@ -447,6 +443,11 @@ int dvd_open_next_part(DCR *dcr)
          }
       }
    }
+   /* KES.  It seems to me that this if should not be
+    *  needed. If num_parts represents what is on the DVD
+    *  we should only need to change it when writing a part
+    *  to the DVD.
+    */
    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;
index 71e431a389c2e69d01d743a9053af6a78bd18f14..9de28b7b260031addae28f5036c3c99423392e69 100644 (file)
@@ -4,8 +4,8 @@
 
 #undef  VERSION
 #define VERSION "1.37.41"
-#define BDATE   "13 October 2005"
-#define LSMDATE "13Oct05"
+#define BDATE   "14 October 2005"
+#define LSMDATE "14Oct05"
 
 /* Debug flags */
 #undef  DEBUG