本文整理汇总了C++中zfcp_erp_wait函数的典型用法代码示例。如果您正苦于以下问题:C++ zfcp_erp_wait函数的具体用法?C++ zfcp_erp_wait怎么用?C++ zfcp_erp_wait使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了zfcp_erp_wait函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: zfcp_sysfs_unit_add_store
static ssize_t zfcp_sysfs_unit_add_store(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{
struct zfcp_port *port = container_of(dev, struct zfcp_port, dev);
struct zfcp_unit *unit;
u64 fcp_lun;
int retval = -EINVAL;
if (!(port && get_device(&port->dev)))
return -EBUSY;
if (strict_strtoull(buf, 0, (unsigned long long *) &fcp_lun))
goto out;
unit = zfcp_unit_enqueue(port, fcp_lun);
if (IS_ERR(unit))
goto out;
else
retval = 0;
zfcp_erp_unit_reopen(unit, 0, "syuas_1", NULL);
zfcp_erp_wait(unit->port->adapter);
zfcp_scsi_scan(unit);
out:
put_device(&port->dev);
return retval ? retval : (ssize_t) count;
}
示例2: zfcp_sysfs_unit_failed_store
/**
* zfcp_sysfs_unit_failed_store - failed state of unit
* @dev: pointer to belonging device
* @buf: pointer to input buffer
* @count: number of bytes in buffer
*
* Store function of the "failed" attribute of a unit.
* If a "0" gets written to "failed", error recovery will be
* started for the belonging unit.
*/
static ssize_t
zfcp_sysfs_unit_failed_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
{
struct zfcp_unit *unit;
unsigned int val;
char *endp;
int retval = 0;
down(&zfcp_data.config_sema);
unit = dev_get_drvdata(dev);
if (atomic_test_mask(ZFCP_STATUS_COMMON_REMOVE, &unit->status)) {
retval = -EBUSY;
goto out;
}
val = simple_strtoul(buf, &endp, 0);
if (((endp + 1) < (buf + count)) || (val != 0)) {
retval = -EINVAL;
goto out;
}
zfcp_erp_modify_unit_status(unit, ZFCP_STATUS_COMMON_RUNNING, ZFCP_SET);
zfcp_erp_unit_reopen(unit, ZFCP_STATUS_COMMON_ERP_FAILED);
zfcp_erp_wait(unit->port->adapter);
out:
up(&zfcp_data.config_sema);
return retval ? retval : (ssize_t) count;
}
示例3: zfcp_init_device_configure
static void __init zfcp_init_device_configure(void)
{
struct zfcp_adapter *adapter;
struct zfcp_port *port;
struct zfcp_unit *unit;
down(&zfcp_data.config_sema);
read_lock_irq(&zfcp_data.config_lock);
adapter = zfcp_get_adapter_by_busid(zfcp_data.init_busid);
if (adapter)
zfcp_adapter_get(adapter);
read_unlock_irq(&zfcp_data.config_lock);
if (!adapter)
goto out_adapter;
port = zfcp_port_enqueue(adapter, zfcp_data.init_wwpn, 0, 0);
if (IS_ERR(port))
goto out_port;
unit = zfcp_unit_enqueue(port, zfcp_data.init_fcp_lun);
if (IS_ERR(unit))
goto out_unit;
up(&zfcp_data.config_sema);
ccw_device_set_online(adapter->ccw_device);
zfcp_erp_wait(adapter);
down(&zfcp_data.config_sema);
zfcp_unit_put(unit);
out_unit:
zfcp_port_put(port);
out_port:
zfcp_adapter_put(adapter);
out_adapter:
up(&zfcp_data.config_sema);
return;
}
示例4: zfcp_sysfs_unit_add_store
/**
* zfcp_sysfs_unit_add_store - add a unit to sysfs tree
* @dev: pointer to belonging device
* @buf: pointer to input buffer
* @count: number of bytes in buffer
*
* Store function of the "unit_add" attribute of a port.
*/
static ssize_t
zfcp_sysfs_unit_add_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
{
fcp_lun_t fcp_lun;
char *endp;
struct zfcp_port *port;
struct zfcp_unit *unit;
int retval = -EINVAL;
down(&zfcp_data.config_sema);
port = dev_get_drvdata(dev);
if (atomic_test_mask(ZFCP_STATUS_COMMON_REMOVE, &port->status)) {
retval = -EBUSY;
goto out;
}
fcp_lun = simple_strtoull(buf, &endp, 0);
if ((endp + 1) < (buf + count))
goto out;
unit = zfcp_unit_enqueue(port, fcp_lun);
if (!unit)
goto out;
retval = 0;
zfcp_erp_unit_reopen(unit, 0);
zfcp_erp_wait(unit->port->adapter);
zfcp_unit_put(unit);
out:
up(&zfcp_data.config_sema);
return retval ? retval : (ssize_t) count;
}
示例5: zfcp_sysfs_adapter_failed_store
static ssize_t zfcp_sysfs_adapter_failed_store(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{
struct ccw_device *cdev = to_ccwdev(dev);
struct zfcp_adapter *adapter = zfcp_ccw_adapter_by_cdev(cdev);
unsigned long val;
int retval = 0;
if (!adapter)
return -ENODEV;
if (strict_strtoul(buf, 0, &val) || val != 0) {
retval = -EINVAL;
goto out;
}
zfcp_erp_modify_adapter_status(adapter, "syafai1", NULL,
ZFCP_STATUS_COMMON_RUNNING, ZFCP_SET);
zfcp_erp_adapter_reopen(adapter, ZFCP_STATUS_COMMON_ERP_FAILED,
"syafai2", NULL);
zfcp_erp_wait(adapter);
out:
zfcp_ccw_adapter_put(adapter);
return retval ? retval : (ssize_t) count;
}
示例6: zfcp_sysfs_unit_add_store
static ssize_t zfcp_sysfs_unit_add_store(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{
struct zfcp_port *port = dev_get_drvdata(dev);
struct zfcp_unit *unit;
fcp_lun_t fcp_lun;
int retval = -EINVAL;
down(&zfcp_data.config_sema);
if (atomic_read(&port->status) & ZFCP_STATUS_COMMON_REMOVE) {
retval = -EBUSY;
goto out;
}
if (strict_strtoull(buf, 0, &fcp_lun))
goto out;
unit = zfcp_unit_enqueue(port, fcp_lun);
if (IS_ERR(unit))
goto out;
retval = 0;
zfcp_erp_unit_reopen(unit, 0, 94, NULL);
zfcp_erp_wait(unit->port->adapter);
zfcp_unit_put(unit);
out:
up(&zfcp_data.config_sema);
return retval ? retval : (ssize_t) count;
}
示例7: zfcp_sysfs_unit_remove_store
static ssize_t zfcp_sysfs_unit_remove_store(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{
struct zfcp_port *port = dev_get_drvdata(dev);
struct zfcp_unit *unit;
u64 fcp_lun;
LIST_HEAD(unit_remove_lh);
struct scsi_device *sdev;
mutex_lock(&zfcp_data.config_mutex);
if (atomic_read(&port->status) & ZFCP_STATUS_COMMON_REMOVE) {
mutex_unlock(&zfcp_data.config_mutex);
return -EBUSY;
}
if (strict_strtoull(buf, 0, (unsigned long long *) &fcp_lun)) {
mutex_unlock(&zfcp_data.config_mutex);
return -EINVAL;
}
read_lock_irq(&zfcp_data.config_lock);
unit = zfcp_get_unit_by_lun(port, fcp_lun);
read_unlock_irq(&zfcp_data.config_lock);
if (!unit) {
mutex_unlock(&zfcp_data.config_mutex);
return -ENXIO;
}
zfcp_unit_get(unit);
mutex_unlock(&zfcp_data.config_mutex);
sdev = scsi_device_lookup(port->adapter->scsi_host, 0,
port->starget_id,
scsilun_to_int((struct scsi_lun *)&fcp_lun));
if (sdev) {
scsi_remove_device(sdev);
scsi_device_put(sdev);
}
mutex_lock(&zfcp_data.config_mutex);
zfcp_unit_put(unit);
if (atomic_read(&unit->refcount)) {
mutex_unlock(&zfcp_data.config_mutex);
return -ENXIO;
}
write_lock_irq(&zfcp_data.config_lock);
atomic_set_mask(ZFCP_STATUS_COMMON_REMOVE, &unit->status);
list_move(&unit->list, &unit_remove_lh);
write_unlock_irq(&zfcp_data.config_lock);
mutex_unlock(&zfcp_data.config_mutex);
zfcp_erp_unit_shutdown(unit, 0, "syurs_1", NULL);
zfcp_erp_wait(unit->port->adapter);
zfcp_unit_dequeue(unit);
return (ssize_t)count;
}
示例8: zfcp_erp_lun_shutdown_wait
void zfcp_erp_lun_shutdown_wait(struct scsi_device *sdev, char *id)
{
unsigned long flags;
struct zfcp_scsi_dev *zfcp_sdev = sdev_to_zfcp(sdev);
struct zfcp_port *port = zfcp_sdev->port;
struct zfcp_adapter *adapter = port->adapter;
int clear = ZFCP_STATUS_COMMON_RUNNING | ZFCP_STATUS_COMMON_ERP_FAILED;
write_lock_irqsave(&adapter->erp_lock, flags);
_zfcp_erp_lun_reopen(sdev, clear, id, ZFCP_STATUS_ERP_NO_REF);
write_unlock_irqrestore(&adapter->erp_lock, flags);
zfcp_erp_wait(adapter);
}
示例9: zfcp_scsi_eh_host_reset_handler
static int zfcp_scsi_eh_host_reset_handler(struct scsi_cmnd *scpnt)
{
struct zfcp_scsi_dev *zfcp_sdev = sdev_to_zfcp(scpnt->device);
struct zfcp_adapter *adapter = zfcp_sdev->port->adapter;
int ret;
zfcp_erp_adapter_reopen(adapter, 0, "schrh_1");
zfcp_erp_wait(adapter);
ret = fc_block_scsi_eh(scpnt);
if (ret)
return ret;
return SUCCESS;
}
示例10: zfcp_sysfs_unit_remove_store
/**
* zfcp_sysfs_unit_remove_store - remove a unit from sysfs tree
* @dev: pointer to belonging device
* @buf: pointer to input buffer
* @count: number of bytes in buffer
*/
static ssize_t
zfcp_sysfs_unit_remove_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
{
struct zfcp_port *port;
struct zfcp_unit *unit;
fcp_lun_t fcp_lun;
char *endp;
int retval = 0;
down(&zfcp_data.config_sema);
port = dev_get_drvdata(dev);
if (atomic_test_mask(ZFCP_STATUS_COMMON_REMOVE, &port->status)) {
retval = -EBUSY;
goto out;
}
fcp_lun = simple_strtoull(buf, &endp, 0);
if ((endp + 1) < (buf + count)) {
retval = -EINVAL;
goto out;
}
write_lock_irq(&zfcp_data.config_lock);
unit = zfcp_get_unit_by_lun(port, fcp_lun);
if (unit && (atomic_read(&unit->refcount) == 0)) {
zfcp_unit_get(unit);
atomic_set_mask(ZFCP_STATUS_COMMON_REMOVE, &unit->status);
list_move(&unit->list, &port->unit_remove_lh);
}
else {
unit = NULL;
}
write_unlock_irq(&zfcp_data.config_lock);
if (!unit) {
retval = -ENXIO;
goto out;
}
zfcp_erp_unit_shutdown(unit, 0);
zfcp_erp_wait(unit->port->adapter);
zfcp_unit_put(unit);
zfcp_unit_dequeue(unit);
out:
up(&zfcp_data.config_sema);
return retval ? retval : (ssize_t) count;
}
示例11: zfcp_sysfs_port_failed_store
static ssize_t zfcp_sysfs_port_failed_store(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{
struct zfcp_port *port = container_of(dev, struct zfcp_port, dev);
unsigned long val;
if (strict_strtoul(buf, 0, &val) || val != 0)
return -EINVAL;
zfcp_erp_set_port_status(port, ZFCP_STATUS_COMMON_RUNNING);
zfcp_erp_port_reopen(port, ZFCP_STATUS_COMMON_ERP_FAILED, "sypfai2");
zfcp_erp_wait(port->adapter);
return count;
}
示例12: zfcp_init_device_configure
static void __init zfcp_init_device_configure(char *busid, u64 wwpn, u64 lun)
{
struct ccw_device *ccwdev;
struct zfcp_adapter *adapter;
struct zfcp_port *port;
struct zfcp_unit *unit;
ccwdev = get_ccwdev_by_busid(&zfcp_ccw_driver, busid);
if (!ccwdev)
return;
if (ccw_device_set_online(ccwdev))
goto out_ccwdev;
mutex_lock(&zfcp_data.config_mutex);
adapter = dev_get_drvdata(&ccwdev->dev);
if (!adapter)
goto out_unlock;
zfcp_adapter_get(adapter);
port = zfcp_get_port_by_wwpn(adapter, wwpn);
if (!port)
goto out_port;
zfcp_port_get(port);
unit = zfcp_unit_enqueue(port, lun);
if (IS_ERR(unit))
goto out_unit;
mutex_unlock(&zfcp_data.config_mutex);
zfcp_erp_unit_reopen(unit, 0, "auidc_1", NULL);
zfcp_erp_wait(adapter);
flush_work(&unit->scsi_work);
mutex_lock(&zfcp_data.config_mutex);
zfcp_unit_put(unit);
out_unit:
zfcp_port_put(port);
out_port:
zfcp_adapter_put(adapter);
out_unlock:
mutex_unlock(&zfcp_data.config_mutex);
out_ccwdev:
put_device(&ccwdev->dev);
return;
}
示例13: zfcp_scsi_slave_alloc
static int zfcp_scsi_slave_alloc(struct scsi_device *sdev)
{
struct fc_rport *rport = starget_to_rport(scsi_target(sdev));
struct zfcp_adapter *adapter =
(struct zfcp_adapter *) sdev->host->hostdata[0];
struct zfcp_scsi_dev *zfcp_sdev = sdev_to_zfcp(sdev);
struct zfcp_port *port;
struct zfcp_unit *unit;
int npiv = adapter->connection_features & FSF_FEATURE_NPIV_MODE;
zfcp_sdev->erp_action.adapter = adapter;
zfcp_sdev->erp_action.sdev = sdev;
port = zfcp_get_port_by_wwpn(adapter, rport->port_name);
if (!port)
return -ENXIO;
zfcp_sdev->erp_action.port = port;
unit = zfcp_unit_find(port, zfcp_scsi_dev_lun(sdev));
if (unit)
put_device(&unit->dev);
if (!unit && !(allow_lun_scan && npiv)) {
put_device(&port->dev);
return -ENXIO;
}
zfcp_sdev->port = port;
zfcp_sdev->latencies.write.channel.min = 0xFFFFFFFF;
zfcp_sdev->latencies.write.fabric.min = 0xFFFFFFFF;
zfcp_sdev->latencies.read.channel.min = 0xFFFFFFFF;
zfcp_sdev->latencies.read.fabric.min = 0xFFFFFFFF;
zfcp_sdev->latencies.cmd.channel.min = 0xFFFFFFFF;
zfcp_sdev->latencies.cmd.fabric.min = 0xFFFFFFFF;
spin_lock_init(&zfcp_sdev->latencies.lock);
zfcp_erp_set_lun_status(sdev, ZFCP_STATUS_COMMON_RUNNING);
zfcp_erp_lun_reopen(sdev, 0, "scsla_1");
zfcp_erp_wait(port->adapter);
return 0;
}
示例14: zfcp_sysfs_unit_failed_store
static ssize_t zfcp_sysfs_unit_failed_store(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{
struct zfcp_unit *unit = container_of(dev, struct zfcp_unit, dev);
unsigned long val;
struct scsi_device *sdev;
if (strict_strtoul(buf, 0, &val) || val != 0)
return -EINVAL;
sdev = zfcp_unit_sdev(unit);
if (sdev) {
zfcp_erp_set_lun_status(sdev, ZFCP_STATUS_COMMON_RUNNING);
zfcp_erp_lun_reopen(sdev, ZFCP_STATUS_COMMON_ERP_FAILED,
"syufai2");
zfcp_erp_wait(unit->port->adapter);
} else
zfcp_unit_scsi_scan(unit);
return count;
}
示例15: zfcp_init_device_configure
static void __init zfcp_init_device_configure(char *busid, u64 wwpn, u64 lun)
{
struct zfcp_adapter *adapter;
struct zfcp_port *port;
struct zfcp_unit *unit;
down(&zfcp_data.config_sema);
read_lock_irq(&zfcp_data.config_lock);
adapter = zfcp_get_adapter_by_busid(busid);
if (adapter)
zfcp_adapter_get(adapter);
read_unlock_irq(&zfcp_data.config_lock);
if (!adapter)
goto out_adapter;
port = zfcp_port_enqueue(adapter, wwpn, 0, 0);
if (IS_ERR(port))
goto out_port;
unit = zfcp_unit_enqueue(port, lun);
if (IS_ERR(unit))
goto out_unit;
up(&zfcp_data.config_sema);
ccw_device_set_online(adapter->ccw_device);
zfcp_erp_wait(adapter);
wait_event(adapter->erp_done_wqh,
!(atomic_read(&unit->status) &
ZFCP_STATUS_UNIT_SCSI_WORK_PENDING));
down(&zfcp_data.config_sema);
zfcp_unit_put(unit);
out_unit:
zfcp_port_put(port);
out_port:
zfcp_adapter_put(adapter);
out_adapter:
up(&zfcp_data.config_sema);
return;
}