* Version $Id$
*/
/*
- Copyright (C) 2000, 2001, 2002 Kern Sibbald and John Walker
+ Copyright (C) 2000-2003 Kern Sibbald and John Walker
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
BSOCK *ds;
BSOCK *fd_sock = jcr->file_bsock;
int ok = TRUE;
+ int done = FALSE;
DEVICE *dev;
DEV_RECORD *rec;
DEV_BLOCK *block;
block = new_block(dev);
create_vol_list(jcr);
+ if (jcr->NumVolumes == 0) {
+ Jmsg(jcr, M_FATAL, 0, _("No Volume names found for restore.\n"));
+ free_block(block);
+ free_vol_list(jcr);
+ return 0;
+ }
+
+ Dmsg2(200, "Found %d volumes names to restore. First=%s\n", jcr->NumVolumes,
+ jcr->VolList->VolumeName);
- Dmsg1(20, "Found %d volumes names to restore.\n", jcr->NumVolumes);
+ pm_strcpy(&jcr->VolumeName, jcr->VolList->VolumeName);
/*
* Ready device for reading, and read records
* Read records, apply BSR filtering, and return any that are
* matched.
*/
- for ( ;ok; ) {
+ for ( ;ok && !done; ) {
if (job_cancelled(jcr)) {
ok = FALSE;
break;
/* Read Record */
Dmsg1(500, "Main read_record. rem=%d\n", rec->remainder);
- if (!read_block_from_device(dev, block)) {
+ if (block_is_empty(block) && !read_block_from_device(dev, block)) {
Dmsg1(500, "Main read record failed. rem=%d\n", rec->remainder);
if (dev->state & ST_EOT) {
DEV_RECORD *record;
/* Match BSR against current record */
if (jcr->bsr) {
- if (!match_bsr(jcr->bsr, rec, &dev->VolHdr, &sessrec)) {
+ int stat = match_bsr(jcr->bsr, rec, &dev->VolHdr, &sessrec);
+ if (stat == -1) { /* no more possible matches */
+ done = TRUE;
+ break;
+ } else if (stat == 0) { /* no match */
Dmsg0(50, "BSR rejected record\n");
rec->remainder = 0;
continue;
* out the data record
*/
ds->msg = hdr;
+ Dmsg5(400, "Send to FD: SessId=%u SessTim=%u FI=%d Strm=%d, len=%d\n",
+ rec->VolSessionId, rec->VolSessionTime, rec->FileIndex, rec->Stream,
+ rec->data_len);
if (!bnet_fsend(ds, rec_header, rec->VolSessionId, rec->VolSessionTime,
rec->FileIndex, rec->Stream, rec->data_len)) {
Dmsg1(30, ">filed: Error Hdr=%s\n", ds->msg);