X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=drivers%2Fs390%2Fscsi%2Fzfcp_sysfs_port.c;h=6aafb2abb4b5087e867a982f28cf556122f561ae;hb=6a77f38946aaee1cd85eeec6cf4229b204c15071;hp=f425929121d961a7b6c9c8e9ae982a677a9238b7;hpb=5273a3df6485dc2ad6aa7ddd441b9a21970f003b;p=linux-2.6.git diff --git a/drivers/s390/scsi/zfcp_sysfs_port.c b/drivers/s390/scsi/zfcp_sysfs_port.c index f42592912..6aafb2abb 100644 --- a/drivers/s390/scsi/zfcp_sysfs_port.c +++ b/drivers/s390/scsi/zfcp_sysfs_port.c @@ -10,6 +10,8 @@ * Authors: * Martin Peschke * Heiko Carstens + * Andreas Herrmann + * Volker Sameske * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -26,13 +28,9 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#define ZFCP_SYSFS_PORT_C_REVISION "$Revision: 1.39 $" +#define ZFCP_SYSFS_PORT_C_REVISION "$Revision: 1.47 $" -#include -#include -#include #include "zfcp_ext.h" -#include "zfcp_def.h" #define ZFCP_LOG_AREA ZFCP_LOG_AREA_CONFIG @@ -70,6 +68,10 @@ ZFCP_DEFINE_PORT_ATTR(status, "0x%08x\n", atomic_read(&port->status)); ZFCP_DEFINE_PORT_ATTR(wwnn, "0x%016llx\n", port->wwnn); ZFCP_DEFINE_PORT_ATTR(d_id, "0x%06x\n", port->d_id); ZFCP_DEFINE_PORT_ATTR(scsi_id, "0x%x\n", port->scsi_id); +ZFCP_DEFINE_PORT_ATTR(in_recovery, "%d\n", atomic_test_mask + (ZFCP_STATUS_COMMON_ERP_INUSE, &port->status)); +ZFCP_DEFINE_PORT_ATTR(access_denied, "%d\n", atomic_test_mask + (ZFCP_STATUS_COMMON_ACCESS_DENIED, &port->status)); /** * zfcp_sysfs_unit_add_store - add a unit to sysfs tree @@ -111,7 +113,7 @@ zfcp_sysfs_unit_add_store(struct device *dev, const char *buf, size_t count) zfcp_unit_put(unit); out: up(&zfcp_data.config_sema); - return retval ? retval : count; + return retval ? retval : (ssize_t) count; } static DEVICE_ATTR(unit_add, S_IWUSR, NULL, zfcp_sysfs_unit_add_store); @@ -129,7 +131,7 @@ zfcp_sysfs_unit_remove_store(struct device *dev, const char *buf, size_t count) struct zfcp_unit *unit; fcp_lun_t fcp_lun; char *endp; - int retval = -EINVAL; + int retval = 0; down(&zfcp_data.config_sema); @@ -140,8 +142,10 @@ zfcp_sysfs_unit_remove_store(struct device *dev, const char *buf, size_t count) } fcp_lun = simple_strtoull(buf, &endp, 0); - if ((endp + 1) < (buf + count)) + 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); @@ -166,7 +170,7 @@ zfcp_sysfs_unit_remove_store(struct device *dev, const char *buf, size_t count) zfcp_unit_dequeue(unit); out: up(&zfcp_data.config_sema); - return retval ? retval : count; + return retval ? retval : (ssize_t) count; } static DEVICE_ATTR(unit_remove, S_IWUSR, NULL, zfcp_sysfs_unit_remove_store); @@ -208,7 +212,7 @@ zfcp_sysfs_port_failed_store(struct device *dev, const char *buf, size_t count) zfcp_erp_wait(port->adapter); out: up(&zfcp_data.config_sema); - return retval ? retval : count; + return retval ? retval : (ssize_t) count; } /** @@ -234,29 +238,6 @@ zfcp_sysfs_port_failed_show(struct device *dev, char *buf) static DEVICE_ATTR(failed, S_IWUSR | S_IRUGO, zfcp_sysfs_port_failed_show, zfcp_sysfs_port_failed_store); -/** - * zfcp_sysfs_port_in_recovery_show - recovery state of port - * @dev: pointer to belonging device - * @buf: pointer to input buffer - * - * Show function of "in_recovery" attribute of port. Will be - * "0" if no error recovery is pending for port, otherwise "1". - */ -static ssize_t -zfcp_sysfs_port_in_recovery_show(struct device *dev, char *buf) -{ - struct zfcp_port *port; - - port = dev_get_drvdata(dev); - if (atomic_test_mask(ZFCP_STATUS_COMMON_ERP_INUSE, &port->status)) - return sprintf(buf, "1\n"); - else - return sprintf(buf, "0\n"); -} - -static DEVICE_ATTR(in_recovery, S_IRUGO, zfcp_sysfs_port_in_recovery_show, - NULL); - /** * zfcp_port_common_attrs * sysfs attributes that are common for all kind of fc ports. @@ -267,6 +248,7 @@ static struct attribute *zfcp_port_common_attrs[] = { &dev_attr_status.attr, &dev_attr_wwnn.attr, &dev_attr_d_id.attr, + &dev_attr_access_denied.attr, NULL }; @@ -302,7 +284,7 @@ zfcp_sysfs_port_create_files(struct device *dev, u32 flags) retval = sysfs_create_group(&dev->kobj, &zfcp_port_common_attr_group); - if ((flags & ZFCP_STATUS_PORT_NAMESERVER) || retval) + if ((flags & ZFCP_STATUS_PORT_WKA) || retval) return retval; retval = sysfs_create_group(&dev->kobj, &zfcp_port_no_ns_attr_group); @@ -322,7 +304,7 @@ void zfcp_sysfs_port_remove_files(struct device *dev, u32 flags) { sysfs_remove_group(&dev->kobj, &zfcp_port_common_attr_group); - if (!(flags & ZFCP_STATUS_PORT_NAMESERVER)) + if (!(flags & ZFCP_STATUS_PORT_WKA)) sysfs_remove_group(&dev->kobj, &zfcp_port_no_ns_attr_group); }