]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/stored/ansi_label.c
kes Apply the recycle patch from Richard Mortimer.
[bacula/bacula] / bacula / src / stored / ansi_label.c
index b8e02b3a594631106535428766b97fe32a8f37d9..02b70cadfddc3eaab45ac7f8653cdbf844e9c09e 100644 (file)
@@ -10,7 +10,7 @@
  *   Version $Id$
  */
 /*
-   Copyright (C) 2005 Kern Sibbald
+   Copyright (C) 2005-2006 Kern Sibbald
 
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License
@@ -74,11 +74,11 @@ int read_ansi_ibm_label(DCR *dcr)
    /* Read a maximum of 5 records VOL1, HDR1, ... HDR4 */
    for (i=0; i < 6; i++) {
       do {
-         stat = read(dev->fd, label, sizeof(label));
+         stat = tape_read(dev->fd, label, sizeof(label));
       } while (stat == -1 && errno == EINTR);
       if (stat < 0) {
          berrno be;
-         clrerror_dev(dev, -1);
+         dev->clrerror(-1);
          Dmsg1(100, "Read device got: ERR=%s\n", be.strerror());
          Mmsg2(jcr->errmsg, _("Read error on device %s in ANSI label. ERR=%s\n"),
             dev->dev_name, be.strerror());
@@ -296,7 +296,7 @@ bool write_ansi_ibm_labels(DCR *dcr, int type, const char *VolName)
          } else {
             label[79] = '3';                /* ANSI label flag */
          }
-         stat = write(dev->fd, label, sizeof(label));
+         stat = tape_write(dev->fd, label, sizeof(label));
          if (stat != sizeof(label)) {
             berrno be;
             Jmsg1(jcr, M_FATAL, 0,  _("Could not write ANSI VOL1 label. ERR=%s\n"),
@@ -328,11 +328,11 @@ bool write_ansi_ibm_labels(DCR *dcr, int type, const char *VolName)
        * This could come at the end of a tape, ignore
        *  EOT errors.
        */
-      stat = write(dev->fd, label, sizeof(label));
+      stat = tape_write(dev->fd, label, sizeof(label));
       if (stat != sizeof(label)) {
          berrno be;
          if (stat == -1) {
-            clrerror_dev(dev, -1);
+            dev->clrerror(-1);
             if (dev->dev_errno == 0) {
                dev->dev_errno = ENOSPC; /* out of space */
             }
@@ -357,11 +357,11 @@ bool write_ansi_ibm_labels(DCR *dcr, int type, const char *VolName)
          label[4] = 'V';
          ascii_to_ebcdic(label, label, sizeof(label));
       }
-      stat = write(dev->fd, label, sizeof(label));
+      stat = tape_write(dev->fd, label, sizeof(label));
       if (stat != sizeof(label)) {
          berrno be;
          if (stat == -1) {
-            clrerror_dev(dev, -1);
+            dev->clrerror(-1);
             if (dev->dev_errno == 0) {
                dev->dev_errno = ENOSPC; /* out of space */
             }
@@ -370,14 +370,14 @@ bool write_ansi_ibm_labels(DCR *dcr, int type, const char *VolName)
                be.strerror());
                return false;
             }
-            weof_dev(dev, 1);
+            dev->weof(1);
             return true;
          } else {
             Jmsg(jcr, M_FATAL, 0, _("Could not write ANSI HDR1 label.\n"));
             return false;
          }
       }
-      if (weof_dev(dev, 1) < 0) {
+      if (!dev->weof(1)) {
          Jmsg(jcr, M_FATAL, 0, _("Error writing EOF to tape. ERR=%s"), dev->errmsg);
          return false;
       }