]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/stored/btape.c
- Simplify code in askdir.c that waits for creating an appendable
[bacula/bacula] / bacula / src / stored / btape.c
index 251f4488879975394ccfa390a84dd634770b7a7e..c4e7d50da22abcedf23fbd1a2a86280501c14096 100644 (file)
@@ -366,7 +366,7 @@ static void labelcmd()
          Pmsg1(0, _("Device open failed. ERR=%s\n"), strerror_dev(dev));
       }
    }
-   rewind_dev(dev);
+   dev->rewind(dcr);
    write_new_volume_label_to_dev(dcr, cmd, "Default");
    Pmsg1(-1, _("Wrote Volume label for volume \"%s\".\n"), cmd);
 }
@@ -431,7 +431,7 @@ static void loadcmd()
  */
 static void rewindcmd()
 {
-   if (!rewind_dev(dev)) {
+   if (!dev->rewind(dcr)) {
       Pmsg1(0, _("Bad status from rewind. ERR=%s\n"), strerror_dev(dev));
       clrerror_dev(dev, -1);
    } else {
@@ -771,7 +771,7 @@ static int write_read_test()
       "This is an *essential* feature ...\n\n"));
    block = dcr->block;
    rec = new_record();
-   if (!rewind_dev(dev)) {
+   if (!dev->rewind(dcr)) {
       Pmsg1(0, _("Bad status from rewind. ERR=%s\n"), strerror_dev(dev));
       goto bail_out;
    }
@@ -813,7 +813,7 @@ static int write_read_test()
    if (dev_cap(dev, CAP_TWOEOF)) {
       weofcmd();
    }
-   if (!rewind_dev(dev)) {
+   if (!dev->rewind(dcr)) {
       Pmsg1(0, _("Bad status from rewind. ERR=%s\n"), strerror_dev(dev));
       goto bail_out;
    } else {
@@ -883,7 +883,7 @@ static int position_test()
       "This is an *essential* feature ...\n\n"));
    empty_block(block);
    rec = new_record();
-   if (!rewind_dev(dev)) {
+   if (!dev->rewind(dcr)) {
       Pmsg1(0, _("Bad status from rewind. ERR=%s\n"), strerror_dev(dev));
       goto bail_out;
    }
@@ -925,7 +925,7 @@ static int position_test()
    if (dev_cap(dev, CAP_TWOEOF)) {
       weofcmd();
    }
-   if (!rewind_dev(dev)) {
+   if (!dev->rewind(dcr)) {
       Pmsg1(0, _("Bad status from rewind. ERR=%s\n"), strerror_dev(dev));
       goto bail_out;
    } else {
@@ -1194,7 +1194,7 @@ try_again:
     * a failure.
     */
    bmicrosleep(sleep_time, 0);
-   if (!rewind_dev(dev) || weof_dev(dev,1) < 0) {
+   if (!dev->rewind(dcr) || weof_dev(dev,1) < 0) {
       Pmsg1(0, _("Bad status from rewind. ERR=%s\n"), strerror_dev(dev));
       clrerror_dev(dev, -1);
       Pmsg0(-1, _("\nThe test failed, probably because you need to put\n"
@@ -1823,7 +1823,7 @@ static void fillcmd()
    dev->min_block_size = dev->max_block_size;
    set_volume_name("TestVolume1", 1);
 
-   if (!dev->rewind()) {
+   if (!dev->rewind(dcr)) {
       Pmsg0(000, _("Rewind failed.\n"));
    }
    if (!dev->weof()) {
@@ -2119,11 +2119,13 @@ static void do_unfill()
     * Note, re-reading last block may have caused us to
     *   loose track of where we are (block number unknown).
     */
-   if (!rewind_dev(dev)) {                /* get to a known place on tape */
+   Pmsg0(-1, _("Rewinding.\n"));
+   if (!dev->rewind(dcr)) {                /* get to a known place on tape */
       goto bail_out;
    }
    /* Read the first 10000 records */
-   Pmsg0(-1, _("Reading the first 10000 records.\n"));
+   Pmsg2(-1, _("Reading the first 10000 records from %u:%u.\n"),
+      dev->file, dev->block_num);
    quickie_count = 0;
    read_records(dcr, quickie_cb, my_mount_next_read_volume);
    Pmsg4(-1, _("Reposition from %u:%u to %u:%u\n"), dev->file, dev->block_num,
@@ -2218,14 +2220,9 @@ bail_out:
 static bool quickie_cb(DCR *dcr, DEV_RECORD *rec)
 {
    DEVICE *dev = dcr->dev;
-   if (dev->file != 0) {
-      Pmsg3(-1, _("ERROR! device at %d:%d count=%d\n"), dev->file, dev->block_num,
-         quickie_count);
-      return false;
-   }
    quickie_count++;
    if (quickie_count == 10000) {
-      Pmsg2(-1, _("1000 records read now at %d:%d\n"), dev->file, dev->block_num);
+      Pmsg2(-1, _("10000 records read now at %d:%d\n"), dev->file, dev->block_num);
    }
    return quickie_count < 10000;
 }