X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=bacula%2Fsrc%2Fstored%2Fbscan.c;h=265a6201d5c1907f2333dd32c9d46fd73918c50f;hb=ce462cd94d90f4785b622cedc2ca48d616fe3f07;hp=c65348f6c8e642cce3216b54ff9963dde6210b6e;hpb=2693c864ec2650db5f1b061c4414d3430d5a7a65;p=bacula%2Fbacula diff --git a/bacula/src/stored/bscan.c b/bacula/src/stored/bscan.c index c65348f6c8..265a6201d5 100644 --- a/bacula/src/stored/bscan.c +++ b/bacula/src/stored/bscan.c @@ -44,6 +44,7 @@ /* Dummy functions */ int generate_daemon_event(JCR *jcr, const char *event) { return 1; } +extern bool parse_sd_config(CONFIG *config, const char *configfile, int exit_code); /* Forward referenced functions */ static void do_scan(void); @@ -102,6 +103,7 @@ static int num_pools = 0; static int num_media = 0; static int num_files = 0; +static CONFIG *config; #define CONFIG_FILE "bacula-sd.conf" char *configfile = NULL; STORES *me = NULL; /* our Global resource */ @@ -154,7 +156,7 @@ int main (int argc, char *argv[]) OSDependentInit(); - while ((ch = getopt(argc, argv, "b:c:dD:h:p:mn:pP:rsStu:vV:w:?")) != -1) { + while ((ch = getopt(argc, argv, "b:c:dD:h:p:mn:pP:rsSt:u:vV:w:?")) != -1) { switch (ch) { case 'S' : showProgress = true; @@ -251,7 +253,8 @@ int main (int argc, char *argv[]) configfile = bstrdup(CONFIG_FILE); } - parse_config(configfile); + config = new_config_parser(); + parse_sd_config(config, configfile, M_ERROR_TERM); LockRes(); me = (STORES *)GetNextRes(R_STORAGE, NULL); if (!me) { @@ -290,7 +293,7 @@ int main (int argc, char *argv[]) struct stat sb; fstat(dev->fd(), &sb); currentVolumeSize = sb.st_size; - Pmsg1(000, _("First Volume Size = %sn"), + Pmsg1(000, _("First Volume Size = %s\n"), edit_uint64(currentVolumeSize, ed1)); } @@ -364,7 +367,7 @@ static bool bscan_mount_next_read_volume(DCR *dcr) struct stat sb; fstat(dev->fd(), &sb); currentVolumeSize = sb.st_size; - Pmsg1(000, _("First Volume Size = %sn"), + Pmsg1(000, _("First Volume Size = %s\n"), edit_uint64(currentVolumeSize, ed1)); } return stat; @@ -619,7 +622,7 @@ static bool record_cb(DCR *dcr, DEV_RECORD *rec) jr.VolSessionTime = mjcr->VolSessionTime; jr.JobTDate = (utime_t)mjcr->start_time; jr.ClientId = mjcr->ClientId; - if (!db_update_job_end_record(bjcr, db, &jr)) { + if (!db_update_job_end_record(bjcr, db, &jr, false)) { Pmsg1(0, _("Could not update job record. ERR=%s\n"), db_strerror(db)); } mjcr->read_dcr = NULL; @@ -845,7 +848,11 @@ static int create_file_attributes_record(B_DB *db, JCR *mjcr, ar.ClientId = mjcr->ClientId; ar.JobId = mjcr->JobId; ar.Stream = rec->Stream; - ar.FileIndex = rec->FileIndex; + if (type == FT_DELETED) { + ar.FileIndex = 0; + } else { + ar.FileIndex = rec->FileIndex; + } ar.attr = ap; if (dcr->VolFirstIndex == 0) { dcr->VolFirstIndex = rec->FileIndex; @@ -1118,7 +1125,7 @@ static int update_job_record(B_DB *db, JOB_DBR *jr, SESSION_LABEL *elabel, return 1; } - if (!db_update_job_end_record(bjcr, db, jr)) { + if (!db_update_job_end_record(bjcr, db, jr, false)) { Pmsg2(0, _("Could not update JobId=%u record. ERR=%s\n"), jr->JobId, db_strerror(db)); free_jcr(mjcr); return 0;