]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/stored/block.c
Add additional search directories for PostgreSQL
[bacula/bacula] / bacula / src / stored / block.c
index 23bc1b4e89fe51c6720f4e71164d38b569845957..5a3028403e38d761e5ee2e8feb7d31f26784e93a 100644 (file)
@@ -9,7 +9,7 @@
  *
  */
 /*
-   Copyright (C) 2000-2003 Kern Sibbald and John Walker
+   Copyright (C) 2000-2004 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
@@ -412,12 +412,15 @@ int write_block_to_dev(JCR *jcr, DEVICE *dev, DEV_BLOCK *block)
       block->write_failed = true;
       if (weof_dev(dev, 1) != 0) {           /* end tape */
          Jmsg(jcr, M_ERROR, 0, "%s", dev->errmsg);
+        dev->VolCatInfo.VolCatErrors++;
       }
       /* Don't do update after second EOF or file count will be wrong */
       Dmsg0(100, "dir_update_volume_info\n");
+      dev->VolCatInfo.VolCatFiles = dev->file;
       dir_update_volume_info(jcr, dev, 0);
       if (dev_cap(dev, CAP_TWOEOF) && weof_dev(dev, 1) != 0) { /* write eof */
          Jmsg(jcr, M_ERROR, 0, "%s", dev->errmsg);
+        dev->VolCatInfo.VolCatErrors++;
       }
       dev->state |= (ST_EOF | ST_EOT | ST_WEOT);
       return 0;   
@@ -432,14 +435,17 @@ int write_block_to_dev(JCR *jcr, DEVICE *dev, DEV_BLOCK *block)
         if (weof_dev(dev, 1) != 0) {            /* write eof */
             Jmsg(jcr, M_ERROR, 0, "%s", dev->errmsg);
            block->write_failed = true;
+           dev->VolCatInfo.VolCatErrors++;
            dev->state |= (ST_EOF | ST_EOT | ST_WEOT);
             Dmsg0(100, "dir_update_volume_info\n");
+           dev->VolCatInfo.VolCatFiles = dev->file;
            dir_update_volume_info(jcr, dev, 0);
            return 0;   
         }
 
         /* Do bookkeeping to handle EOF just written */
          Dmsg0(100, "dir_update_volume_info\n");
+        dev->VolCatInfo.VolCatFiles = dev->file;
         dir_update_volume_info(jcr, dev, 0);
         if (!dir_create_jobmedia_record(jcr)) {
              Jmsg(jcr, M_ERROR, 0, _("Could not create JobMedia record for Volume=\"%s\" Job=%s\n"),
@@ -483,12 +489,12 @@ int write_block_to_dev(JCR *jcr, DEVICE *dev, DEV_BLOCK *block)
         if (dev->dev_errno == 0) {
            dev->dev_errno = ENOSPC;        /* out of space */
         }
-         Jmsg(jcr, M_ERROR, 0, _("Write error on device %s. ERR=%s.\n"), 
-           dev->dev_name, strerror(dev->dev_errno));
+         Jmsg(jcr, M_ERROR, 0, _("Write error at %u:%u on device %s. ERR=%s.\n"), 
+           dev->file, dev->block_num, dev->dev_name, strerror(dev->dev_errno));
       } else {
        dev->dev_errno = ENOSPC;            /* out of space */
-         Jmsg3(jcr, M_INFO, 0, _("End of medium on device %s. Write of %u bytes got %d.\n"), 
-           dev->dev_name, wlen, stat);
+         Jmsg(jcr, M_INFO, 0, _("End of medium at %u:%u on device %s. Write of %u bytes got %d.\n"), 
+           dev->file, dev->block_num, dev->dev_name, wlen, stat);
       }  
 
       Dmsg6(100, "=== Write error. size=%u rtn=%d dev_blk=%d blk_blk=%d errno=%d: ERR=%s\n", 
@@ -496,11 +502,14 @@ int write_block_to_dev(JCR *jcr, DEVICE *dev, DEV_BLOCK *block)
 
       block->write_failed = true;
       if (weof_dev(dev, 1) != 0) {        /* end the tape */
+        dev->VolCatInfo.VolCatErrors++;
          Jmsg(jcr, M_ERROR, 0, "%s", dev->errmsg);
       }
       Dmsg0(100, "dir_update_volume_info\n");
+      dev->VolCatInfo.VolCatFiles = dev->file;
       dir_update_volume_info(jcr, dev, 0);
       if (dev_cap(dev, CAP_TWOEOF) && weof_dev(dev, 1) != 0) { /* end the tape */
+        dev->VolCatInfo.VolCatErrors++;
          Jmsg(jcr, M_ERROR, 0, "%s", dev->errmsg);
       }
       dev->state |= (ST_EOF | ST_EOT | ST_WEOT);