dev->clear_opened();
dev->attached_dcrs = New(dlist(dcr, &dcr->dev_link));
Dmsg2(29, "init_dev: tape=%d dev_name=%s\n", dev->is_tape(), dev->dev_name);
+ dev->initiated = true;
return dev;
}
/* On some systems such as NetBSD, this clears all errors */
get_os_tape_file();
-/* Found on Linux */
+/* Found on Solaris */
#ifdef MTIOCLRERR
{
- struct mtop mt_com;
- mt_com.mt_op = MTIOCLRERR;
- mt_com.mt_count = 1;
- /* Clear any error condition on the tape */
- tape_ioctl(m_fd, MTIOCTOP, (char *)&mt_com);
+ tape_ioctl(m_fd, MTIOCLRERR);
Dmsg0(200, "Did MTIOCLRERR\n");
}
#endif
*/
void DEVICE::clear_volhdr()
{
- free_volume(this);
+ /* If we have an unused volume associated with this drive, free it */
+ if (vol && !is_busy()) {
+ free_volume(this);
+ }
Dmsg1(100, "Clear volhdr vol=%s\n", VolHdr.VolumeName);
memset(&VolHdr, 0, sizeof(VolHdr));
}