]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/stored/read_record.c
Add V: to bextract and bscan
[bacula/bacula] / bacula / src / stored / read_record.c
index 46721bb18ee1250ba5fc45aa888e9958b9c5fbe2..92930f15629bb334f6d3acbf51dc2267d997ead7 100644 (file)
@@ -51,7 +51,7 @@ int read_records(JCR *jcr,  DEVICE *dev,
 
    block = new_block(dev);
    rec = new_record();
-   for ( ;ok && !done; ) {
+   for ( ; ok && !done; ) {
       if (job_canceled(jcr)) {
         ok = FALSE;
         break;
@@ -63,7 +63,10 @@ int read_records(JCR *jcr,  DEVICE *dev,
 
             Dmsg3(100, "EOT. stat=%s blk=%d rem=%d\n", rec_state_to_str(rec), 
                  block->BlockNumber, rec->remainder);
+            Jmsg(jcr, M_INFO, 0, "Got EOM at file %u  on device %s, Volume \"%s\"\n", 
+                dev->file, dev_name(dev), jcr->VolumeName);
            if (!mount_cb(jcr, dev, block)) {
+               Jmsg(jcr, M_INFO, 0, "End of all volumes.\n");
                Dmsg3(100, "After mount next vol. stat=%s blk=%d rem=%d\n", rec_state_to_str(rec), 
                  block->BlockNumber, rec->remainder);
               ok = FALSE;
@@ -91,24 +94,32 @@ int read_records(JCR *jcr,  DEVICE *dev,
            get_session_record(dev, trec, &sessrec);
            record_cb(jcr, dev, block, trec);
            free_record(trec);
-           goto next_record;
-        }
-        if (dev->state & ST_EOF) {
-            Emsg2(M_INFO, 0, "Got EOF on device %s, Volume \"%s\"\n", 
-                 dev_name(dev), jcr->VolumeName);
+           goto next_record;         /* go read new tape */
+
+        } else if (dev->state & ST_EOF) {
+            Jmsg(jcr, M_INFO, 0, "Got EOF at file %u  on device %s, Volume \"%s\"\n", 
+                 dev->file, dev_name(dev), jcr->VolumeName);
             Dmsg0(20, "read_record got eof. try again\n");
            continue;
-        }
-        if (dev->state & ST_SHORT) {
-           Emsg0(M_INFO, 0, dev->errmsg);
+        } else if (dev->state & ST_SHORT) {
+            Jmsg(jcr, M_INFO, 0, "%s", dev->errmsg);
            continue;
+        } else {
+           /* I/O error or strange end of tape */
+           display_tape_error_status(jcr, dev);
+           ok = FALSE;
+           break;
         }
-//      display_error_status();
-        ok = FALSE;
-        break;
+      }
+      if (!match_bsr_block(jcr->bsr, block)) {
+         Dmsg5(100, "reject Blk=%u blen=%u bVer=%d SessId=%u SessTim=%u\n",
+           block->BlockNumber, block->block_len, block->BlockVer,
+           block->VolSessionId, block->VolSessionTime);
+        continue;
       }
       if (verbose) {
-         Dmsg2(10, "Block: %d blen=%d\n", block->BlockNumber, block->block_len);
+         Dmsg4(000, "Block: %d VI=%u VT=%u blen=%d\n", block->BlockNumber, 
+           block->VolSessionId, block->VolSessionTime, block->block_len);
       }
 
 next_record: