本文整理汇总了C++中DEVICE::set_load方法的典型用法代码示例。如果您正苦于以下问题:C++ DEVICE::set_load方法的具体用法?C++ DEVICE::set_load怎么用?C++ DEVICE::set_load使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DEVICE
的用法示例。
在下文中一共展示了DEVICE::set_load方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: acquire_device_for_read
//.........这里部分代码省略.........
bstrncpy(dcr->pool_name, store->pool_name, sizeof(dcr->pool_name));
bstrncpy(dcr->pool_type, store->pool_type, sizeof(dcr->pool_type));
} else {
/* error */
Jmsg1(jcr, M_FATAL, 0, _("No suitable device found to read Volume \"%s\"\n"),
vol->VolumeName);
Dmsg1(rdbglvl, "No suitable device found to read Volume \"%s\"\n", vol->VolumeName);
goto get_out;
}
}
Dmsg2(rdbglvl, "MediaType dcr=%s dev=%s\n", dcr->media_type, dev->device->media_type);
dev->clear_unload();
if (dev->vol && dev->vol->is_swapping()) {
dev->vol->set_slot(vol->Slot);
Dmsg3(rdbglvl, "swapping: slot=%d Vol=%s dev=%s\n", dev->vol->get_slot(),
dev->vol->vol_name, dev->print_name());
}
init_device_wait_timers(dcr);
tape_previously_mounted = dev->can_read() || dev->can_append() ||
dev->is_labeled();
// tape_initially_mounted = tape_previously_mounted;
/* Volume info is always needed because of VolParts */
Dmsg1(rdbglvl, "dir_get_volume_info vol=%s\n", dcr->VolumeName);
if (!dcr->dir_get_volume_info(GET_VOL_INFO_FOR_READ)) {
Dmsg2(rdbglvl, "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 */
for ( ;; ) {
/* If not polling limit retries */
if (!dev->poll && retry++ > 10) {
break;
}
dev->clear_labeled(); /* force reread of label */
if (job_canceled(jcr)) {
char ed1[50];
Mmsg1(dev->errmsg, _("Job %s canceled.\n"), edit_int64(jcr->JobId, ed1));
Jmsg(jcr, M_INFO, 0, dev->errmsg);
goto get_out; /* error return */
}
dcr->do_unload();
dcr->do_swapping(false/*!is_writing*/);
dcr->do_load(false /*!is_writing*/);
set_dcr_from_vol(dcr, vol); /* refresh dcr with desired volume info */
/*
* This code ensures that the device is ready for
* reading. If it is a file, it opens it.
* If it is a tape, it checks the volume name
*/
Dmsg1(rdbglvl, "stored: open vol=%s\n", dcr->VolumeName);
if (!dev->open(dcr, OPEN_READ_ONLY)) {
if (!dev->poll) {
Jmsg3(jcr, M_WARNING, 0, _("Read open device %s Volume \"%s\" failed: ERR=%s\n"),
dev->print_name(), dcr->VolumeName, dev->bstrerror());
}
goto default_path;
}