From bfc995ecac7c91731199b570aaa7e00b69c85521 Mon Sep 17 00:00:00 2001 From: Eric Bollengier Date: Fri, 19 Dec 2008 20:53:05 +0000 Subject: [PATCH] ebl Cleanup director VolParam struct git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@8195 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/src/cats/cats.h | 4 ---- bacula/src/cats/sql_get.c | 13 +++++++------ bacula/src/dird/backup.c | 9 ++++----- bacula/src/dird/bsr.c | 24 ------------------------ bacula/src/stored/match_bsr.c | 6 +++--- bacula/src/stored/parse_bsr.c | 2 +- bacula/technotes-2.5 | 2 ++ 7 files changed, 17 insertions(+), 43 deletions(-) diff --git a/bacula/src/cats/cats.h b/bacula/src/cats/cats.h index 563503652c..60c470876f 100644 --- a/bacula/src/cats/cats.h +++ b/bacula/src/cats/cats.h @@ -839,10 +839,6 @@ struct VOL_PARAMS { uint32_t VolIndex; /* Volume seqence no. */ uint32_t FirstIndex; /* First index this Volume */ uint32_t LastIndex; /* Last index this Volume */ - uint32_t StartFile; /* File for start of data */ - uint32_t EndFile; /* End file on Volume */ - uint32_t StartBlock; /* start block on tape */ - uint32_t EndBlock; /* last block */ int32_t Slot; /* Slot */ uint64_t StartAddr; /* Start address */ uint64_t EndAddr; /* End address */ diff --git a/bacula/src/cats/sql_get.c b/bacula/src/cats/sql_get.c index 16e28644ec..31794f4900 100644 --- a/bacula/src/cats/sql_get.c +++ b/bacula/src/cats/sql_get.c @@ -455,16 +455,17 @@ int db_get_job_volume_parameters(JCR *jcr, B_DB *mdb, JobId_t JobId, VOL_PARAMS break; } else { DBId_t StorageId; + uint32_t StartBlock, EndBlock, StartFile, EndFile; bstrncpy(Vols[i].VolumeName, row[0], MAX_NAME_LENGTH); bstrncpy(Vols[i].MediaType, row[1], MAX_NAME_LENGTH); Vols[i].FirstIndex = str_to_uint64(row[2]); Vols[i].LastIndex = str_to_uint64(row[3]); - Vols[i].StartFile = str_to_uint64(row[4]); - Vols[i].EndFile = str_to_uint64(row[5]); - Vols[i].StartBlock = str_to_uint64(row[6]); - Vols[i].EndBlock = str_to_uint64(row[7]); - Vols[i].StartAddr = (((uint64_t)Vols[i].StartFile)<<32) | Vols[i].StartBlock; - Vols[i].EndAddr = (((uint64_t)Vols[i].EndFile)<<32) | Vols[i].EndBlock; + StartFile = str_to_uint64(row[4]); + EndFile = str_to_uint64(row[5]); + StartBlock = str_to_uint64(row[6]); + EndBlock = str_to_uint64(row[7]); + Vols[i].StartAddr = (((uint64_t)StartFile)<<32) | StartBlock; + Vols[i].EndAddr = (((uint64_t)EndFile)<<32) | EndBlock; // Vols[i].Copy = str_to_uint64(row[8]); Vols[i].Slot = str_to_uint64(row[9]); StorageId = str_to_uint64(row[10]); diff --git a/bacula/src/dird/backup.c b/bacula/src/dird/backup.c index 18286b5f7d..ec430d4494 100644 --- a/bacula/src/dird/backup.c +++ b/bacula/src/dird/backup.c @@ -630,7 +630,7 @@ void update_bootstrap_file(JCR *jcr) VOL_PARAMS *VolParams = NULL; int VolCount; - char edt[50]; + char edt[50], ed1[50], ed2[50]; if (*fname == '|') { got_pipe = 1; @@ -664,10 +664,9 @@ void update_bootstrap_file(JCR *jcr) } fprintf(fd, "VolSessionId=%u\n", jcr->VolSessionId); fprintf(fd, "VolSessionTime=%u\n", jcr->VolSessionTime); - fprintf(fd, "VolFile=%u-%u\n", VolParams[i].StartFile, - VolParams[i].EndFile); - fprintf(fd, "VolBlock=%u-%u\n", VolParams[i].StartBlock, - VolParams[i].EndBlock); + fprintf(fd, "VolAddr=%s-%s\n", + edit_uint64(VolParams[i].StartAddr, ed1), + edit_uint64(VolParams[i].EndAddr, ed2)); fprintf(fd, "FileIndex=%d-%d\n", VolParams[i].FirstIndex, VolParams[i].LastIndex); } diff --git a/bacula/src/dird/bsr.c b/bacula/src/dird/bsr.c index b3081a6e73..b0fbe3b759 100644 --- a/bacula/src/dird/bsr.c +++ b/bacula/src/dird/bsr.c @@ -363,18 +363,6 @@ static uint32_t write_bsr(UAContext *ua, RESTORE_CTX &rx, FILE *fd) } fprintf(fd, "VolSessionId=%u\n", bsr->VolSessionId); fprintf(fd, "VolSessionTime=%u\n", bsr->VolSessionTime); -// if (bsr->VolParams[i].StartFile == bsr->VolParams[i].EndFile) { -// fprintf(fd, "VolFile=%u\n", bsr->VolParams[i].StartFile); -// } else { -// fprintf(fd, "VolFile=%u-%u\n", bsr->VolParams[i].StartFile, -// bsr->VolParams[i].EndFile); -// } -// if (bsr->VolParams[i].StartBlock == bsr->VolParams[i].EndBlock) { -// fprintf(fd, "VolBlock=%u\n", bsr->VolParams[i].StartBlock); -// } else { -// fprintf(fd, "VolBlock=%u-%u\n", bsr->VolParams[i].StartBlock, -// bsr->VolParams[i].EndBlock); -// } fprintf(fd, "VolAddr=%s-%s\n", edit_uint64(bsr->VolParams[i].StartAddr, ed1), edit_uint64(bsr->VolParams[i].EndAddr, ed2)); // Dmsg2(100, "bsr VolParam FI=%u LI=%u\n", @@ -431,18 +419,6 @@ static uint32_t write_bsr(UAContext *ua, RESTORE_CTX &rx, FILE *fd) } fprintf(fd, "VolSessionId=%u\n", bsr->VolSessionId); fprintf(fd, "VolSessionTime=%u\n", bsr->VolSessionTime); -// if (bsr->VolParams[i].StartFile == bsr->VolParams[i].EndFile) { -// fprintf(fd, "VolFile=%u\n", bsr->VolParams[i].StartFile); -// } else { -// fprintf(fd, "VolFile=%u-%u\n", bsr->VolParams[i].StartFile, -// bsr->VolParams[i].EndFile); -// } -// if (bsr->VolParams[i].StartBlock == bsr->VolParams[i].EndBlock) { -// fprintf(fd, "VolBlock=%u\n", bsr->VolParams[i].StartBlock); -// } else { -// fprintf(fd, "VolBlock=%u-%u\n", bsr->VolParams[i].StartBlock, -// bsr->VolParams[i].EndBlock); -// } fprintf(fd, "VolAddr=%s-%s\n", edit_uint64(bsr->VolParams[i].StartAddr, ed1), edit_uint64(bsr->VolParams[i].EndAddr, ed2)); // Dmsg2(100, "bsr VolParam FI=%u LI=%u\n", diff --git a/bacula/src/stored/match_bsr.c b/bacula/src/stored/match_bsr.c index 9304c8886e..ae0719b8ba 100644 --- a/bacula/src/stored/match_bsr.c +++ b/bacula/src/stored/match_bsr.c @@ -409,7 +409,7 @@ static int match_all(BSR *bsr, DEV_RECORD *rec, VOLUME_LABEL *volrec, if (!match_voladdr(bsr, bsr->voladdr, rec, 1)) { if (bsr->voladdr) { - Dmsg3(dbglevel, "Fail on Addr=%lld. bsr=%lld,%lld\n", + Dmsg3(dbglevel, "Fail on Addr=%llu. bsr=%llu,%llu\n", get_record_address(rec), bsr->voladdr->saddr, bsr->voladdr->eaddr); } goto no_match; @@ -641,7 +641,7 @@ static int match_voladdr(BSR *bsr, BSR_VOLADDR *voladdr, DEV_RECORD *rec, bool d return 1; /* All File records OK for this match */ } uint64_t addr = get_record_address(rec); -// Dmsg3(dbglevel, "match_voladdr: saddr=%lld eaddr=%lld recaddr=%lld\n", +// Dmsg3(dbglevel, "match_voladdr: saddr=%llu eaddr=%llu recaddr=%llu\n", // volblock->saddr, volblock->eaddr, addr); if (voladdr->saddr <= addr && voladdr->eaddr >= addr) { return 1; @@ -658,7 +658,7 @@ static int match_voladdr(BSR *bsr, BSR_VOLADDR *voladdr, DEV_RECORD *rec, bool d if (voladdr->done && done) { bsr->done = true; bsr->root->reposition = true; - Dmsg2(dbglevel, "bsr done from voladdr rec=%lld voleaddr=%lld\n", + Dmsg2(dbglevel, "bsr done from voladdr rec=%llu voleaddr=%llu\n", addr, voladdr->eaddr); } return 0; diff --git a/bacula/src/stored/parse_bsr.c b/bacula/src/stored/parse_bsr.c index 4603dbaeaa..b2790e7f6a 100644 --- a/bacula/src/stored/parse_bsr.c +++ b/bacula/src/stored/parse_bsr.c @@ -744,7 +744,7 @@ void dump_volblock(BSR_VOLBLOCK *volblock) void dump_voladdr(BSR_VOLADDR *voladdr) { if (voladdr) { - Pmsg2(-1, _("VolAddr : %lld-%lld\n"), voladdr->saddr, voladdr->eaddr); + Pmsg2(-1, _("VolAddr : %llu-%llu\n"), voladdr->saddr, voladdr->eaddr); dump_voladdr(voladdr->next); } } diff --git a/bacula/technotes-2.5 b/bacula/technotes-2.5 index 03605aee1f..b57b9ecaaa 100644 --- a/bacula/technotes-2.5 +++ b/bacula/technotes-2.5 @@ -10,6 +10,8 @@ filepattern (restore with regex in bsr) mixed priorities General: +19Dec08 +ebl Cleanup director VolParam struct 18Dec08 ebl Replace File:Block in BSR by Address to fix #1190 16Dec08 -- 2.39.5