want_ansi_label = dcr->VolCatInfo.LabelType != B_BACULA_LABEL ||
dcr->device->label_type != B_BACULA_LABEL;
- if (want_ansi_label || dev_cap(dev, CAP_CHECKLABELS)) {
+ if (want_ansi_label || dev->has_cap(CAP_CHECKLABELS)) {
stat = read_ansi_ibm_label(dcr);
/* If we want a label and didn't find it, return error */
if (want_ansi_label && stat != VOL_OK) {
}
Dmsg0(30, "Leave read_volume_label() VOL_OK\n");
/* If we are a streaming device, we only get one chance to read */
- if (!dev_cap(dev, CAP_STREAM)) {
+ if (!dev->has_cap(CAP_STREAM)) {
dev->rewind(dcr);
if (have_ansi_label) {
stat = read_ansi_ibm_label(dcr);
if (dev->open(dcr, OPEN_READ_WRITE) < 0) {
return false;
}
- Dmsg2(190, "set append found freshly labeled volume. fd=%d dev=%x\n", dev->fd, dev);
+ Dmsg2(190, "set append found freshly labeled volume. fd=%d dev=%x\n", dev->fd(), dev);
dev->VolHdr.LabelType = VOL_LABEL; /* set Volume label */
dev->set_append();
if (!write_volume_label_to_block(dcr)) {
* We do not write the block now if this is an ANSI label. This
* avoids re-writing the ANSI label, which we do not want to do.
*/
- if (!dev_cap(dev, CAP_STREAM)) {
+ if (!dev->has_cap(CAP_STREAM)) {
if (!dev->rewind(dcr)) {
Jmsg2(jcr, M_FATAL, 0, _("Rewind error on device %s: ERR=%s\n"),
dev->print_name(), dev->print_errmsg());
}
/* Attempt write to check write permission */
- Dmsg1(200, "Attempt to write to device fd=%d.\n", dev->fd);
+ Dmsg1(200, "Attempt to write to device fd=%d.\n", dev->fd());
if (!write_block_to_dev(dcr)) {
Jmsg2(jcr, M_ERROR, 0, _("Unable to write device %s: ERR=%s\n"),
dev->print_name(), dev->print_errmsg());
rec->FileIndex = dev->VolHdr.LabelType;
rec->VolSessionId = jcr->VolSessionId;
rec->VolSessionTime = jcr->VolSessionTime;
- rec->Stream = jcr->NumVolumes;
+ rec->Stream = jcr->NumWriteVolumes;
Dmsg2(150, "Created Vol label rec: FI=%s len=%d\n", FI_to_ascii(buf, rec->FileIndex),
rec->data_len);
}