* Version $Id$
*/
/*
- Copyright (C) 2000-2004 Kern Sibbald and John Walker
+ Copyright (C) 2000-2005 Kern Sibbald
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
P(dev->mutex); /* lock again */
Jmsg(jcr, M_INFO, 0, _("New volume \"%s\" mounted on device %s at %s.\n"),
- dcr->VolumeName, dev_name(dev), bstrftime(dt, sizeof(dt), time(NULL)));
+ dcr->VolumeName, dev->print_name(), bstrftime(dt, sizeof(dt), time(NULL)));
/*
* If this is a new tape, the label_blk will contain the
return true;
}
- if (!(dev->state & ST_OPENED)) {
+ if (!dev->is_open()) {
int mode;
if (dev_cap(dev, CAP_STREAM)) {
mode = OPEN_WRITE_ONLY;
}
Dmsg0(129, "Opening device.\n");
if (open_dev(dev, NULL, mode) < 0) {
- Emsg1(M_FATAL, 0, _("dev open failed: %s\n"), dev->errmsg);
+ Emsg1(M_FATAL, 0, _("dev open failed: %s\n"), dev->errmsg);
unlock_device(dev);
return false;
}
}
- Dmsg1(129, "open_dev %s OK\n", dev_name(dev));
+ Dmsg1(129, "open_dev %s OK\n", dev->print_name());
unlock_device(dev);
return true;
{
DEVICE *dev = dcr->dev;
/* Open device */
- if (!(dev_state(dev, ST_OPENED))) {
- int mode;
- if (dev_cap(dev, CAP_STREAM)) {
- mode = OPEN_WRITE_ONLY;
- } else {
- mode = OPEN_READ_WRITE;
- }
- if (open_dev(dev, dcr->VolCatInfo.VolCatName, mode) < 0) {
- /* If polling, ignore the error */
- if (!dev->poll) {
- Jmsg2(dcr->jcr, M_FATAL, 0, _("Unable to open device %s. ERR=%s\n"),
- dev_name(dev), strerror_dev(dev));
- }
- return false;
- }
+ if (!dev->is_open()) {
+ int mode;
+ if (dev_cap(dev, CAP_STREAM)) {
+ mode = OPEN_WRITE_ONLY;
+ } else {
+ mode = OPEN_READ_WRITE;
+ }
+ if (open_dev(dev, dcr->VolCatInfo.VolCatName, mode) < 0) {
+ /* If polling, ignore the error */
+ if (!dev->poll) {
+ Jmsg2(dcr->jcr, M_FATAL, 0, _("Unable to open archive %s: ERR=%s\n"),
+ dev->print_name(), strerror_dev(dev));
+ Pmsg2(000, "Unable to open archive %s: ERR=%s\n",
+ dev->print_name(), strerror_dev(dev));
+ }
+ return false;
+ }
}
return true;
}
while (dev->dev_blocked) {
if ((stat = pthread_cond_wait(&dev->wait, &dev->mutex)) != 0) {
V(dev->mutex);
- Emsg1(M_ABORT, 0, _("pthread_cond_wait failure. ERR=%s\n"),
+ Emsg1(M_ABORT, 0, _("pthread_cond_wait failure. ERR=%s\n"),
strerror(stat));
}
}