This commit was manufactured by cvs2svn to create tag
[linux-2.6.git] / include / scsi / scsi_transport_fc.h
1 /* 
2  *  FiberChannel transport specific attributes exported to sysfs.
3  *
4  *  Copyright (c) 2003 Silicon Graphics, Inc.  All rights reserved.
5  *
6  *  This program is free software; you can redistribute it and/or modify
7  *  it under the terms of the GNU General Public License as published by
8  *  the Free Software Foundation; either version 2 of the License, or
9  *  (at your option) any later version.
10  *
11  *  This program is distributed in the hope that it will be useful,
12  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  *  GNU General Public License for more details.
15  *
16  *  You should have received a copy of the GNU General Public License
17  *  along with this program; if not, write to the Free Software
18  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  */
20 #ifndef SCSI_TRANSPORT_FC_H
21 #define SCSI_TRANSPORT_FC_H
22
23 #include <linux/config.h>
24
25 struct scsi_transport_template;
26
27 struct fc_starget_attrs {       /* aka fc_target_attrs */
28         int port_id;
29         uint64_t node_name;
30         uint64_t port_name;
31         uint32_t dev_loss_tmo;  /* Remote Port loss timeout in seconds. */
32         struct work_struct dev_loss_work;
33 };
34
35 #define fc_starget_port_id(x) \
36         (((struct fc_starget_attrs *)&(x)->starget_data)->port_id)
37 #define fc_starget_node_name(x) \
38         (((struct fc_starget_attrs *)&(x)->starget_data)->node_name)
39 #define fc_starget_port_name(x) \
40         (((struct fc_starget_attrs *)&(x)->starget_data)->port_name)
41 #define fc_starget_dev_loss_tmo(x) \
42         (((struct fc_starget_attrs *)&(x)->starget_data)->dev_loss_tmo)
43 #define fc_starget_dev_loss_work(x) \
44         (((struct fc_starget_attrs *)&(x)->starget_data)->dev_loss_work)
45
46 struct fc_host_attrs {
47         uint32_t link_down_tmo; /* Link Down timeout in seconds. */
48         struct work_struct link_down_work;
49 };
50
51 #define fc_host_link_down_tmo(x) \
52         (((struct fc_host_attrs *)(x)->shost_data)->link_down_tmo)
53 #define fc_host_link_down_work(x) \
54         (((struct fc_host_attrs *)(x)->shost_data)->link_down_work)
55
56
57 /* The functions by which the transport class and the driver communicate */
58 struct fc_function_template {
59         void    (*get_starget_port_id)(struct scsi_target *);
60         void    (*get_starget_node_name)(struct scsi_target *);
61         void    (*get_starget_port_name)(struct scsi_target *);
62         void    (*get_starget_dev_loss_tmo)(struct scsi_target *);
63         void    (*set_starget_dev_loss_tmo)(struct scsi_target *, uint32_t);
64
65         void    (*get_host_link_down_tmo)(struct Scsi_Host *);
66         void    (*set_host_link_down_tmo)(struct Scsi_Host *, uint32_t);
67
68         /* 
69          * The driver sets these to tell the transport class it
70          * wants the attributes displayed in sysfs.  If the show_ flag
71          * is not set, the attribute will be private to the transport
72          * class 
73          */
74         unsigned long   show_starget_port_id:1;
75         unsigned long   show_starget_node_name:1;
76         unsigned long   show_starget_port_name:1;
77         unsigned long   show_starget_dev_loss_tmo:1;
78
79         unsigned long   show_host_link_down_tmo:1;
80
81         /* Private Attributes */
82 };
83
84 struct scsi_transport_template *fc_attach_transport(struct fc_function_template *);
85 void fc_release_transport(struct scsi_transport_template *);
86 int fc_target_block(struct scsi_target *starget);
87 void fc_target_unblock(struct scsi_target *starget);
88 int fc_host_block(struct Scsi_Host *shost);
89 void fc_host_unblock(struct Scsi_Host *shost);
90
91 #endif /* SCSI_TRANSPORT_FC_H */