"\nVersion: " VERSION " (" BDATE ")\n\n"
"Usage: bscan [ options ] <bacula-archive>\n"
" -b bootstrap specify a bootstrap file\n"
"\nVersion: " VERSION " (" BDATE ")\n\n"
"Usage: bscan [ options ] <bacula-archive>\n"
" -b bootstrap specify a bootstrap file\n"
if ((db=db_init_database(NULL, db_name, db_user, db_password, db_host, 0, NULL)) == NULL) {
Emsg0(M_ERROR_TERM, 0, _("Could not init Bacula database\n"));
if ((db=db_init_database(NULL, db_name, db_user, db_password, db_host, 0, NULL)) == NULL) {
Emsg0(M_ERROR_TERM, 0, _("Could not init Bacula database\n"));
num_media, num_pools, num_jobs, num_files);
free_jcr(bjcr);
num_media, num_pools, num_jobs, num_files);
free_jcr(bjcr);
static bool bscan_mount_next_read_volume(JCR *jcr, DEVICE *dev, DEV_BLOCK *block)
{
Dmsg1(100, "Walk attached jcrs. Volume=%s\n", dev->VolCatInfo.VolCatName);
static bool bscan_mount_next_read_volume(JCR *jcr, DEVICE *dev, DEV_BLOCK *block)
{
Dmsg1(100, "Walk attached jcrs. Volume=%s\n", dev->VolCatInfo.VolCatName);
* have the Volume list, but we get attached.
*/
bool stat = mount_next_read_volume(jcr, dev, block);
* have the Volume list, but we get attached.
*/
bool stat = mount_next_read_volume(jcr, dev, block);
- /* we must once more detach ourselves (attached by mount_next ...) */
- detach_jcr_from_device(dev, jcr); /* detach bscan jcr */
+
+ if (showProgress) {
+ struct stat sb;
+ fstat(dev->fd, &sb);
+ currentVolumeSize = sb.st_size;
+ Pmsg1(000, _("Current Volume Size = %" llu "\n"), currentVolumeSize);
+ }
memset(&fr, 0, sizeof(fr));
/* Detach bscan's jcr as we are not a real Job on the tape */
memset(&fr, 0, sizeof(fr));
/* Detach bscan's jcr as we are not a real Job on the tape */
- read_records(bjcr, dev, record_cb, bscan_mount_next_read_volume);
- release_device(bjcr);
+ read_records(bjcr->dcr, record_cb, bscan_mount_next_read_volume);
+// release_device(bjcr);
* false if error
*/
static bool record_cb(JCR *bjcr, DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *rec)
* false if error
*/
static bool record_cb(JCR *bjcr, DEVICE *dev, DEV_BLOCK *block, DEV_RECORD *rec)
if (list_records) {
Pmsg5(000, _("Record: SessId=%u SessTim=%u FileIndex=%d Stream=%d len=%u\n"),
rec->VolSessionId, rec->VolSessionTime, rec->FileIndex,
if (list_records) {
Pmsg5(000, _("Record: SessId=%u SessTim=%u FileIndex=%d Stream=%d len=%u\n"),
rec->VolSessionId, rec->VolSessionTime, rec->FileIndex,
Pmsg1(000, _("Media type \"%s\" is OK.\n"), mr.MediaType);
}
/* Reset some JCR variables */
Pmsg1(000, _("Media type \"%s\" is OK.\n"), mr.MediaType);
}
/* Reset some JCR variables */
dcr->VolFirstIndex = dcr->FileIndex = 0;
dcr->StartBlock = dcr->EndBlock = 0;
dcr->StartFile = dcr->EndFile = 0;
dcr->VolFirstIndex = dcr->FileIndex = 0;
dcr->StartBlock = dcr->EndBlock = 0;
dcr->StartFile = dcr->EndFile = 0;
}
unser_session_label(&label, rec);
memset(&jr, 0, sizeof(jr));
}
unser_session_label(&label, rec);
memset(&jr, 0, sizeof(jr));
if (db_get_job_record(bjcr, db, &jr)) {
/* Job record already exists in DB */
update_db = false; /* don't change db in create_job_record */
if (db_get_job_record(bjcr, db, &jr)) {
/* Job record already exists in DB */
update_db = false; /* don't change db in create_job_record */
/* Create JobMedia record */
create_jobmedia_record(db, mjcr);
/* Create JobMedia record */
create_jobmedia_record(db, mjcr);
jr.JobStatus = JS_ErrorTerminated;
jr.JobFiles = mjcr->JobFiles;
jr.JobBytes = mjcr->JobBytes;
jr.JobStatus = JS_ErrorTerminated;
jr.JobFiles = mjcr->JobFiles;
jr.JobBytes = mjcr->JobBytes;
if (!db_update_job_end_record(bjcr, db, &jr)) {
Pmsg1(0, _("Could not update job record. ERR=%s\n"), db_strerror(db));
}
if (!db_update_job_end_record(bjcr, db, &jr)) {
Pmsg1(0, _("Could not update job record. ERR=%s\n"), db_strerror(db));
}
edit_uint64_with_commas(rec->Block, ed3),
edit_uint64_with_commas(mr.VolBytes, ed4));
}
edit_uint64_with_commas(rec->Block, ed3),
edit_uint64_with_commas(mr.VolBytes, ed4));
}
- if (db_get_file_attributes_record(bjcr, db, attr->fname, NULL, &fr)) {
- if (verbose > 1) {
- Pmsg1(000, _("File record already exists for: %s\n"), attr->fname);
- }
- } else {
- create_file_attributes_record(db, mjcr, attr->fname, attr->lname,
+ create_file_attributes_record(db, mjcr, attr->fname, attr->lname,
- Pmsg1(000, _("Updated Job termination record for new JobId=%u\n"), jr->JobId);
+ Pmsg2(000, _("Updated Job termination record for JobId=%u TermStat=%c\n"), jr->JobId,
+ jr->JobStatus);
jobjcr->VolSessionId = rec->VolSessionId;
jobjcr->VolSessionTime = rec->VolSessionTime;
jobjcr->ClientId = jr->ClientId;
jobjcr->VolSessionId = rec->VolSessionId;
jobjcr->VolSessionTime = rec->VolSessionTime;
jobjcr->ClientId = jr->ClientId;
-bool dir_get_volume_info(JCR *jcr, enum get_vol_info_rw writing) { return 1;}
-bool dir_find_next_appendable_volume(JCR *jcr) { return 1;}
-bool dir_update_volume_info(JCR *jcr, bool relabel) { return 1; }
-bool dir_create_jobmedia_record(JCR *jcr) { return 1; }
-bool dir_ask_sysop_to_create_appendable_volume(JCR *jcr) { return 1; }
-bool dir_update_file_attributes(JCR *jcr, DEV_RECORD *rec) { return 1;}
+bool dir_get_volume_info(DCR *dcr, enum get_vol_info_rw writing) { return 1;}
+bool dir_find_next_appendable_volume(DCR *dcr) { return 1;}
+bool dir_update_volume_info(DCR *dcr, bool relabel) { return 1; }
+bool dir_create_jobmedia_record(DCR *dcr) { return 1; }
+bool dir_ask_sysop_to_create_appendable_volume(DCR *dcr) { return 1; }
+bool dir_update_file_attributes(DCR *dcr, DEV_RECORD *rec) { return 1;}
fprintf(stderr, _("Mount Volume \"%s\" on device \"%s\" and press return when ready: "),
jcr->VolumeName, dev_name(dev));
getchar();
fprintf(stderr, _("Mount Volume \"%s\" on device \"%s\" and press return when ready: "),
jcr->VolumeName, dev_name(dev));
getchar();