* Dump the block header, then walk through
* the block printing out the record headers.
*/
-void dump_block(DEV_BLOCK *b, char *msg)
+void dump_block(DEV_BLOCK *b, const char *msg)
{
ser_declare;
char *p;
Jmsg(jcr, M_ERROR, 0, "%s", dev->errmsg);
}
block->read_errors++;
- return 0;
+ if (!forge_on) {
+ return 0;
+ }
}
} else if (Id[3] == '2') {
unser_uint32(block->VolSessionId);
Jmsg(jcr, M_ERROR, 0, "%s", dev->errmsg);
}
block->read_errors++;
- return 0;
+ if (!forge_on) {
+ return 0;
+ }
}
} else {
dev->dev_errno = EIO;
Jmsg(jcr, M_ERROR, 0, "%s", dev->errmsg);
}
block->read_errors++;
- return 0;
+ if (!forge_on) {
+ return 0;
+ }
+ unser_uint32(block->VolSessionId);
+ unser_uint32(block->VolSessionTime);
+ bhl = BLKHDR2_LENGTH;
+ block->BlockVer = 2;
+ block->bufp = block->buf + bhl;
}
/* Sanity check */
Jmsg(jcr, M_ERROR, 0, "%s", dev->errmsg);
}
block->read_errors++;
- return 0;
+ if (!forge_on) {
+ return 0;
+ }
}
Dmsg1(190, "unser_block_header block_len=%d\n", block_len);
Jmsg(jcr, M_ERROR, 0, "%s", dev->errmsg);
}
block->read_errors++;
- return 0;
+ if (!forge_on) {
+ return 0;
+ }
}
}
return 1;
/* Adjust write size to min/max for tapes only */
if (dev->state & ST_TAPE) {
- if (wlen < dev->min_block_size) {
- wlen = ((dev->min_block_size + TAPE_BSIZE - 1) / TAPE_BSIZE) * TAPE_BSIZE;
- }
/* check for fixed block size */
if (dev->min_block_size == dev->max_block_size) {
wlen = block->buf_len; /* fixed block size already rounded */
+ /* Check for min block size */
+ } else if (wlen < dev->min_block_size) {
+ wlen = ((dev->min_block_size + TAPE_BSIZE - 1) / TAPE_BSIZE) * TAPE_BSIZE;
+ /* Ensure size is rounded */
+ } else {
+ wlen = ((wlen + TAPE_BSIZE - 1) / TAPE_BSIZE) * TAPE_BSIZE;
}
}
if (wlen-blen > 0) {
dev->dev_errno = EIO;
Jmsg(jcr, M_ERROR, 0, _("Could not create JobMedia record for Volume=\"%s\" Job=%s\n"),
dcr->VolCatInfo.VolCatName, jcr->Job);
- return 0;
+ if (!forge_on) {
+ return 0;
+ }
}
dev->file_size = 0; /* reset file size */
/*
}
dev->VolCatInfo.VolCatWrites++;
- Dmsg1(300, "Write block of %u bytes\n", wlen);
+ Dmsg1(200, "Write block of %u bytes\n", wlen);
stat = write(dev->fd, block->buf, (size_t)wlen);
if (stat != (ssize_t)wlen) {
/* We should check for errno == ENOSPC, BUT many
if (dev->dev_errno == 0) {
dev->dev_errno = ENOSPC; /* out of space */
}
- Jmsg(jcr, M_ERROR, 0, _("Write error at %u:%u on device %s. ERR=%s.\n"),
+ Jmsg4(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 */
int retry;
DCR *dcr = jcr->dcr;
+ if (!dcr) {
+ Jmsg0(jcr, M_ABORT, 0, _("DCR is NULL!\n"));
+ }
if (dev_state(dev, ST_EOT)) {
return 0;
}