This source file includes following definitions.
- fnic_show_state
- fnic_show_drv_version
- fnic_show_link_state
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 #include <linux/string.h>
19 #include <linux/device.h>
20 #include <scsi/scsi_host.h>
21 #include "fnic.h"
22
23 static ssize_t fnic_show_state(struct device *dev,
24 struct device_attribute *attr, char *buf)
25 {
26 struct fc_lport *lp = shost_priv(class_to_shost(dev));
27 struct fnic *fnic = lport_priv(lp);
28
29 return snprintf(buf, PAGE_SIZE, "%s\n", fnic_state_str[fnic->state]);
30 }
31
32 static ssize_t fnic_show_drv_version(struct device *dev,
33 struct device_attribute *attr, char *buf)
34 {
35 return snprintf(buf, PAGE_SIZE, "%s\n", DRV_VERSION);
36 }
37
38 static ssize_t fnic_show_link_state(struct device *dev,
39 struct device_attribute *attr, char *buf)
40 {
41 struct fc_lport *lp = shost_priv(class_to_shost(dev));
42
43 return snprintf(buf, PAGE_SIZE, "%s\n", (lp->link_up)
44 ? "Link Up" : "Link Down");
45 }
46
47 static DEVICE_ATTR(fnic_state, S_IRUGO, fnic_show_state, NULL);
48 static DEVICE_ATTR(drv_version, S_IRUGO, fnic_show_drv_version, NULL);
49 static DEVICE_ATTR(link_state, S_IRUGO, fnic_show_link_state, NULL);
50
51 struct device_attribute *fnic_attrs[] = {
52 &dev_attr_fnic_state,
53 &dev_attr_drv_version,
54 &dev_attr_link_state,
55 NULL,
56 };