本文整理汇总了C++中DEVICE::clear_slot方法的典型用法代码示例。如果您正苦于以下问题:C++ DEVICE::clear_slot方法的具体用法?C++ DEVICE::clear_slot怎么用?C++ DEVICE::clear_slot使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DEVICE
的用法示例。
在下文中一共展示了DEVICE::clear_slot方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
DEVICE *m_init_dev(JCR *jcr, DEVRES *device)
{
struct stat statp;
int errstat;
DCR *dcr = NULL;
DEVICE *dev = NULL;
uint32_t max_bs;
/* If no device type specified, try to guess */
if (!device->dev_type) {
/* Check that device is available */
if (stat(device->device_name, &statp) < 0) {
berrno be;
Jmsg2(jcr, M_ERROR, 0, _("Unable to stat device %s: ERR=%s\n"),
device->device_name, be.bstrerror());
return NULL;
}
if (S_ISDIR(statp.st_mode)) {
device->dev_type = B_FILE_DEV;
} else if (S_ISCHR(statp.st_mode)) {
device->dev_type = B_TAPE_DEV;
} else if (S_ISFIFO(statp.st_mode)) {
device->dev_type = B_FIFO_DEV;
#ifdef USE_VTAPE
/* must set DeviceType = Vtape
* in normal mode, autodetection is disabled
*/
} else if (S_ISREG(statp.st_mode)) {
device->dev_type = B_VTAPE_DEV;
#endif
} else if (!(device->cap_bits & CAP_REQMOUNT)) {
Jmsg2(jcr, M_ERROR, 0, _("%s is an unknown device type. Must be tape or directory\n"
" or have RequiresMount=yes for DVD. st_mode=%x\n"),
device->device_name, statp.st_mode);
return NULL;
} else {
device->dev_type = B_DVD_DEV;
}
if (strcmp(device->device_name, "/dev/null") == 0) {
device->dev_type = B_NULL_DEV;
}
}
switch (device->dev_type) {
case B_DVD_DEV:
Jmsg0(jcr, M_FATAL, 0, _("DVD support is now deprecated.\n"));
return NULL;
case B_VTAPE_DEV:
dev = New(vtape);
break;
#ifdef USE_FTP
case B_FTP_DEV:
dev = New(ftp_device);
break;
#endif
case B_TAPE_DEV:
dev = New(tape_dev);
break;
case B_FILE_DEV:
case B_FIFO_DEV:
case B_NULL_DEV:
dev = New(file_dev);
break;
default:
return NULL;
}
dev->clear_slot(); /* unknown */
/* Copy user supplied device parameters from Resource */
dev->dev_name = get_memory(strlen(device->device_name)+1);
pm_strcpy(dev->dev_name, device->device_name);
dev->prt_name = get_memory(strlen(device->device_name) + strlen(device->hdr.name) + 20);
/* We edit "Resource-name" (physical-name) */
Mmsg(dev->prt_name, "\"%s\" (%s)", device->hdr.name, device->device_name);
Dmsg1(400, "Allocate dev=%s\n", dev->print_name());
dev->capabilities = device->cap_bits;
dev->min_free_space = device->min_free_space;
dev->min_block_size = device->min_block_size;
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;
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;
//.........这里部分代码省略.........
示例2: if
//.........这里部分代码省略.........
case B_FIFO_DEV:
dev = New(win32_fifo_device);
break;
#else
case B_TAPE_DEV:
dev = New(unix_tape_device);
break;
case B_FIFO_DEV:
dev = New(unix_fifo_device);
break;
#endif
#endif /* HAVE_DYNAMIC_SD_BACKENDS */
#ifdef HAVE_WIN32
case B_FILE_DEV:
dev = New(win32_file_device);
break;
#else
case B_FILE_DEV:
dev = New(unix_file_device);
break;
#endif
default:
#ifdef HAVE_DYNAMIC_SD_BACKENDS
dev = init_backend_dev(jcr, device->dev_type);
#endif
break;
}
if (!dev) {
Jmsg2(jcr, M_ERROR, 0, _("%s has an unknown device type %d\n"),
device->device_name, device->dev_type);
return NULL;
}
dev->clear_slot(); /* unknown */
/*
* Copy user supplied device parameters from Resource
*/
dev->dev_name = get_memory(strlen(device->device_name) + 1);
pm_strcpy(dev->dev_name, device->device_name);
if (device->device_options) {
dev->dev_options = get_memory(strlen(device->device_options) + 1);
pm_strcpy(dev->dev_options, device->device_options);
}
dev->prt_name = get_memory(strlen(device->device_name) + strlen(device->name()) + 20);
/*
* We edit "Resource-name" (physical-name)
*/
Mmsg(dev->prt_name, "\"%s\" (%s)", device->name(), device->device_name);
Dmsg1(400, "Allocate dev=%s\n", dev->print_name());
copy_bits(CAP_MAX, device->cap_bits, dev->capabilities);
/*
* current block sizes
*/
dev->min_block_size = device->min_block_size;
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;
dev->max_open_vols = device->max_open_vols;
dev->vol_poll_interval = device->vol_poll_interval;