]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/stored/block.c
- Add VolumePurged method to Python JobEvents class. Fixes
[bacula/bacula] / bacula / src / stored / block.c
index 6a2f20f8acf1f01e96f4b0fbd9ec3fb955da1c8a..1461f777144db3c830f4af549635e10b4b4cff23 100644 (file)
@@ -75,8 +75,8 @@ void dump_block(DEV_BLOCK *b, const char *msg)
 
    BlockCheckSum = bcrc32((uint8_t *)b->buf+BLKHDR_CS_LENGTH,
                          block_len-BLKHDR_CS_LENGTH);
-   Pmsg6(000, "Dump block %s %x: size=%d BlkNum=%d\n"
-"               Hdrcksum=%x cksum=%x\n",
+   Pmsg6(000, _("Dump block %s %x: size=%d BlkNum=%d\n"
+"               Hdrcksum=%x cksum=%x\n"),
       msg, b, block_len, BlockNumber, CheckSum, BlockCheckSum);
    p = b->buf + bhl;
    while (p < (b->buf + block_len+WRITE_RECHDR_LENGTH)) {
@@ -88,7 +88,7 @@ void dump_block(DEV_BLOCK *b, const char *msg)
       unser_int32(FileIndex);
       unser_int32(Stream);
       unser_uint32(data_len);
-      Pmsg6(000, "   Rec: VId=%u VT=%u FI=%s Strm=%s len=%d p=%x\n",
+      Pmsg6(000, _("   Rec: VId=%u VT=%u FI=%s Strm=%s len=%d p=%x\n"),
            VolSessionId, VolSessionTime, FI_to_ascii(FileIndex),
            stream_to_ascii(Stream, FileIndex), data_len, p);
       p += data_len + rhl;
@@ -504,7 +504,7 @@ bool write_block_to_dev(DCR *dcr)
 #ifdef DEBUG_BLOCK_ZEROING
    uint32_t *bp = (uint32_t *)block->buf;
    if (bp[0] == 0 && bp[1] == 0 && bp[2] == 0 && block->buf[12] == 0) {
-      Jmsg0(jcr, M_ABORT, 0, "Write block header zeroed.\n");
+      Jmsg0(jcr, M_ABORT, 0, _("Write block header zeroed.\n"));
    }
 #endif
 
@@ -515,7 +515,7 @@ bool write_block_to_dev(DCR *dcr)
 
 #ifdef DEBUG_BLOCK_ZEROING
    if (bp[0] == 0 && bp[1] == 0 && bp[2] == 0 && block->buf[12] == 0) {
-      Jmsg0(jcr, M_ABORT, 0, "Write block header zeroed.\n");
+      Jmsg0(jcr, M_ABORT, 0, _("Write block header zeroed.\n"));
    }
 #endif
 
@@ -572,9 +572,12 @@ bool write_block_to_dev(DCR *dcr)
       dcr->EndBlock = dev->EndBlock;
       dcr->EndFile  = dev->EndFile;
    } else {
-      /* Save address of start of block just written */
-      dcr->EndBlock = (uint32_t)dev->file_addr;
-      dcr->EndFile = (uint32_t)(dev->file_addr >> 32);
+      /* Save address of block just written */
+      uint64_t addr = dev->file_addr + wlen - 1;
+      dcr->EndBlock = (uint32_t)addr;
+      dcr->EndFile = (uint32_t)(addr >> 32);
+      dev->block_num = dcr->EndBlock;
+      dev->file = dcr->EndFile;
    }
    if (dcr->VolFirstIndex == 0 && block->FirstIndex > 0) {
       dcr->VolFirstIndex = block->FirstIndex;
@@ -678,8 +681,8 @@ 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"
-           "%s", dev->errmsg);
+      Jmsg(dcr->jcr, M_ERROR, 0, _("Error writing final EOF to tape. This tape may not be readable.\n"
+           "%s"), dev->errmsg);
       ok = false;
       Dmsg0(100, "WEOF error.\n");
    }
@@ -1037,13 +1040,14 @@ reread:
       dcr->EndBlock = dev->EndBlock;
       dcr->EndFile  = dev->EndFile;
    } else {
-      dcr->EndBlock = (uint32_t)dev->file_addr;
-      dcr->EndFile = (uint32_t)(dev->file_addr >> 32);
+      uint64_t addr = dev->file_addr + block->read_len - 1;
+      dcr->EndBlock = (uint32_t)addr;
+      dcr->EndFile = (uint32_t)(addr >> 32);
       dev->block_num = dcr->EndBlock;
       dev->file = dcr->EndFile;
    }
-   dev->file_addr += block->block_len;
-   dev->file_size += block->block_len;
+   dev->file_addr += block->read_len;
+   dev->file_size += block->read_len;
 
    /*
     * If we read a short block on disk,