本文整理汇总了C++中DEVICE::set_read方法的典型用法代码示例。如果您正苦于以下问题:C++ DEVICE::set_read方法的具体用法?C++ DEVICE::set_read怎么用?C++ DEVICE::set_read使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DEVICE
的用法示例。
在下文中一共展示了DEVICE::set_read方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: acquire_device_for_read
//.........这里部分代码省略.........
*/
if (tape_previously_mounted) {
Jmsg(jcr, M_WARNING, 0, "Read acquire: %s", jcr->errmsg);
}
goto default_path;
case VOL_NAME_ERROR:
Dmsg3(rdbglvl, "Vol name=%s want=%s drv=%s.\n", dev->VolHdr.VolumeName,
dcr->VolumeName, dev->print_name());
if (dev->is_volume_to_unload()) {
goto default_path;
}
dev->set_unload(); /* force unload of unwanted tape */
if (!unload_autochanger(dcr, -1)) {
/* at least free the device so we can re-open with correct volume */
dev->close(dcr);
free_volume(dev);
}
dev->set_load();
/* Fall through */
default:
Jmsg1(jcr, M_WARNING, 0, "Read acquire: %s", jcr->errmsg);
default_path:
Dmsg0(rdbglvl, "default path\n");
tape_previously_mounted = true;
/*
* If the device requires mount, close it, so the device can be ejected.
*/
if (dev->requires_mount()) {
dev->close(dcr);
free_volume(dev);
}
/* Call autochanger only once unless ask_sysop called */
if (try_autochanger) {
int status;
Dmsg2(rdbglvl, "calling autoload Vol=%s Slot=%d\n",
dcr->VolumeName, dcr->VolCatInfo.Slot);
status = autoload_device(dcr, 0, NULL);
if (status > 0) {
try_autochanger = false;
continue; /* try reading volume mounted */
}
}
/* Mount a specific volume and no other */
Dmsg0(rdbglvl, "calling dir_ask_sysop\n");
if (!dcr->dir_ask_sysop_to_mount_volume(ST_READREADY)) {
goto get_out; /* error return */
}
/* Volume info is always needed because of VolParts */
Dmsg1(150, "dir_get_volume_info vol=%s\n", dcr->VolumeName);
if (!dcr->dir_get_volume_info(GET_VOL_INFO_FOR_READ)) {
Dmsg2(150, "dir_get_vol_info failed for vol=%s: %s\n",
dcr->VolumeName, jcr->errmsg);
Jmsg1(jcr, M_WARNING, 0, "Read acquire: %s", jcr->errmsg);
}
dev->set_load(); /* set to load volume */
try_autochanger = true; /* permit trying the autochanger again */
continue; /* try reading again */
} /* end switch */
break;
} /* end for loop */
if (!ok) {
Jmsg1(jcr, M_FATAL, 0, _("Too many errors trying to mount device %s for reading.\n"),
dev->print_name());
goto get_out;
}
dev->clear_append();
dev->set_read();
jcr->sendJobStatus(JS_Running);
Jmsg(jcr, M_INFO, 0, _("Ready to read from volume \"%s\" on device %s.\n"),
dcr->VolumeName, dev->print_name());
get_out:
dev->Lock();
dcr->clear_reserved();
/*
* Normally we are blocked, but in at least one error case above
* we are not blocked because we unsuccessfully tried changing
* devices.
*/
if (dev->is_blocked()) {
dev->dunblock(DEV_LOCKED);
} else {
dev->Unlock(); /* dunblock() unlock the device too */
}
Dmsg2(rdbglvl, "dcr=%p dev=%p\n", dcr, dcr->dev);
Dmsg2(rdbglvl, "MediaType dcr=%s dev=%s\n", dcr->media_type, dev->device->media_type);
dev->Unlock_read_acquire();
Leave(rdbglvl);
return ok;
}