static BSR *store_client(LEX *lc, BSR *bsr);
static BSR *store_job(LEX *lc, BSR *bsr);
static BSR *store_jobid(LEX *lc, BSR *bsr);
+static BSR *store_count(LEX *lc, BSR *bsr);
static BSR *store_jobtype(LEX *lc, BSR *bsr);
static BSR *store_joblevel(LEX *lc, BSR *bsr);
static BSR *store_findex(LEX *lc, BSR *bsr);
static BSR *store_sessid(LEX *lc, BSR *bsr);
static BSR *store_volfile(LEX *lc, BSR *bsr);
+static BSR *store_volblock(LEX *lc, BSR *bsr);
static BSR *store_sesstime(LEX *lc, BSR *bsr);
static BSR *store_include(LEX *lc, BSR *bsr);
static BSR *store_exclude(LEX *lc, BSR *bsr);
{"client", store_client},
{"job", store_job},
{"jobid", store_jobid},
+ {"count", store_count},
{"fileindex", store_findex},
{"jobtype", store_jobtype},
{"joblevel", store_joblevel},
{"include", store_include},
{"exclude", store_exclude},
{"volfile", store_volfile},
+ {"volblock", store_volblock},
{"stream", store_stream},
{"slot", store_slot},
{NULL, NULL}
if (token == T_ERROR) {
return NULL;
}
+ if (bsr->volume) {
+ bsr->next = new_bsr();
+ bsr = bsr->next;
+ }
/* This may actually be more than one volume separated by a |
* If so, separate them.
*/
return bsr;
}
+
+static BSR *store_count(LEX *lc, BSR *bsr)
+{
+ int token;
+
+ token = lex_get_token(lc, T_PINT32);
+ if (token == T_ERROR) {
+ return NULL;
+ }
+ bsr->count = lc->pint32_val;
+ scan_to_eol(lc);
+ return bsr;
+}
+
+
static BSR *store_jobtype(LEX *lc, BSR *bsr)
{
/* *****FIXME****** */
}
+/*
+ * Routine to handle Volume start/end Block
+ */
+static BSR *store_volblock(LEX *lc, BSR *bsr)
+{
+ int token;
+ BSR_VOLBLOCK *volblock;
+
+ for (;;) {
+ token = lex_get_token(lc, T_PINT32_RANGE);
+ if (token == T_ERROR) {
+ return NULL;
+ }
+ volblock = (BSR_VOLBLOCK *)malloc(sizeof(BSR_VOLBLOCK));
+ memset(volblock, 0, sizeof(BSR_VOLBLOCK));
+ volblock->sblock = lc->pint32_val;
+ volblock->eblock = lc->pint32_val2;
+ /* Add it to the end of the chain */
+ if (!bsr->volblock) {
+ bsr->volblock = volblock;
+ } else {
+ /* Add to end of chain */
+ BSR_VOLBLOCK *bs = bsr->volblock;
+ for ( ;bs->next; bs=bs->next)
+ { }
+ bs->next = volblock;
+ }
+ token = lex_get_token(lc, T_ALL);
+ if (token != T_COMMA) {
+ break;
+ }
+ }
+ return bsr;
+}
+
static BSR *store_sessid(LEX *lc, BSR *bsr)
{
}
}
+void dump_volblock(BSR_VOLBLOCK *volblock)
+{
+ if (volblock) {
+ Dmsg2(-1, "VolBlock : %u-%u\n", volblock->sblock, volblock->eblock);
+ dump_volblock(volblock->next);
+ }
+}
+
+
void dump_findex(BSR_FINDEX *FileIndex)
{
if (FileIndex) {
dump_sessid(bsr->sessid);
dump_sesstime(bsr->sesstime);
dump_volfile(bsr->volfile);
+ dump_volblock(bsr->volblock);
dump_client(bsr->client);
dump_jobid(bsr->JobId);
dump_job(bsr->job);
dump_findex(bsr->FileIndex);
+ if (bsr->Slot) {
+ Dmsg1(-1, "Slot : %u\n", bsr->Slot);
+ }
+ if (bsr->count) {
+ Dmsg1(-1, "count : %u\n", bsr->count);
+ }
if (bsr->next) {
Dmsg0(-1, "\n");
dump_bsr(bsr->next);
free_bsr_item((BSR *)bsr->sessid);
free_bsr_item((BSR *)bsr->sesstime);
free_bsr_item((BSR *)bsr->volfile);
+ free_bsr_item((BSR *)bsr->volblock);
free_bsr_item((BSR *)bsr->JobId);
free_bsr_item((BSR *)bsr->job);
free_bsr_item((BSR *)bsr->FileIndex);
} else {
for ( ; next->next; next=next->next) {
if (strcmp(vol->VolumeName, next->VolumeName) == 0) {
+ if (vol->start_file < next->start_file) {
+ next->start_file = vol->start_file;
+ }
return 0; /* already in list */
}
}
if (strcmp(vol->VolumeName, next->VolumeName) == 0) {
+ if (vol->start_file < next->start_file) {
+ next->start_file = vol->start_file;
+ }
return 0; /* already in list */
}
next->next = vol; /* add volume */
free(next);
next = tmp;
}
+ jcr->VolList = NULL;
}
+/*
+ * Create a list of Volumes (and Slots and Start positions) to be
+ * used in the current restore job.
+ */
void create_vol_list(JCR *jcr)
{
char *p, *n;
VOL_LIST *vol;
/*
- * Build a list of volume to be processed
+ * Build a list of volumes to be processed
*/
jcr->NumVolumes = 0;
- jcr->CurVolume = 1;
+ jcr->CurVolume = 0;
if (jcr->bsr) {
BSR *bsr = jcr->bsr;
if (!bsr->volume || !bsr->volume->VolumeName) {
return;
}
- strcpy(jcr->VolumeName, bsr->volume->VolumeName); /* setup first volume */
for ( ; bsr; bsr=bsr->next) {
- BSR_VOLUME *bsrvol = bsr->volume;
- for ( ; bsrvol; bsrvol=bsrvol->next) {
+ BSR_VOLUME *bsrvol;
+ BSR_VOLFILE *volfile;
+ uint32_t sfile = UINT32_MAX;
+
+ /* Find minimum start file so that we can forward space to it */
+ for (volfile = bsr->volfile; volfile; volfile=volfile->next) {
+ if (volfile->sfile < sfile) {
+ sfile = volfile->sfile;
+ }
+ }
+ /* Now add volumes for this bsr */
+ for (bsrvol = bsr->volume; bsrvol; bsrvol=bsrvol->next) {
vol = new_vol();
strcpy(vol->VolumeName, bsrvol->VolumeName);
+ vol->start_file = sfile;
if (add_vol(jcr, vol)) {
jcr->NumVolumes++;
Dmsg1(400, "Added volume %s\n", vol->VolumeName);
Dmsg1(400, "Duplicate volume %s\n", vol->VolumeName);
free((char *)vol);
}
+ sfile = 0; /* start at beginning of second volume */
}
}
} else {