-/*
- *
- * ansi_label.c routines to handle ANSI (and perhaps one day IBM)
- * tape labels.
- *
- * Kern Sibbald, MMV
- *
- *
- *
- * Version $Id$
- */
/*
Bacula® - The Network Backup Solution
- Copyright (C) 2005-2006 Free Software Foundation Europe e.V.
+ Copyright (C) 2005-2007 Free Software Foundation Europe e.V.
The main author of Bacula is Kern Sibbald, with contributions from
many others, a complete list can be found in the file AUTHORS.
(FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
Switzerland, email:ftf@fsfeurope.org.
*/
+/*
+ *
+ * ansi_label.c routines to handle ANSI (and perhaps one day IBM)
+ * tape labels.
+ *
+ * Kern Sibbald, MMV
+ *
+ *
+ *
+ * Version $Id$
+ */
#include "bacula.h" /* pull in global headers */
#include "stored.h" /* pull in Storage Deamon headers */
if (strncmp("VOL1", label, 4) == 0) {
ok = true;
dev->label_type = B_ANSI_LABEL;
+ Dmsg0(100, "Got ANSI VOL1 label\n");
} else {
/* Try EBCDIC */
ebcdic_to_ascii(label, label, sizeof(label));
ok = true;;
dev->label_type = B_IBM_LABEL;
Dmsg0(100, "Found IBM label.\n");
+ Dmsg0(100, "Got IBM VOL1 label\n");
}
}
}
dev->VolHdr.VolumeName);
return VOL_NAME_ERROR; /* Not a Bacula label */
}
+ Dmsg0(100, "Got HDR1 label\n");
break;
case 2:
if (dev->label_type == B_IBM_LABEL) {
Mmsg0(jcr->errmsg, _("No HDR2 label while reading ANSI/IBM label.\n"));
return VOL_LABEL_ERROR;
}
+ Dmsg0(100, "Got ANSI HDR2 label\n");
break;
default:
if (stat == 0) {
Mmsg0(jcr->errmsg, _("Unknown or bad ANSI/IBM label record.\n"));
return VOL_LABEL_ERROR;
}
+ Dmsg0(100, "Got HDR label\n");
break;
}
}
dev->dev_errno = EIO;
Mmsg4(dev->errmsg, _("Volume data error at %u:%u! Wanted ID: \"%s\", got \"%s\". Buffer discarded.\n"),
dev->file, dev->block_num, BLKHDR2_ID, Id);
+ Dmsg1(50, "%s", dev->errmsg);
if (block->read_errors == 0 || verbose >= 2) {
Jmsg(jcr, M_ERROR, 0, "%s", dev->errmsg);
}
dev->set_ateof();
return false; /* return eof */
}
+
/* Continue here for successful read */
+
block->read_len = stat; /* save length read */
+ if (dev->at_eof() && block->read_len == 80 &&
+ (dcr->VolCatInfo.LabelType != B_BACULA_LABEL ||
+ dcr->device->label_type != B_BACULA_LABEL)) {
+ /* ***FIXME*** should check label */
+ Dmsg2(100, "Ignore 80 byte ANSI label at %u:%u\n", dev->file, dev->block_num);
+ dev->clear_eof();
+ goto reread; /* skip ANSI/IBM label */
+ }
+
if (block->read_len < BLKHDR2_LENGTH) {
dev->dev_errno = EIO;
Mmsg4(dev->errmsg, _("Volume data error at %u:%u! Very short block of %d bytes on device %s discarded.\n"),
bstrncpy(dev->VolHdr.Id, "**error**", sizeof(dev->VolHdr.Id));
/* Read ANSI/IBM label if so requested */
-
want_ansi_label = dcr->VolCatInfo.LabelType != B_BACULA_LABEL ||
dcr->device->label_type != B_BACULA_LABEL;
if (want_ansi_label || dev->has_cap(CAP_CHECKLABELS)) {
General:
20Sep07
-kes Fix ANSI tape labeling. This fixes bug #954.
+kes Fix ANSI tape labeling. Fix restoring ANSI labeled Volumes.
+ This fixes bug #954.
kes Increase the max block size to 4MB fixes bug #957.
kes ERABT if user sets min block size > max block size. Fixes bug #956.
kes Apply 2.2.4-poll-mount fix, that resolves bug #908 where a tape