This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
- version 2 as ammended with additional clauses defined in the
+ version 2 as amended with additional clauses defined in the
file LICENSE in the main source directory.
This program is distributed in the hope that it will be useful,
{
fprintf(stderr, _(
"Copyright (C) 2001-2005 Kern Sibbald.\n"
-"\nVersion: " VERSION " (" BDATE ")\n\n"
+"\nVersion: %s (%s)\n\n"
"Usage: bscan [ options ] <bacula-archive>\n"
" -b bootstrap specify a bootstrap file\n"
" -c <file> specify configuration file\n"
" -v verbose\n"
" -V <Volumes> specify Volume names (separated by |)\n"
" -w <dir> specify working directory (default from conf file)\n"
-" -? print this message\n\n"));
+" -? print this message\n\n"), VERSION, BDATE);
exit(1);
}
struct stat stat_buf;
char *VolumeName = NULL;
+ setlocale(LC_ALL, "");
+ bindtextdomain("bacula", LOCALEDIR);
+ textdomain("bacula");
+
my_name_is(argc, argv, "bscan");
init_msg(NULL, NULL);
if (!bjcr) {
exit(1);
}
- dev = bjcr->dcr->dev;
+ dev = bjcr->read_dcr->dev;
if (showProgress) {
char ed1[50];
struct stat sb;
}
do_scan();
- printf("Records %sadded or updated in the catalog:\n%7d Media\n%7d Pool\n%7d Job\n%7d File\n",
- update_db?"":"would have been ",
- num_media, num_pools, num_jobs, num_files);
+ if (update_db) {
+ printf("Records added or updated in the catalog:\n%7d Media\n%7d Pool\n%7d Job\n%7d File\n",
+ num_media, num_pools, num_jobs, num_files);
+ }
+ else {
+ printf("Records would have been added or updated in the catalog:\n%7d Media\n%7d Pool\n%7d Job\n%7d File\n",
+ num_media, num_pools, num_jobs, num_files);
+ }
free_jcr(bjcr);
term_dev(dev);
// mdcr->EndBlock = (uint32_t)dcr->file_addr;
// mdcr->EndFile = (uint32_t)(dcr->file_addr >> 32);
}
+ mjcr->read_dcr->VolLastIndex = dcr->VolLastIndex;
if (!create_jobmedia_record(db, mjcr)) {
Pmsg2(000, _("Could not create JobMedia record for Volume=%s Job=%s\n"),
dev->VolCatInfo.VolCatName, mjcr->Job);
/* Detach bscan's jcr as we are not a real Job on the tape */
- read_records(bjcr->dcr, record_cb, bscan_mount_next_read_volume);
+ read_records(bjcr->read_dcr, record_cb, bscan_mount_next_read_volume);
free_attr(attr);
}
if (rec->data_len > 0) {
mr.VolBytes += rec->data_len + WRITE_RECHDR_LENGTH; /* Accumulate Volume bytes */
- if (showProgress) {
+ if (showProgress && currentVolumeSize > 0) {
int pct = (mr.VolBytes * 100) / currentVolumeSize;
if (pct != last_pct) {
- fprintf(stdout, "done: %d%%\n", pct);
+ fprintf(stdout, _("done: %d%%\n"), pct);
fflush(stdout);
last_pct = pct;
}
/* process label, if Job record exists don't update db */
mjcr = create_job_record(db, &jr, &label, rec);
- dcr = mjcr->dcr;
+ dcr = mjcr->read_dcr;
update_db = save_update_db;
jr.PoolId = pr.PoolId;
+#ifdef xxx
/* Set start positions into JCR */
if (dev->is_tape()) {
/*
dcr->StartBlock = (uint32_t)dev->file_addr;
dcr->StartFile = (uint32_t)(dev->file_addr >> 32);
}
+#endif
mjcr->start_time = jr.StartTime;
mjcr->JobLevel = jr.JobLevel;
mjcr->JobStatus = JS_Terminated;
/* Create JobMedia record */
+ mjcr->read_dcr->VolLastIndex = dcr->VolLastIndex;
create_jobmedia_record(db, mjcr);
- dev->attached_dcrs->remove(mjcr->dcr);
+ dev->attached_dcrs->remove(mjcr->read_dcr);
free_jcr(mjcr);
break;
if (!db_update_job_end_record(bjcr, db, &jr)) {
Pmsg1(0, _("Could not update job record. ERR=%s\n"), db_strerror(db));
}
- mjcr->dcr = NULL;
+ mjcr->read_dcr = NULL;
free_jcr(mjcr);
}
}
}
return true;
}
- dcr = mjcr->dcr;
+ dcr = mjcr->read_dcr;
if (dcr->VolFirstIndex == 0) {
dcr->VolFirstIndex = block->FirstIndex;
}
free_dcr(jcr->dcr);
jcr->dcr = NULL;
}
+ if (jcr->read_dcr) {
+ free_dcr(jcr->read_dcr);
+ jcr->read_dcr = NULL;
+ }
Dmsg0(200, "End bscan free_jcr\n");
}
char *fname, char *lname, int type,
char *ap, DEV_RECORD *rec)
{
- DCR *dcr = mjcr->dcr;
+ DCR *dcr = mjcr->read_dcr;
ar.fname = fname;
ar.link = lname;
ar.ClientId = mjcr->ClientId;
static int create_jobmedia_record(B_DB *db, JCR *mjcr)
{
JOBMEDIA_DBR jmr;
- DCR *dcr = mjcr->dcr;
+ DCR *dcr = mjcr->read_dcr;
if (dev->is_tape()) {
dcr->EndBlock = dev->EndBlock;
jmr.JobId = mjcr->JobId;
jmr.MediaId = mr.MediaId;
jmr.FirstIndex = dcr->VolFirstIndex;
- jmr.LastIndex = dcr->FileIndex;
+ jmr.LastIndex = dcr->VolLastIndex;
jmr.StartFile = dcr->StartFile;
jmr.EndFile = dcr->EndFile;
jmr.StartBlock = dcr->StartBlock;
jobjcr->VolSessionId = rec->VolSessionId;
jobjcr->VolSessionTime = rec->VolSessionTime;
jobjcr->ClientId = jr->ClientId;
- new_dcr(jobjcr, dev);
+ jobjcr->read_dcr = new_dcr(jobjcr, dev);
+
return jobjcr;
}
bool dir_update_file_attributes(DCR *dcr, DEV_RECORD *rec) { return 1;}
bool dir_send_job_status(JCR *jcr) {return 1;}
int generate_job_event(JCR *jcr, const char *event) { return 1; }
-VOLRES *new_volume(const char *VolumeName, DEVICE *dev) { return NULL; }
+VOLRES *new_volume(DCR *dcr, const char *VolumeName) { return NULL; }
bool free_volume(DEVICE *dev) { return true; }
+void free_unused_volume(DCR *dcr) { }
bool dir_ask_sysop_to_mount_volume(DCR *dcr)
{
offline_dev(dev);
}
force_close_device(dev);
- fprintf(stderr, "Mount Volume \"%s\" on device %s and press return when ready: ",
+ fprintf(stderr, _("Mount Volume \"%s\" on device %s and press return when ready: "),
dcr->VolumeName, dev->print_name());
getchar();
return true;