dev->clrerror(-1);
}
stat = dev->write(block->buf, (size_t)wlen);
- Dmsg4(100, "%s write() BlockAddr=%lld wlen=%d Vol=%s wlen=%d\n",
- block->adata?"Adata":"Ameta", block->BlockAddr, wlen,
- dev->VolHdr.VolumeName);
+ Dmsg4(100, "%s write() BlockAddr=%lld wlen=%d Vol=%s\n",
+ block->adata?"Adata":"Ameta",
+ block->BlockAddr, wlen, dev->VolHdr.VolumeName);
} while (stat == -1 && (errno == EBUSY || errno == EIO) && retry++ < 3);
/* ***FIXME*** remove 2 lines debug */
}
dev->file_addr += wlen; /* update file address */
- dev->file_size += wlen;
+ dev->update_file_size(wlen);
dev->usage += wlen; /* update usage counter */
if (dev->part > 0) {
dev->part_size += wlen;
if (forge_on) {
/* Skip the current byte to find a valid block */
dev->file_addr += 1;
- dev->file_size += 1;
+ dev->update_file_size(1);
/* Can be canceled at this point... */
if (jcr->is_canceled()) {
jcr->forceJobStatus(status);
dcr->VolMediaId = dev->VolCatInfo.VolMediaId;
}
dev->file_addr += block->read_len;
- dev->file_size += block->read_len;
+ dev->update_file_size(block->read_len);
dev->usage += block->read_len; /* update usage counter */
/*
edit_int64(pos, ed1), block->block_len,
block->read_len);
dev->file_addr = pos;
- dev->file_size = pos;
+ dev->set_file_size(pos);
}
Dmsg3(150, "Exit read_block read_len=%d block_len=%d binbuf=%d\n",
block->read_len, block->block_len, block->binbuf);
{
set_eof();
file_addr = 0;
- file_size = 0;
+ set_file_size(0);
block_num = 0;
}
ST_NOSPACE|ST_MOUNTED|ST_MEDIA|ST_SHORT);
label_type = B_BACULA_LABEL;
file = block_num = 0;
- file_size = 0;
+ set_file_size(0);
file_addr = 0;
EndFile = EndBlock = 0;
openmode = 0;
return false;
}
- file_size = 0;
+ set_file_size(0);
return true;
}
}
clear_eof(); /* remove EOF flag */
block_num = file = 0;
- file_size = 0;
+ set_file_size(0);
file_addr = 0;
Leave(100);
return ok;
bool DEVICE::do_size_checks(DCR *dcr, DEV_BLOCK *block)
{
JCR *jcr = dcr->jcr;
-
if (is_pool_size_reached(dcr, true)) {
if (!dir_get_pool_info(dcr, &VolCatInfo)) {
Dmsg0(50, "Error updating volume info.\n");
*/
if ((max_file_size > 0) &&
(file_size+block->binbuf) >= max_file_size) {
- file_size = 0; /* reset file size */
+ set_file_size(0); /* reset file size */
if (!weof(dcr, 1)) { /* write eof */
Dmsg0(50, "WEOF error in max file size.\n");
/* Virtual functions that can be overridden */
+ virtual void set_file_size(uint64_t val) { file_size = val;};
+ virtual uint64_t update_file_size(uint64_t add) { file_size += add; return file_size; };
virtual void setVolCatName(const char *name);
virtual void setVolCatStatus(const char *status);
virtual void free_dcr_blocks(DCR *dcr); /* in block_util.c */