if (dev) {
dev->dev_errno = ENODEV;
}
- Emsg2(M_FATAL, 0, "%s is an unknown device type. Must be tape or directory. st_mode=%x\n",
+ Emsg2(M_FATAL, 0, _("%s is an unknown device type. Must be tape or directory. st_mode=%x\n"),
dev_name, statp.st_mode);
return NULL;
}
dev->max_open_wait = device->max_open_wait;
dev->device = device;
-
+ if (dev->max_block_size > 1000000) {
+ Emsg3(M_ERROR, 0, _("Block size %u on device %s is too large, using default %u\n"),
+ dev->max_block_size, dev->dev_name, DEFAULT_BLOCK_SIZE);
+ dev->max_block_size = 0;
+ }
+ if (dev->max_block_size % TAPE_BSIZE != 0) {
+ Emsg2(M_WARNING, 0, _("Max block size %u not multiple of device %s block size.\n"),
+ dev->max_block_size, dev->dev_name);
+ }
+
dev->errmsg = get_pool_memory(PM_EMSG);
*dev->errmsg = 0;
}
while (!(dev->state & ST_EOT)) {
Dmsg0(200, "Do fsf 1\n");
- if (fsf_dev(dev, 1) < 0) {
- Dmsg0(200, "fsf_dev return < 0\n");
+ if (!fsf_dev(dev, 1)) {
+ Dmsg0(200, "fsf_dev error.\n");
return 0;
}
}
/*
* Foward space a file
+ * Returns: 1 on success
+ * 0 on failure
*/
int
fsf_dev(DEVICE *dev, int num)
dev->dev_errno = EBADF;
Mmsg0(&dev->errmsg, _("Bad call to fsf_dev. Archive not open\n"));
Emsg0(M_FATAL, 0, dev->errmsg);
- return -1;
+ return 0;
}
if (!(dev->state & ST_TAPE)) {
- return 0;
+ return 1;
}
if (dev->state & ST_EOT) {
dev->dev_errno = 0;
Mmsg1(&dev->errmsg, _("Device %s at End of Tape.\n"), dev->dev_name);
- return -1;
+ return 0;
}
if (dev->state & ST_EOF)
Dmsg0(200, "ST_EOF set on entry to FSF\n");
if (dev->state & ST_EOT)
Dmsg0(200, "ST_EOT set on exit FSF\n");
Dmsg1(200, "Return from FSF file=%d\n", dev->file);
- return stat;
+ return stat == 0 ? 1 : 0;
}
/*
/*
* Backward space a record
+ * Returns: 0 on success
+ * -1 on failure
*/
int
bsr_dev(DEVICE *dev, int num)
/* Clean up device packet so it can be reused */
dev->fd = -1;
dev->state &= ~(ST_OPENED|ST_LABEL|ST_READ|ST_APPEND|ST_EOT|ST_WEOT|ST_EOF);
- dev->block_num = 0;
- dev->file = 0;
+ dev->file = dev->block_num = 0;
dev->file_addr = 0;
- dev->LastBlockNumWritten = 0;
+ dev->EndFile = dev->EndBlock = 0;
memset(&dev->VolCatInfo, 0, sizeof(dev->VolCatInfo));
memset(&dev->VolHdr, 0, sizeof(dev->VolHdr));
dev->use_count--;