]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/stored/device.c
Simplify two messages in acquire.c
[bacula/bacula] / bacula / src / stored / device.c
index ecb5f189ea58b8c7d5471a2878d14bdc8537279b..b07756a6174d1ac45c8eb4b6263d440cf0e45036 100644 (file)
@@ -29,7 +29,7 @@
  *   Version $Id$
  */
 /*
-   Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker
+   Copyright (C) 2000-2003 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
@@ -92,8 +92,14 @@ int fixup_device_block_write_error(JCR *jcr, DEVICE *dev, DEV_BLOCK *block)
       Dmsg1(100, "Walk attached jcrs. Volume=%s\n", dev->VolCatInfo.VolCatName);
       for (JCR *mjcr=NULL; (mjcr=next_attached_jcr(dev, mjcr)); ) {
          Dmsg1(100, "create JobMedia for Job %s\n", mjcr->Job);
-        mjcr->end_block = dev->block_num;
-        mjcr->end_file = dev->file;
+        if (dev->state & ST_TAPE) {
+           mjcr->EndBlock = dev->EndBlock;
+           mjcr->EndFile  = dev->EndFile;
+            Dmsg2(200, "Fixup EndFile=%u EndBlock=%u\n", mjcr->EndFile, mjcr->EndBlock);
+        } else {
+           mjcr->EndBlock = (uint32_t)dev->file_addr;
+           mjcr->EndFile = (uint32_t)(dev->file_addr >> 32);
+        }
         if (!dir_create_jobmedia_record(mjcr)) {
             Jmsg(mjcr, M_ERROR, 0, _("Could not create JobMedia record for Volume=%s Job=%s\n"),
               dev->VolCatInfo.VolCatName, mjcr->Job);
@@ -104,11 +110,9 @@ int fixup_device_block_write_error(JCR *jcr, DEVICE *dev, DEV_BLOCK *block)
       }
 
       strcpy(dev->VolCatInfo.VolCatStatus, "Full");
-      Dmsg2(100, "Call update_vol_info Stat=%s Vol=%s\n", 
+      Dmsg2(200, "Call update_vol_info Stat=%s Vol=%s\n", 
         dev->VolCatInfo.VolCatStatus, dev->VolCatInfo.VolCatName);
       if (!dir_update_volume_info(jcr, &dev->VolCatInfo, 0)) {   /* send Volume info to Director */
-         Jmsg(jcr, M_ERROR, 0, _("Could not update Volume info Volume=%s Job=%s\n"),
-           dev->VolCatInfo.VolCatName, jcr->Job);
         P(dev->mutex);
         unblock_device(dev);
         return 0;                    /* device locked */
@@ -142,7 +146,7 @@ int fixup_device_block_write_error(JCR *jcr, DEVICE *dev, DEV_BLOCK *block)
        *  empty label_blk, and nothing will be written.
        */
       Dmsg0(190, "write label block to dev\n");
-      if (!write_block_to_dev(dev, label_blk)) {
+      if (!write_block_to_dev(jcr, dev, label_blk)) {
          Pmsg1(0, "write_block_to_device Volume label failed. ERR=%s",
           strerror_dev(dev));
         free_block(label_blk);
@@ -152,7 +156,7 @@ int fixup_device_block_write_error(JCR *jcr, DEVICE *dev, DEV_BLOCK *block)
 
       /* Write overflow block to tape */
       Dmsg0(190, "Write overflow block to dev\n");
-      if (!write_block_to_dev(dev, block)) {
+      if (!write_block_to_dev(jcr, dev, block)) {
          Pmsg1(0, "write_block_to_device overflow block failed. ERR=%s",
           strerror_dev(dev));
         free_block(label_blk);
@@ -165,8 +169,13 @@ int fixup_device_block_write_error(JCR *jcr, DEVICE *dev, DEV_BLOCK *block)
       free_block(label_blk);
       for (JCR *mjcr=NULL; (mjcr=next_attached_jcr(dev, mjcr)); ) {
         /* Set new start/end positions */
-        mjcr->start_block = dev->block_num;
-        mjcr->start_file = dev->file;
+        if (dev->state & ST_TAPE) {
+           mjcr->StartBlock = dev->block_num;
+           mjcr->StartFile = dev->file;
+        } else {
+           mjcr->StartBlock = (uint32_t)dev->file_addr;
+           mjcr->StartFile  = (uint32_t)(dev->file_addr >> 32);
+        }
         mjcr->VolFirstFile = mjcr->JobFiles;
         mjcr->run_time += time(NULL) - wait_time; /* correct run time */
       }