mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-17 16:14:25 +08:00
e6550b3ee1
Based on the normalized pattern: this program is free software you may redistribute it and/or modify it under the terms of the gnu general public license as published by the free software foundation version 2 of the license the software is provided as is without warranty of any kind express or implied including but not limited to the warranties of merchantability fitness for a particular purpose and noninfringement in no event shall the authors or copyright holders be liable for any claim damages or other liability whether in an action of contract tort or otherwise arising from out of or in connection with the software or the use or other dealings in the software extracted by the scancode license scanner the SPDX license identifier GPL-2.0-only has been chosen to replace the boilerplate/reference. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
54 lines
1.5 KiB
C
54 lines
1.5 KiB
C
// SPDX-License-Identifier: GPL-2.0-only
|
|
/*
|
|
* Copyright 2008 Cisco Systems, Inc. All rights reserved.
|
|
* Copyright 2007 Nuova Systems, Inc. All rights reserved.
|
|
*/
|
|
#include <linux/string.h>
|
|
#include <linux/device.h>
|
|
#include <scsi/scsi_host.h>
|
|
#include "fnic.h"
|
|
|
|
static ssize_t fnic_show_state(struct device *dev,
|
|
struct device_attribute *attr, char *buf)
|
|
{
|
|
struct fc_lport *lp = shost_priv(class_to_shost(dev));
|
|
struct fnic *fnic = lport_priv(lp);
|
|
|
|
return snprintf(buf, PAGE_SIZE, "%s\n", fnic_state_str[fnic->state]);
|
|
}
|
|
|
|
static ssize_t fnic_show_drv_version(struct device *dev,
|
|
struct device_attribute *attr, char *buf)
|
|
{
|
|
return snprintf(buf, PAGE_SIZE, "%s\n", DRV_VERSION);
|
|
}
|
|
|
|
static ssize_t fnic_show_link_state(struct device *dev,
|
|
struct device_attribute *attr, char *buf)
|
|
{
|
|
struct fc_lport *lp = shost_priv(class_to_shost(dev));
|
|
|
|
return snprintf(buf, PAGE_SIZE, "%s\n", (lp->link_up)
|
|
? "Link Up" : "Link Down");
|
|
}
|
|
|
|
static DEVICE_ATTR(fnic_state, S_IRUGO, fnic_show_state, NULL);
|
|
static DEVICE_ATTR(drv_version, S_IRUGO, fnic_show_drv_version, NULL);
|
|
static DEVICE_ATTR(link_state, S_IRUGO, fnic_show_link_state, NULL);
|
|
|
|
static struct attribute *fnic_host_attrs[] = {
|
|
&dev_attr_fnic_state.attr,
|
|
&dev_attr_drv_version.attr,
|
|
&dev_attr_link_state.attr,
|
|
NULL,
|
|
};
|
|
|
|
static const struct attribute_group fnic_host_attr_group = {
|
|
.attrs = fnic_host_attrs
|
|
};
|
|
|
|
const struct attribute_group *fnic_host_groups[] = {
|
|
&fnic_host_attr_group,
|
|
NULL
|
|
};
|