/*
Bacula® - The Network Backup Solution
- Copyright (C) 2000-2008 Free Software Foundation Europe e.V.
+ Copyright (C) 2000-2009 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.
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- Bacula® is a registered trademark of John Walker.
+ Bacula® is a registered trademark of Kern Sibbald.
The licensor of Bacula is the Free Software Foundation Europe
(FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
Switzerland, email:ftf@fsfeurope.org.
/*
* Handling I/O errors and end of tape conditions are a bit tricky.
- * This is how it is currently done when writting.
+ * This is how it is currently done when writing.
* On either an I/O error or end of tape,
* we will stop writing on the physical device (no I/O recovery is
* attempted at least in this daemon). The state flag will be sent
dev->max_block_size = device->max_block_size;
dev->max_volume_size = device->max_volume_size;
dev->max_file_size = device->max_file_size;
+ dev->max_concurrent_jobs = device->max_concurrent_jobs;
dev->volume_capacity = device->volume_capacity;
dev->max_rewind_wait = device->max_rewind_wait;
dev->max_open_wait = device->max_open_wait;
Mmsg1(dev->errmsg, _("Unable to init mutex: ERR=%s\n"), be.bstrerror(errstat));
Jmsg0(jcr, M_ERROR_TERM, 0, dev->errmsg);
}
+ if ((errstat = pthread_mutex_init(&dev->acquire_mutex, NULL)) != 0) {
+ berrno be;
+ dev->dev_errno = errstat;
+ Mmsg1(dev->errmsg, _("Unable to init mutex: ERR=%s\n"), be.bstrerror(errstat));
+ Jmsg0(jcr, M_ERROR_TERM, 0, dev->errmsg);
+ }
#ifdef xxx
if ((errstat = rwl_init(&dev->lock)) != 0) {
berrno be;
} else {
d_open = ::open;
d_close = ::close;
- d_ioctl = win32_ioctl; /* dummy function */
- d_write = win32_write; /* win32 read/write are not POSIX */
+ d_ioctl = win32_ioctl; /* dummy function */
+ d_write = win32_write; /* win32 read/write are not POSIX */
d_read = win32_read;
}
#else /* POSIX / UNIX Interface */
- if (is_vtape()) { /* test backend */
- d_open = vtape_open; /* vtape isn't available for WIN32 or FreeBSD */
+ if (is_vtape()) { /* test backend */
+ d_open = vtape_open; /* vtape isn't available for WIN32 or FreeBSD */
d_write = vtape_write;
d_close = vtape_close;
d_ioctl = vtape_ioctl;
d_read = vtape_read;
- } else { /* tape and file are using normal io */
+ } else { /* tape and file are using normal io */
d_open = ::open;
d_write = ::write;
d_close = ::close;
{
struct mtop mt_com;
int stat;
- Dmsg0(129, "weof_dev\n");
+ Dmsg1(129, "=== weof_dev=%s\n", print_name());
if (!is_open()) {
dev_errno = EBADF;
}
+/*
+ * Set to unload the current volume in the drive
+ */
+void DEVICE::set_unload()
+{
+ if (!m_unload && VolHdr.VolumeName[0] != 0) {
+ m_unload = true;
+ memcpy(UnloadVolName, VolHdr.VolumeName, sizeof(UnloadVolName));
+ }
+}
+
+
/*
* Clear volume header
*/
#if defined(HAVE_WIN32)
return ::_lseeki64(m_fd, (__int64)offset, whence);
#else
- return ::lseek(m_fd, (off_t)offset, whence);
+ return ::lseek(m_fd, offset, whence);
#endif
}
return -1;
Dmsg2(100, "do_mount: cmd=%s mounted=%d\n", ocmd.c_str(), !!is_mounted());
if (dotimeout) {
- /* Try at most 1 time to (un)mount the device. This should perhaps be configurable. */
- timeout = 1;
+ /* Try at most 10 times to (un)mount the device. This should perhaps be configurable. */
+ timeout = 10;
} else {
timeout = 0;
}
dev->rem_wait_sec = dev->wait_sec;
dev->num_wait = 0;
dev->poll = false;
- dev->BadVolName[0] = 0;
jcr->min_wait = 60 * 60;
jcr->max_wait = 24 * 60 * 60;