+STORES *me = NULL; /* our Global resource */
+bool forge_on = false; /* proceed inspite of I/O errors */
+pthread_mutex_t device_release_mutex = PTHREAD_MUTEX_INITIALIZER;
+pthread_cond_t wait_device_release = PTHREAD_COND_INITIALIZER;
Emsg2(M_ABORT, 0, "Tape block size (%d) not multiple of system size (%d)\n",
Emsg2(M_ABORT, 0, "Tape block size (%d) not multiple of system size (%d)\n",
}
if (TAPE_BSIZE != (1 << (ffs(TAPE_BSIZE)-1))) {
Emsg1(M_ABORT, 0, "Tape block size (%d) is not a power of 2\n", TAPE_BSIZE);
}
if (sizeof(off_t) < 8) {
Pmsg1(-1, "\n\n!!!! Warning large disk addressing disabled. off_t=%d should be 8 or more !!!!!\n\n\n",
}
if (TAPE_BSIZE != (1 << (ffs(TAPE_BSIZE)-1))) {
Emsg1(M_ABORT, 0, "Tape block size (%d) is not a power of 2\n", TAPE_BSIZE);
}
if (sizeof(off_t) < 8) {
Pmsg1(-1, "\n\n!!!! Warning large disk addressing disabled. off_t=%d should be 8 or more !!!!!\n\n\n",
}
x32 = 123456789;
bsnprintf(buf, sizeof(buf), "%u", x32);
}
x32 = 123456789;
bsnprintf(buf, sizeof(buf), "%u", x32);
while ((ch = getopt(margc, margv, "b:c:d:psv?")) != -1) {
switch (ch) {
case 'b': /* bootstrap file */
while ((ch = getopt(margc, margv, "b:c:d:psv?")) != -1) {
switch (ch) {
case 'b': /* bootstrap file */
Dmsg1(200, "Opening device %s\n", dcr->VolumeName);
if (open_dev(dev, dcr->VolumeName, OPEN_READ_WRITE) < 0) {
Emsg1(M_FATAL, 0, _("dev open failed: %s\n"), dev->errmsg);
Dmsg1(200, "Opening device %s\n", dcr->VolumeName);
if (open_dev(dev, dcr->VolumeName, OPEN_READ_WRITE) < 0) {
Emsg1(M_FATAL, 0, _("dev open failed: %s\n"), dev->errmsg);
- Pmsg1(000, "open_dev %s OK\n", dev_name(dev));
- dev->state |= ST_APPEND;
+ Pmsg1(000, "open_dev %s OK\n", dev->print_name());
+ dev->set_append(); /* put volume in append mode */
pm_strcpy(cmd, VolumeName);
} else {
if (!get_cmd("Enter Volume Name: ")) {
pm_strcpy(cmd, VolumeName);
} else {
if (!get_cmd("Enter Volume Name: ")) {
Pmsg2(0, "Bad status from weof %d. ERR=%s\n", stat, strerror_dev(dev));
return;
} else {
Pmsg2(0, "Bad status from weof %d. ERR=%s\n", stat, strerror_dev(dev));
return;
} else {
- Pmsg3(0, "Wrote %d EOF%s to %s\n", num, num==1?"":"s", dev_name(dev));
+ Pmsg3(0, "Wrote %d EOF%s to %s\n", num, num==1?"":"s", dev->print_name());
rec->data_len = i;
sm_check(__FILE__, __LINE__, false);
if (write_record_to_block(block, rec)) {
rec->data_len = i;
sm_check(__FILE__, __LINE__, false);
if (write_record_to_block(block, rec)) {
Pmsg2(0, "Block %d i=%d\n", blkno, i);
} else {
Pmsg2(0, "Block %d i=%d\n", blkno, i);
} else {
if (dev_cap(dev, CAP_TWOEOF)) {
if (!bsf_dev(dev, 1)) {
Pmsg1(0, _("Backspace file failed! ERR=%s\n"), strerror_dev(dev));
if (dev_cap(dev, CAP_TWOEOF)) {
if (!bsf_dev(dev, 1)) {
Pmsg1(0, _("Backspace file failed! ERR=%s\n"), strerror_dev(dev));
for (int i=0; i<len; i++) {
if (rec->data[i] != 3) {
Pmsg0(0, _("Bad data in record. Test failed!\n"));
for (int i=0; i<len; i++) {
if (rec->data[i] != 3) {
Pmsg0(0, _("Bad data in record. Test failed!\n"));
}
if (!write_record_to_block(block, rec)) {
Pmsg0(0, _("Error writing record to block.\n"));
}
if (!write_record_to_block(block, rec)) {
Pmsg0(0, _("Error writing record to block.\n"));
}
if (!write_block_to_dev(dcr)) {
Pmsg0(0, _("Error writing block to device.\n"));
}
if (!write_block_to_dev(dcr)) {
Pmsg0(0, _("Error writing block to device.\n"));
}
if (!write_record_to_block(block, rec)) {
Pmsg0(0, _("Error writing record to block.\n"));
}
if (!write_record_to_block(block, rec)) {
Pmsg0(0, _("Error writing record to block.\n"));
}
if (!write_block_to_dev(dcr)) {
Pmsg0(0, _("Error writing block to device.\n"));
}
if (!write_block_to_dev(dcr)) {
Pmsg0(0, _("Error writing block to device.\n"));
for (i=1; i<=2000; i++) {
read_again:
if (!read_block_from_dev(dcr, NO_BLOCK_NUMBER_CHECK)) {
for (i=1; i<=2000; i++) {
read_again:
if (!read_block_from_dev(dcr, NO_BLOCK_NUMBER_CHECK)) {
Pmsg2(0, _("Read block %d failed! ERR=%s\n"), i, be.strerror(dev->dev_errno));
Pmsg2(0, _("Read block %d failed! ERR=%s\n"), i, be.strerror(dev->dev_errno));
}
memset(rec->data, 0, rec->data_len);
if (!read_record_from_block(block, rec)) {
}
memset(rec->data, 0, rec->data_len);
if (!read_record_from_block(block, rec)) {
Pmsg2(0, _("Read record failed. Block %d! ERR=%s\n"), i, be.strerror(dev->dev_errno));
Pmsg2(0, _("Read record failed. Block %d! ERR=%s\n"), i, be.strerror(dev->dev_errno));
Pmsg3(0, _("Bad data in record. Expected %d, got %d at byte %d. Test failed!\n"),
Pmsg3(0, _("Bad data in record. Expected %d, got %d at byte %d. Test failed!\n"),
}
if (i == 1000 || i == 2000) {
Pmsg0(-1, _("1000 blocks re-read correctly.\n"));
}
if (i == 1000 || i == 2000) {
Pmsg0(-1, _("1000 blocks re-read correctly.\n"));
}
if (!write_record_to_block(block, rec)) {
Pmsg0(0, _("Error writing record to block.\n"));
}
if (!write_record_to_block(block, rec)) {
Pmsg0(0, _("Error writing record to block.\n"));
}
if (!write_block_to_dev(dcr)) {
Pmsg0(0, _("Error writing block to device.\n"));
}
if (!write_block_to_dev(dcr)) {
Pmsg0(0, _("Error writing block to device.\n"));
}
if (!write_record_to_block(block, rec)) {
Pmsg0(0, _("Error writing record to block.\n"));
}
if (!write_record_to_block(block, rec)) {
Pmsg0(0, _("Error writing record to block.\n"));
}
if (!write_block_to_dev(dcr)) {
Pmsg0(0, _("Error writing block to device.\n"));
}
if (!write_block_to_dev(dcr)) {
Pmsg0(0, _("Error writing block to device.\n"));
}
Pmsg2(-1, "Reposition to file:block %d:%d\n", file, blk);
if (!reposition_dev(dev, file, blk)) {
Pmsg0(0, "Reposition error.\n");
}
Pmsg2(-1, "Reposition to file:block %d:%d\n", file, blk);
if (!reposition_dev(dev, file, blk)) {
Pmsg0(0, "Reposition error.\n");
- recno, file, blk, be.strerror(dev->dev_errno));
+ recno, file, blk, be.strerror(dev->dev_errno));
Pmsg0(0, _("This may be because the tape drive block size is not\n"
" set to variable blocking as normally used by Bacula.\n"
" Please see the Tape Testing chapter in the manual and \n"
Pmsg0(0, _("This may be because the tape drive block size is not\n"
" set to variable blocking as normally used by Bacula.\n"
" Please see the Tape Testing chapter in the manual and \n"
}
memset(rec->data, 0, rec->data_len);
if (!read_record_from_block(block, rec)) {
}
memset(rec->data, 0, rec->data_len);
if (!read_record_from_block(block, rec)) {
Pmsg3(0, _("Bad data in record. Expected %d, got %d at byte %d. Test failed!\n"),
Pmsg3(0, _("Bad data in record. Expected %d, got %d at byte %d. Test failed!\n"),
/* We are going to load a new tape, so close the device */
force_close_dev(dev);
Pmsg2(-1, _("3302 Issuing autochanger \"unload %d %d\" command.\n"),
/* We are going to load a new tape, so close the device */
force_close_dev(dev);
Pmsg2(-1, _("3302 Issuing autochanger \"unload %d %d\" command.\n"),
changer = edit_device_codes(dcr, changer, "unload");
status = run_program(changer, timeout, results);
Pmsg2(-1, "unload status=%s %d\n", status==0?"OK":"Bad", status);
if (status != 0) {
changer = edit_device_codes(dcr, changer, "unload");
status = run_program(changer, timeout, results);
Pmsg2(-1, "unload status=%s %d\n", status==0?"OK":"Bad", status);
if (status != 0) {
Pmsg1(-1, _("3992 Bad autochanger command: %s\n"), changer);
Pmsg2(-1, _("3992 result=\"%s\": ERR=%s\n"), results, be.strerror(status));
}
Pmsg1(-1, _("3992 Bad autochanger command: %s\n"), changer);
Pmsg2(-1, _("3992 result=\"%s\": ERR=%s\n"), results, be.strerror(status));
}
status = run_program(changer, timeout, results);
if (status == 0) {
Pmsg2(-1, _("3303 Autochanger \"load slot %d %d\" status is OK.\n"),
status = run_program(changer, timeout, results);
if (status == 0) {
Pmsg2(-1, _("3303 Autochanger \"load slot %d %d\" status is OK.\n"),
}
if ((status = weof_dev(dev, 1)) < 0) {
Pmsg2(0, "Bad status from weof %d. ERR=%s\n", status, strerror_dev(dev));
goto bail_out;
} else {
}
if ((status = weof_dev(dev, 1)) < 0) {
Pmsg2(0, "Bad status from weof %d. ERR=%s\n", status, strerror_dev(dev));
goto bail_out;
} else {
}
if (sleep_time) {
Pmsg1(-1, "\nThe test worked this time. Please add:\n\n"
" sleep %d\n\n"
"to your mtx-changer script in the load) case.\n\n",
}
if (sleep_time) {
Pmsg1(-1, "\nThe test worked this time. Please add:\n\n"
" sleep %d\n\n"
"to your mtx-changer script in the load) case.\n\n",
if (dev_cap(dev, CAP_EOM) || dev_cap(dev, CAP_FASTFSF)) {
Pmsg0(-1, "\nAppend test failed. Attempting again.\n"
"Setting \"Hardware End of Medium = no\n"
" and \"Fast Forward Space File = no\n"
"and retrying append test.\n\n");
if (dev_cap(dev, CAP_EOM) || dev_cap(dev, CAP_FASTFSF)) {
Pmsg0(-1, "\nAppend test failed. Attempting again.\n"
"Setting \"Hardware End of Medium = no\n"
" and \"Fast Forward Space File = no\n"
"and retrying append test.\n\n");
- dev->capabilities &= ~CAP_EOM; /* turn off eom */
- dev->capabilities &= ~CAP_FASTFSF; /* turn off fast fsf */
- stat = append_test();
- if (stat == 1) {
+ dev->capabilities &= ~CAP_EOM; /* turn off eom */
+ dev->capabilities &= ~CAP_FASTFSF; /* turn off fast fsf */
+ stat = append_test();
+ if (stat == 1) {
Pmsg0(-1, "\n\nIt looks like the test worked this time, please add:\n\n"
" Hardware End of Medium = No\n\n"
" Fast Forward Space File = No\n"
"to your Device resource in the Storage conf file.\n");
Pmsg0(-1, "\n\nIt looks like the test worked this time, please add:\n\n"
" Hardware End of Medium = No\n\n"
" Fast Forward Space File = No\n"
"to your Device resource in the Storage conf file.\n");
Pmsg0(-1, "\n\nIt looks like the append failed. Attempting again.\n"
"Setting \"BSF at EOM = yes\" and retrying append test.\n");
Pmsg0(-1, "\n\nIt looks like the append failed. Attempting again.\n"
"Setting \"BSF at EOM = yes\" and retrying append test.\n");
Pmsg0(-1, "\n\nIt looks like the test worked this time, please add:\n\n"
" Hardware End of Medium = No\n"
" Fast Forward Space File = No\n"
" BSF at EOM = yes\n\n"
"to your Device resource in the Storage conf file.\n");
Pmsg0(-1, "\n\nIt looks like the test worked this time, please add:\n\n"
" Hardware End of Medium = No\n"
" Fast Forward Space File = No\n"
" BSF at EOM = yes\n\n"
"to your Device resource in the Storage conf file.\n");
Pmsg1(0, _("Starting scan at file %u\n"), dev->file);
for (;;) {
if ((stat = read(dev->fd, buf, sizeof(buf))) < 0) {
Pmsg1(0, _("Starting scan at file %u\n"), dev->file);
for (;;) {
if ((stat = read(dev->fd, buf, sizeof(buf))) < 0) {
Pmsg2(0, "Bad status from read %d. ERR=%s\n", stat, strerror_dev(dev));
Pmsg2(0, "Bad status from read %d. ERR=%s\n", stat, strerror_dev(dev));
printf("%d block%s of %d bytes in file %d\n",
blocks, blocks>1?"s":"", block_size, dev->file);
printf("%d block%s of %d bytes in file %d\n",
blocks, blocks>1?"s":"", block_size, dev->file);
}
Dmsg1(200, "read status = %d\n", stat);
/* sleep(1); */
if (stat != block_size) {
}
Dmsg1(200, "read status = %d\n", stat);
/* sleep(1); */
if (stat != block_size) {
printf("%d block%s of %d bytes in file %d\n",
blocks, blocks>1?"s":"", block_size, dev->file);
printf("%d block%s of %d bytes in file %d\n",
blocks, blocks>1?"s":"", block_size, dev->file);
- /* Two reads of zero means end of tape */
- if (dev->state & ST_EOF)
- dev->state |= ST_EOT;
- else {
- dev->state |= ST_EOF;
- dev->file++;
- }
- if (dev->state & ST_EOT) {
+ /* Two reads of zero means end of tape */
+ if (dev->state & ST_EOF)
+ dev->state |= ST_EOT;
+ else {
+ dev->state |= ST_EOF;
+ dev->file++;
+ }
+ if (dev->state & ST_EOT) {
for (;;) {
if (!read_block_from_device(dcr, NO_BLOCK_NUMBER_CHECK)) {
Dmsg1(100, "!read_block(): ERR=%s\n", strerror_dev(dev));
for (;;) {
if (!read_block_from_device(dcr, NO_BLOCK_NUMBER_CHECK)) {
Dmsg1(100, "!read_block(): ERR=%s\n", strerror_dev(dev));
printf("%d block%s of %d bytes in file %d\n",
blocks, blocks>1?"s":"", block_size, dev->file);
printf("%d block%s of %d bytes in file %d\n",
blocks, blocks>1?"s":"", block_size, dev->file);
printf("%d block%s of %d bytes in file %d\n",
blocks, blocks>1?"s":"", block_size, dev->file);
printf("%d block%s of %d bytes in file %d\n",
blocks, blocks>1?"s":"", block_size, dev->file);
printf("%d block%s of %d bytes in file %d\n",
blocks, blocks>1?"s":"", block_size, dev->file);
printf("%d block%s of %d bytes in file %d\n",
blocks, blocks>1?"s":"", block_size, dev->file);
printf("%d block%s of %d bytes in file %d\n",
blocks, blocks>1?"s":"", block_size, dev->file);
printf("%d block%s of %d bytes in file %d\n",
blocks, blocks>1?"s":"", block_size, dev->file);
}
blocks++;
tot_blocks++;
bytes += block->block_len;
Dmsg6(100, "Blk_blk=%u dev_blk=%u blen=%u bVer=%d SessId=%u SessTim=%u\n",
}
blocks++;
tot_blocks++;
bytes += block->block_len;
Dmsg6(100, "Blk_blk=%u dev_blk=%u blen=%u bVer=%d SessId=%u SessTim=%u\n",
- block->BlockNumber, dev->block_num, block->block_len, block->BlockVer,
- block->VolSessionId, block->VolSessionTime);
+ block->BlockNumber, dev->block_num, block->block_len, block->BlockVer,
+ block->VolSessionId, block->VolSessionTime);
- DEV_RECORD *rec = new_record();
- read_record_from_block(block, rec);
+ DEV_RECORD *rec = new_record();
+ read_record_from_block(block, rec);
Pmsg8(-1, "Blk_block: %u dev_blk=%u blen=%u First rec FI=%s SessId=%u SessTim=%u Strm=%s rlen=%d\n",
Pmsg8(-1, "Blk_block: %u dev_blk=%u blen=%u First rec FI=%s SessId=%u SessTim=%u Strm=%s rlen=%d\n",
- block->BlockNumber, dev->block_num, block->block_len,
- FI_to_ascii(rec->FileIndex), rec->VolSessionId, rec->VolSessionTime,
- stream_to_ascii(rec->Stream, rec->FileIndex), rec->data_len);
- rec->remainder = 0;
- free_record(rec);
+ block->BlockNumber, dev->block_num, block->block_len,
+ FI_to_ascii(rec->FileIndex), rec->VolSessionId, rec->VolSessionTime,
+ stream_to_ascii(rec->Stream, rec->FileIndex), rec->data_len);
+ rec->remainder = 0;
+ free_record(rec);
Dmsg1(20, "MaxVolSize=%s\n", edit_uint64(dev->max_volume_size, ec1));
/* Use fixed block size to simplify read back */
Dmsg1(20, "MaxVolSize=%s\n", edit_uint64(dev->max_volume_size, ec1));
/* Use fixed block size to simplify read back */
dev->min_block_size = dev->max_block_size;
set_volume_name("TestVolume1", 1);
dev->min_block_size = dev->max_block_size;
set_volume_name("TestVolume1", 1);
if (!write_session_label(dcr, SOS_LABEL)) {
set_jcr_job_status(jcr, JS_ErrorTerminated);
Jmsg1(jcr, M_FATAL, 0, _("Write session label failed. ERR=%s\n"),
if (!write_session_label(dcr, SOS_LABEL)) {
set_jcr_job_status(jcr, JS_ErrorTerminated);
Jmsg1(jcr, M_FATAL, 0, _("Write session label failed. ERR=%s\n"),
* Generate data as if from File daemon, write to device
*/
jcr->dcr->VolFirstIndex = 0;
* Generate data as if from File daemon, write to device
*/
jcr->dcr->VolFirstIndex = 0;
uint32_t *lp = (uint32_t *)rec.data;
lp[0] += lp[13];
for (i=1; i < (rec.data_len-sizeof(uint32_t))/sizeof(uint32_t)-1; i++) {
uint32_t *lp = (uint32_t *)rec.data;
lp[0] += lp[13];
for (i=1; i < (rec.data_len-sizeof(uint32_t))/sizeof(uint32_t)-1; i++) {
- rec.FileIndex, rec.VolSessionId, stream_to_ascii(rec.Stream, rec.FileIndex),
- rec.data_len);
+ rec.FileIndex, rec.VolSessionId, stream_to_ascii(rec.Stream, rec.FileIndex),
+ rec.data_len);
Dmsg2(150, "!write_record_to_block data_len=%d rem=%d\n", rec.data_len,
Dmsg2(150, "!write_record_to_block data_len=%d rem=%d\n", rec.data_len,
- rec.remainder);
-
- /* Write block to tape */
- if (!flush_block(block, 1)) {
- break;
- }
-
- /* Every 5000 blocks (approx 322MB) report where we are.
- */
- if ((block->BlockNumber % 5000) == 0) {
- now = time(NULL);
- now -= jcr->run_time;
- if (now <= 0) {
- now = 1; /* prevent divide error */
- }
- kbs = (double)dev->VolCatInfo.VolCatBytes / (1000.0 * (double)now);
+ rec.remainder);
+
+ /* Write block to tape */
+ if (!flush_block(block, 1)) {
+ break;
+ }
+
+ /* Every 5000 blocks (approx 322MB) report where we are.
+ */
+ if ((block->BlockNumber % 5000) == 0) {
+ now = time(NULL);
+ now -= jcr->run_time;
+ if (now <= 0) {
+ now = 1; /* prevent divide error */
+ }
+ kbs = (double)dev->VolCatInfo.VolCatBytes / (1000.0 * (double)now);
Pmsg4(-1, "Wrote blk_block=%u, dev_blk_num=%u VolBytes=%s rate=%.1f KB/s\n",
Pmsg4(-1, "Wrote blk_block=%u, dev_blk_num=%u VolBytes=%s rate=%.1f KB/s\n",
- block->BlockNumber, dev->block_num,
- edit_uint64_with_commas(dev->VolCatInfo.VolCatBytes, ec1), (float)kbs);
- }
- /* Every 15000 blocks (approx 1GB) write an EOF.
- */
- if ((block->BlockNumber % 15000) == 0) {
+ block->BlockNumber, dev->block_num,
+ edit_uint64_with_commas(dev->VolCatInfo.VolCatBytes, ec1), (float)kbs);
+ }
+ /* Every 15000 blocks (approx 1GB) write an EOF.
+ */
+ if ((block->BlockNumber % 15000) == 0) {
- /* Get out after writing 10 blocks to the second tape */
- if (++BlockNumber > 10 && stop != 0) { /* get out */
- break;
- }
+ /* Get out after writing 10 blocks to the second tape */
+ if (++BlockNumber > 10 && stop != 0) { /* get out */
+ break;
+ }
}
jcr->JobBytes += rec.data_len; /* increment bytes this job */
Dmsg4(190, "write_record FI=%s SessId=%d Strm=%s len=%d\n",
}
jcr->JobBytes += rec.data_len; /* increment bytes this job */
Dmsg4(190, "write_record FI=%s SessId=%d Strm=%s len=%d\n",
- FI_to_ascii(rec.FileIndex), rec.VolSessionId,
- stream_to_ascii(rec.Stream, rec.FileIndex), rec.data_len);
+ FI_to_ascii(rec.FileIndex), rec.VolSessionId,
+ stream_to_ascii(rec.Stream, rec.FileIndex), rec.data_len);
}
}
if (vol_num > 1) {
Dmsg0(100, "Write_end_session_label()\n");
/* Create Job status for end of session label */
if (!job_canceled(jcr) && ok) {
}
}
if (vol_num > 1) {
Dmsg0(100, "Write_end_session_label()\n");
/* Create Job status for end of session label */
if (!job_canceled(jcr) && ok) {
}
if (!write_session_label(dcr, EOS_LABEL)) {
Pmsg1(000, _("Error writting end session label. ERR=%s\n"), strerror_dev(dev));
}
if (!write_session_label(dcr, EOS_LABEL)) {
Pmsg1(000, _("Error writting end session label. ERR=%s\n"), strerror_dev(dev));
}
/* Write out final block of this session */
if (!write_block_to_device(dcr)) {
Pmsg0(-1, _("Set ok=false after write_block_to_device.\n"));
}
/* Write out final block of this session */
if (!write_block_to_device(dcr)) {
Pmsg0(-1, _("Set ok=false after write_block_to_device.\n"));
write(fd, first_block->buf, first_block->buf_len);
close(fd);
Pmsg2(-1, "Wrote state file last_block_num1=%d last_block_num2=%d\n",
write(fd, first_block->buf, first_block->buf_len);
close(fd);
Pmsg2(-1, "Wrote state file last_block_num1=%d last_block_num2=%d\n",
} else {
berrno be;
Pmsg2(-1, _("Could not create state file: %s ERR=%s\n"), buf,
} else {
berrno be;
Pmsg2(-1, _("Could not create state file: %s ERR=%s\n"), buf,
}
Pmsg4(-1, _("\n\nDone filling tape%s at %d:%d. Now beginning re-read of %stape ...\n"),
simple?"":"s", jcr->dcr->dev->file, jcr->dcr->dev->block_num, simple?"":"first ");
jcr->dcr->block = block;
}
Pmsg4(-1, _("\n\nDone filling tape%s at %d:%d. Now beginning re-read of %stape ...\n"),
simple?"":"s", jcr->dcr->dev->file, jcr->dcr->dev->block_num, simple?"":"first ");
jcr->dcr->block = block;
if (state_level != btape_state_level) {
Pmsg0(-1, "\nThe state file level has changed. You must redo\n"
"the fill command.\n");
if (state_level != btape_state_level) {
Pmsg0(-1, "\nThe state file level has changed. You must redo\n"
"the fill command.\n");
/* Multiple Volume tape */
/* Close device so user can use autochanger if desired */
if (dev_cap(dev, CAP_OFFLINEUNMOUNT)) {
/* Multiple Volume tape */
/* Close device so user can use autochanger if desired */
if (dev_cap(dev, CAP_OFFLINEUNMOUNT)) {
}
}
/*
* We now have the first tape mounted.
* Note, re-reading last block may have caused us to
}
}
/*
* We now have the first tape mounted.
* Note, re-reading last block may have caused us to
- /* Read the first 1000 records */
- Pmsg0(-1, _("Reading the first 1000 records.\n"));
+ /* Read the first 10000 records */
+ Pmsg0(-1, _("Reading the first 10000 records.\n"));
quickie_count = 0;
read_records(dcr, quickie_cb, my_mount_next_read_volume);
Pmsg4(-1, _("Reposition from %u:%u to %u:%u\n"), dev->file, dev->block_num,
quickie_count = 0;
read_records(dcr, quickie_cb, my_mount_next_read_volume);
Pmsg4(-1, _("Reposition from %u:%u to %u:%u\n"), dev->file, dev->block_num,
if (!reposition_dev(dev, last_file, last_block_num)) {
Pmsg1(-1, "Reposition error. ERR=%s\n", strerror_dev(dev));
goto bail_out;
if (!reposition_dev(dev, last_file, last_block_num)) {
Pmsg1(-1, "Reposition error. ERR=%s\n", strerror_dev(dev));
goto bail_out;
/* Now find and compare the last block */
Pmsg4(-1, _("Reposition from %u:%u to %u:%u\n"), dev->file, dev->block_num,
/* Now find and compare the last block */
Pmsg4(-1, _("Reposition from %u:%u to %u:%u\n"), dev->file, dev->block_num,
if (!reposition_dev(dev, last_file, last_block_num)) {
Pmsg1(-1, "Reposition error. ERR=%s\n", strerror_dev(dev));
goto bail_out;
if (!reposition_dev(dev, last_file, last_block_num)) {
Pmsg1(-1, "Reposition error. ERR=%s\n", strerror_dev(dev));
goto bail_out;
static bool quickie_cb(DCR *dcr, DEV_RECORD *rec)
{
DEVICE *dev = dcr->dev;
if (dev->file != 0) {
Pmsg3(-1, "ERROR! device at %d:%d count=%d\n", dev->file, dev->block_num,
static bool quickie_cb(DCR *dcr, DEV_RECORD *rec)
{
DEVICE *dev = dcr->dev;
if (dev->file != 0) {
Pmsg3(-1, "ERROR! device at %d:%d count=%d\n", dev->file, dev->block_num,
Pmsg2(-1, "1000 records read now at %d:%d\n", dev->file, dev->block_num);
}
Pmsg2(-1, "1000 records read now at %d:%d\n", dev->file, dev->block_num);
}
this_block_num = dev->block_num;
if (!write_block_to_dev(dcr)) {
Pmsg3(000, "Last block at: %u:%u this_dev_block_num=%d\n",
this_block_num = dev->block_num;
if (!write_block_to_dev(dcr)) {
Pmsg3(000, "Last block at: %u:%u this_dev_block_num=%d\n",
- /*
- * This is 1st tape, so save first tape info separate
- * from second tape info
- */
- last_block_num1 = last_block_num;
- last_file1 = last_file;
- last_block1 = dup_block(last_block);
- last_block2 = dup_block(last_block);
- first_block = dup_block(block); /* first block second tape */
+ /*
+ * This is 1st tape, so save first tape info separate
+ * from second tape info
+ */
+ last_block_num1 = last_block_num;
+ last_file1 = last_file;
+ last_block1 = dup_block(last_block);
+ last_block2 = dup_block(last_block);
+ first_block = dup_block(block); /* first block second tape */
dump_block(last_block, "Last block written");
Pmsg0(-1, "\n");
dump_block(block, "Block not written");
}
if (stop == 0) {
dump_block(last_block, "Last block written");
Pmsg0(-1, "\n");
dump_block(block, "Block not written");
}
if (stop == 0) {
- eot_block = block->BlockNumber;
- eot_block_len = block->block_len;
- eot_FileIndex = file_index;
- stop = 1;
+ eot_block = block->BlockNumber;
+ eot_block_len = block->block_len;
+ eot_FileIndex = file_index;
+ stop = 1;
kbs = (double)dev->VolCatInfo.VolCatBytes / (1000 * now);
vol_size = dev->VolCatInfo.VolCatBytes;
Pmsg4(000, "End of tape %d:%d. VolumeCapacity=%s. Write rate = %.1f KB/s\n",
kbs = (double)dev->VolCatInfo.VolCatBytes / (1000 * now);
vol_size = dev->VolCatInfo.VolCatBytes;
Pmsg4(000, "End of tape %d:%d. VolumeCapacity=%s. Write rate = %.1f KB/s\n",
- dev->file, dev->block_num,
- edit_uint64_with_commas(dev->VolCatInfo.VolCatBytes, ec1), kbs);
+ dev->file, dev->block_num,
+ edit_uint64_with_commas(dev->VolCatInfo.VolCatBytes, ec1), kbs);
}
if (!write_record_to_block(block, rec)) {
Pmsg0(0, _("Error writing record to block.\n"));
}
if (!write_record_to_block(block, rec)) {
Pmsg0(0, _("Error writing record to block.\n"));
}
if (!write_block_to_dev(dcr)) {
Pmsg0(0, _("Error writing block to device.\n"));
}
if (!write_block_to_dev(dcr)) {
Pmsg0(0, _("Error writing block to device.\n"));
*p = block_num;
stat = write(dev->fd, block->buf, block->buf_len);
if (stat == (int)block->buf_len) {
*p = block_num;
stat = write(dev->fd, block->buf, block->buf_len);
if (stat == (int)block->buf_len) {
block->binbuf = block->buf_len;
block->bufp = block->buf + block->binbuf;
if (!write_block_to_dev(dcr)) {
block->binbuf = block->buf_len;
block->bufp = block->buf + block->binbuf;
if (!write_block_to_dev(dcr)) {
{"wr", wrcmd, "write a single Bacula block"},
{"rr", rrcmd, "read a single record"},
{"qfill", qfillcmd, "quick fill command"},
{"wr", wrcmd, "write a single Bacula block"},
{"rr", rrcmd, "read a single record"},
{"qfill", qfillcmd, "quick fill command"},
found = false;
parse_args(cmd, &args, &argc, argk, argv, MAX_CMD_ARGS);
for (i=0; i<comsize; i++) /* search for command */
found = false;
parse_args(cmd, &args, &argc, argk, argv, MAX_CMD_ARGS);
for (i=0; i<comsize; i++) /* search for command */
- if (argc > 0 && fstrsch(argk[0], commands[i].key)) {
- (*commands[i].func)(); /* go execute command */
- found = true;
- break;
- }
+ if (argc > 0 && fstrsch(argk[0], commands[i].key)) {
+ (*commands[i].func)(); /* go execute command */
+ found = true;
+ break;
+ }
-bool dir_update_file_attributes(DCR *dcr, DEV_RECORD *rec) { return 1;}
-bool dir_send_job_status(JCR *jcr) {return 1;}
+bool dir_update_file_attributes(DCR *dcr, DEV_RECORD *rec) { return 1;}
+bool dir_send_job_status(JCR *jcr) {return 1;}
Pmsg1(-1, "%s", dev->errmsg); /* print reason */
if (dcr->VolumeName[0] == 0 || strcmp(dcr->VolumeName, "TestVolume2") == 0) {
fprintf(stderr, "Mount second Volume on device %s and press return when ready: ",
Pmsg1(-1, "%s", dev->errmsg); /* print reason */
if (dcr->VolumeName[0] == 0 || strcmp(dcr->VolumeName, "TestVolume2") == 0) {
fprintf(stderr, "Mount second Volume on device %s and press return when ready: ",
}
kbs = (double)VolBytes / (1000.0 * (double)now);
Pmsg3(-1, "Read block=%u, VolBytes=%s rate=%.1f KB/s\n", block->BlockNumber,
}
kbs = (double)VolBytes / (1000.0 * (double)now);
Pmsg3(-1, "Read block=%u, VolBytes=%s rate=%.1f KB/s\n", block->BlockNumber,
- dev->state &= ~ST_READ;
- if (!acquire_device_for_read(jcr, dev)) {
- Pmsg2(0, "Cannot open Dev=%s, Vol=%s\n", dev_name(dev), dcr->VolumeName);
+ dev->clear_read();
+ if (!acquire_device_for_read(dcr)) {
+ Pmsg2(0, "Cannot open Dev=%s, Vol=%s\n", dev->print_name(), dcr->VolumeName);