本文整理汇总了C++中DEVICE::requires_mount方法的典型用法代码示例。如果您正苦于以下问题:C++ DEVICE::requires_mount方法的具体用法?C++ DEVICE::requires_mount怎么用?C++ DEVICE::requires_mount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DEVICE
的用法示例。
在下文中一共展示了DEVICE::requires_mount方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
//.........这里部分代码省略.........
dev->vol_poll_interval = device->vol_poll_interval;
dev->max_spool_size = device->max_spool_size;
dev->drive_index = device->drive_index;
dev->enabled = device->enabled;
dev->autoselect = device->autoselect;
dev->read_only = device->read_only;
dev->dev_type = device->dev_type;
dev->device = device;
if (dev->is_tape()) { /* No parts on tapes */
dev->max_part_size = 0;
} else {
dev->max_part_size = device->max_part_size;
}
/* Sanity check */
if (dev->vol_poll_interval && dev->vol_poll_interval < 60) {
dev->vol_poll_interval = 60;
}
if (!device->dev) {
/* The first time we create a DEVICE from the DEVRES, we keep a pointer
* to the DEVICE accessible from the DEVRES.
*/
device->dev = dev;
}
if (dev->is_fifo()) {
dev->capabilities |= CAP_STREAM; /* set stream device */
}
/* If the device requires mount :
* - Check that the mount point is available
* - Check that (un)mount commands are defined
*/
if (dev->is_file() && dev->requires_mount()) {
if (!device->mount_point || stat(device->mount_point, &statp) < 0) {
berrno be;
dev->dev_errno = errno;
Jmsg2(jcr, M_ERROR_TERM, 0, _("Unable to stat mount point %s: ERR=%s\n"),
device->mount_point, be.bstrerror());
}
if (!device->mount_command || !device->unmount_command) {
Jmsg0(jcr, M_ERROR_TERM, 0, _("Mount and unmount commands must defined for a device which requires mount.\n"));
}
}
/* Keep the device ID in the DEVICE struct to identify the hardware */
if (dev->is_file() && stat(dev->archive_name(), &statp) == 0) {
dev->devno = statp.st_dev;
}
/* Sanity check */
if (dev->max_block_size == 0) {
max_bs = DEFAULT_BLOCK_SIZE;
} else {
max_bs = dev->max_block_size;
}
if (dev->min_block_size > max_bs) {
Jmsg(jcr, M_ERROR_TERM, 0, _("Min block size > max on device %s\n"),
dev->print_name());
}
if (dev->max_block_size > 4096000) {
Jmsg3(jcr, M_ERROR, 0, _("Block size %u on device %s is too large, using default %u\n"),
dev->max_block_size, dev->print_name(), DEFAULT_BLOCK_SIZE);
dev->max_block_size = 0;
}
示例2: acquire_device_for_read
//.........这里部分代码省略.........
Dmsg0(rdbglvl, "IO Error\n");
/*
* Send error message generated by read_dev_volume_label()
* only we really had a tape mounted. This supresses superfluous
* error messages when nothing is mounted.
*/
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 */
示例3: if
//.........这里部分代码省略.........
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;
dev->max_open_vols = device->max_open_vols;
dev->vol_poll_interval = device->vol_poll_interval;
dev->max_spool_size = device->max_spool_size;
dev->drive = device->drive;
dev->drive_index = device->drive_index;
dev->autoselect = device->autoselect;
dev->norewindonclose = device->norewindonclose;
dev->dev_type = device->dev_type;
dev->device = device;
/*
* Sanity check
*/
if (dev->vol_poll_interval && dev->vol_poll_interval < 60) {
dev->vol_poll_interval = 60;
}
device->dev = dev;
if (dev->is_fifo()) {
dev->set_cap(CAP_STREAM); /* set stream device */
}
/*
* If the device requires mount :
* - Check that the mount point is available
* - Check that (un)mount commands are defined
*/
if (dev->is_file() && dev->requires_mount()) {
if (!device->mount_point || stat(device->mount_point, &statp) < 0) {
berrno be;
dev->dev_errno = errno;
Jmsg2(jcr, M_ERROR_TERM, 0, _("Unable to stat mount point %s: ERR=%s\n"),
device->mount_point, be.bstrerror());
}
if (!device->mount_command || !device->unmount_command) {
Jmsg0(jcr, M_ERROR_TERM, 0, _("Mount and unmount commands must defined for a device which requires mount.\n"));
}
}
/*
* Sanity check
*/
if (dev->max_block_size == 0) {
max_bs = DEFAULT_BLOCK_SIZE;
} else {
max_bs = dev->max_block_size;
}
if (dev->min_block_size > max_bs) {
Jmsg(jcr, M_ERROR_TERM, 0, _("Min block size > max on device %s\n"), dev->print_name());
}
if (dev->max_block_size > MAX_BLOCK_LENGTH) {
Jmsg3(jcr, M_ERROR, 0, _("Block size %u on device %s is too large, using default %u\n"),
dev->max_block_size, dev->print_name(), DEFAULT_BLOCK_SIZE);
dev->max_block_size = 0;
}
if (dev->max_block_size % TAPE_BSIZE != 0) {
Jmsg3(jcr, M_WARNING, 0, _("Max block size %u not multiple of device %s block size=%d.\n"),
dev->max_block_size, dev->print_name(), TAPE_BSIZE);
}