Linux kernel & device driver programming

Cross-Referenced Linux and Device Driver Code

[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ]
Version: [ 2.6.11.8 ] [ 2.6.25 ] [ 2.6.25.8 ] [ 2.6.31.13 ] Architecture: [ i386 ]

Diff markup

Differences between /linux/drivers/scsi/scsi_transport_srp.c (Version 2.6.31.13) and /linux/drivers/scsi/scsi_transport_srp.c (Version 2.6.25.8)


  1 /*                                                  1 /*
  2  * SCSI RDMA (SRP) transport class                  2  * SCSI RDMA (SRP) transport class
  3  *                                                  3  *
  4  * Copyright (C) 2007 FUJITA Tomonori <tomof@a      4  * Copyright (C) 2007 FUJITA Tomonori <tomof@acm.org>
  5  *                                                  5  *
  6  * This program is free software; you can redi      6  * This program is free software; you can redistribute it and/or
  7  * modify it under the terms of the GNU Genera      7  * modify it under the terms of the GNU General Public License as
  8  * published by the Free Software Foundation,       8  * published by the Free Software Foundation, version 2 of the
  9  * License.                                         9  * License.
 10  *                                                 10  *
 11  * This program is distributed in the hope tha     11  * This program is distributed in the hope that it will be useful, but
 12  * WITHOUT ANY WARRANTY; without even the impl     12  * WITHOUT ANY WARRANTY; without even the implied warranty of
 13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR     13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 14  * General Public License for more details.        14  * General Public License for more details.
 15  *                                                 15  *
 16  * You should have received a copy of the GNU      16  * You should have received a copy of the GNU General Public License
 17  * along with this program; if not, write to t     17  * along with this program; if not, write to the Free Software
 18  * Foundation, Inc., 51 Franklin St, Fifth Flo     18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 19  * 02110-1301 USA                                  19  * 02110-1301 USA
 20  */                                                20  */
 21 #include <linux/init.h>                            21 #include <linux/init.h>
 22 #include <linux/module.h>                          22 #include <linux/module.h>
 23 #include <linux/jiffies.h>                         23 #include <linux/jiffies.h>
 24 #include <linux/err.h>                             24 #include <linux/err.h>
 25 #include <linux/slab.h>                            25 #include <linux/slab.h>
 26 #include <linux/string.h>                          26 #include <linux/string.h>
 27                                                    27 
 28 #include <scsi/scsi.h>                             28 #include <scsi/scsi.h>
 29 #include <scsi/scsi_device.h>                      29 #include <scsi/scsi_device.h>
 30 #include <scsi/scsi_host.h>                        30 #include <scsi/scsi_host.h>
 31 #include <scsi/scsi_transport.h>                   31 #include <scsi/scsi_transport.h>
 32 #include <scsi/scsi_transport_srp.h>               32 #include <scsi/scsi_transport_srp.h>
 33 #include "scsi_transport_srp_internal.h"           33 #include "scsi_transport_srp_internal.h"
 34                                                    34 
 35 struct srp_host_attrs {                            35 struct srp_host_attrs {
 36         atomic_t next_port_id;                     36         atomic_t next_port_id;
 37 };                                                 37 };
 38 #define to_srp_host_attrs(host) ((struct srp_h     38 #define to_srp_host_attrs(host) ((struct srp_host_attrs *)(host)->shost_data)
 39                                                    39 
 40 #define SRP_HOST_ATTRS 0                           40 #define SRP_HOST_ATTRS 0
 41 #define SRP_RPORT_ATTRS 2                          41 #define SRP_RPORT_ATTRS 2
 42                                                    42 
 43 struct srp_internal {                              43 struct srp_internal {
 44         struct scsi_transport_template t;          44         struct scsi_transport_template t;
 45         struct srp_function_template *f;           45         struct srp_function_template *f;
 46                                                    46 
 47         struct device_attribute *host_attrs[SR !!  47         struct class_device_attribute *host_attrs[SRP_HOST_ATTRS + 1];
 48                                                    48 
 49         struct device_attribute *rport_attrs[S !!  49         struct class_device_attribute *rport_attrs[SRP_RPORT_ATTRS + 1];
 50         struct device_attribute private_rport_ !!  50         struct class_device_attribute private_rport_attrs[SRP_RPORT_ATTRS];
 51         struct transport_container rport_attr_     51         struct transport_container rport_attr_cont;
 52 };                                                 52 };
 53                                                    53 
 54 #define to_srp_internal(tmpl) container_of(tmp     54 #define to_srp_internal(tmpl) container_of(tmpl, struct srp_internal, t)
 55                                                    55 
 56 #define dev_to_rport(d) container_of(d, struct     56 #define dev_to_rport(d) container_of(d, struct srp_rport, dev)
 57 #define transport_class_to_srp_rport(dev) dev_ !!  57 #define transport_class_to_srp_rport(cdev) dev_to_rport((cdev)->dev)
 58                                                    58 
 59 static int srp_host_setup(struct transport_con     59 static int srp_host_setup(struct transport_container *tc, struct device *dev,
 60                           struct device *cdev) !!  60                           struct class_device *cdev)
 61 {                                                  61 {
 62         struct Scsi_Host *shost = dev_to_shost     62         struct Scsi_Host *shost = dev_to_shost(dev);
 63         struct srp_host_attrs *srp_host = to_s     63         struct srp_host_attrs *srp_host = to_srp_host_attrs(shost);
 64                                                    64 
 65         atomic_set(&srp_host->next_port_id, 0)     65         atomic_set(&srp_host->next_port_id, 0);
 66         return 0;                                  66         return 0;
 67 }                                                  67 }
 68                                                    68 
 69 static DECLARE_TRANSPORT_CLASS(srp_host_class,     69 static DECLARE_TRANSPORT_CLASS(srp_host_class, "srp_host", srp_host_setup,
 70                                NULL, NULL);        70                                NULL, NULL);
 71                                                    71 
 72 static DECLARE_TRANSPORT_CLASS(srp_rport_class     72 static DECLARE_TRANSPORT_CLASS(srp_rport_class, "srp_remote_ports",
 73                                NULL, NULL, NUL     73                                NULL, NULL, NULL);
 74                                                    74 
 75 #define SETUP_TEMPLATE(attrb, field, perm, tes     75 #define SETUP_TEMPLATE(attrb, field, perm, test, ro_test, ro_perm)      \
 76         i->private_##attrb[count] = dev_attr_# !!  76         i->private_##attrb[count] = class_device_attr_##field;          \
 77         i->private_##attrb[count].attr.mode =      77         i->private_##attrb[count].attr.mode = perm;                     \
 78         if (ro_test) {                             78         if (ro_test) {                                                  \
 79                 i->private_##attrb[count].attr     79                 i->private_##attrb[count].attr.mode = ro_perm;          \
 80                 i->private_##attrb[count].stor     80                 i->private_##attrb[count].store = NULL;                 \
 81         }                                          81         }                                                               \
 82         i->attrb[count] = &i->private_##attrb[     82         i->attrb[count] = &i->private_##attrb[count];                   \
 83         if (test)                                  83         if (test)                                                       \
 84                 count++                            84                 count++
 85                                                    85 
 86 #define SETUP_RPORT_ATTRIBUTE_RD(field)            86 #define SETUP_RPORT_ATTRIBUTE_RD(field)                                 \
 87         SETUP_TEMPLATE(rport_attrs, field, S_I     87         SETUP_TEMPLATE(rport_attrs, field, S_IRUGO, 1, 0, 0)
 88                                                    88 
 89 #define SETUP_RPORT_ATTRIBUTE_RW(field)            89 #define SETUP_RPORT_ATTRIBUTE_RW(field)                                 \
 90         SETUP_TEMPLATE(rport_attrs, field, S_I     90         SETUP_TEMPLATE(rport_attrs, field, S_IRUGO | S_IWUSR,           \
 91                        1, 1, S_IRUGO)              91                        1, 1, S_IRUGO)
 92                                                    92 
 93 #define SRP_PID(p) \                               93 #define SRP_PID(p) \
 94         (p)->port_id[0], (p)->port_id[1], (p)-     94         (p)->port_id[0], (p)->port_id[1], (p)->port_id[2], (p)->port_id[3], \
 95         (p)->port_id[4], (p)->port_id[5], (p)-     95         (p)->port_id[4], (p)->port_id[5], (p)->port_id[6], (p)->port_id[7], \
 96         (p)->port_id[8], (p)->port_id[9], (p)-     96         (p)->port_id[8], (p)->port_id[9], (p)->port_id[10], (p)->port_id[11], \
 97         (p)->port_id[12], (p)->port_id[13], (p     97         (p)->port_id[12], (p)->port_id[13], (p)->port_id[14], (p)->port_id[15]
 98                                                    98 
 99 #define SRP_PID_FMT "%02x:%02x:%02x:%02x:%02x:     99 #define SRP_PID_FMT "%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:" \
100         "%02x:%02x:%02x:%02x:%02x:%02x:%02x:%0    100         "%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x"
101                                                   101 
102 static ssize_t                                    102 static ssize_t
103 show_srp_rport_id(struct device *dev, struct d !! 103 show_srp_rport_id(struct class_device *cdev, char *buf)
104                   char *buf)                   << 
105 {                                                 104 {
106         struct srp_rport *rport = transport_cl !! 105         struct srp_rport *rport = transport_class_to_srp_rport(cdev);
107         return sprintf(buf, SRP_PID_FMT "\n",     106         return sprintf(buf, SRP_PID_FMT "\n", SRP_PID(rport));
108 }                                                 107 }
109                                                   108 
110 static DEVICE_ATTR(port_id, S_IRUGO, show_srp_ !! 109 static CLASS_DEVICE_ATTR(port_id, S_IRUGO, show_srp_rport_id, NULL);
111                                                   110 
112 static const struct {                             111 static const struct {
113         u32 value;                                112         u32 value;
114         char *name;                               113         char *name;
115 } srp_rport_role_names[] = {                      114 } srp_rport_role_names[] = {
116         {SRP_RPORT_ROLE_INITIATOR, "SRP Initia    115         {SRP_RPORT_ROLE_INITIATOR, "SRP Initiator"},
117         {SRP_RPORT_ROLE_TARGET, "SRP Target"},    116         {SRP_RPORT_ROLE_TARGET, "SRP Target"},
118 };                                                117 };
119                                                   118 
120 static ssize_t                                    119 static ssize_t
121 show_srp_rport_roles(struct device *dev, struc !! 120 show_srp_rport_roles(struct class_device *cdev, char *buf)
122                      char *buf)                << 
123 {                                                 121 {
124         struct srp_rport *rport = transport_cl !! 122         struct srp_rport *rport = transport_class_to_srp_rport(cdev);
125         int i;                                    123         int i;
126         char *name = NULL;                        124         char *name = NULL;
127                                                   125 
128         for (i = 0; i < ARRAY_SIZE(srp_rport_r    126         for (i = 0; i < ARRAY_SIZE(srp_rport_role_names); i++)
129                 if (srp_rport_role_names[i].va    127                 if (srp_rport_role_names[i].value == rport->roles) {
130                         name = srp_rport_role_    128                         name = srp_rport_role_names[i].name;
131                         break;                    129                         break;
132                 }                                 130                 }
133         return sprintf(buf, "%s\n", name ? : "    131         return sprintf(buf, "%s\n", name ? : "unknown");
134 }                                                 132 }
135                                                   133 
136 static DEVICE_ATTR(roles, S_IRUGO, show_srp_rp !! 134 static CLASS_DEVICE_ATTR(roles, S_IRUGO, show_srp_rport_roles, NULL);
137                                                   135 
138 static void srp_rport_release(struct device *d    136 static void srp_rport_release(struct device *dev)
139 {                                                 137 {
140         struct srp_rport *rport = dev_to_rport    138         struct srp_rport *rport = dev_to_rport(dev);
141                                                   139 
142         put_device(dev->parent);                  140         put_device(dev->parent);
143         kfree(rport);                             141         kfree(rport);
144 }                                                 142 }
145                                                   143 
146 static int scsi_is_srp_rport(const struct devi    144 static int scsi_is_srp_rport(const struct device *dev)
147 {                                                 145 {
148         return dev->release == srp_rport_relea    146         return dev->release == srp_rport_release;
149 }                                                 147 }
150                                                   148 
151 static int srp_rport_match(struct attribute_co    149 static int srp_rport_match(struct attribute_container *cont,
152                            struct device *dev)    150                            struct device *dev)
153 {                                                 151 {
154         struct Scsi_Host *shost;                  152         struct Scsi_Host *shost;
155         struct srp_internal *i;                   153         struct srp_internal *i;
156                                                   154 
157         if (!scsi_is_srp_rport(dev))              155         if (!scsi_is_srp_rport(dev))
158                 return 0;                         156                 return 0;
159                                                   157 
160         shost = dev_to_shost(dev->parent);        158         shost = dev_to_shost(dev->parent);
161         if (!shost->transportt)                   159         if (!shost->transportt)
162                 return 0;                         160                 return 0;
163         if (shost->transportt->host_attrs.ac.c    161         if (shost->transportt->host_attrs.ac.class != &srp_host_class.class)
164                 return 0;                         162                 return 0;
165                                                   163 
166         i = to_srp_internal(shost->transportt)    164         i = to_srp_internal(shost->transportt);
167         return &i->rport_attr_cont.ac == cont;    165         return &i->rport_attr_cont.ac == cont;
168 }                                                 166 }
169                                                   167 
170 static int srp_host_match(struct attribute_con    168 static int srp_host_match(struct attribute_container *cont, struct device *dev)
171 {                                                 169 {
172         struct Scsi_Host *shost;                  170         struct Scsi_Host *shost;
173         struct srp_internal *i;                   171         struct srp_internal *i;
174                                                   172 
175         if (!scsi_is_host_device(dev))            173         if (!scsi_is_host_device(dev))
176                 return 0;                         174                 return 0;
177                                                   175 
178         shost = dev_to_shost(dev);                176         shost = dev_to_shost(dev);
179         if (!shost->transportt)                   177         if (!shost->transportt)
180                 return 0;                         178                 return 0;
181         if (shost->transportt->host_attrs.ac.c    179         if (shost->transportt->host_attrs.ac.class != &srp_host_class.class)
182                 return 0;                         180                 return 0;
183                                                   181 
184         i = to_srp_internal(shost->transportt)    182         i = to_srp_internal(shost->transportt);
185         return &i->t.host_attrs.ac == cont;       183         return &i->t.host_attrs.ac == cont;
186 }                                                 184 }
187                                                   185 
188 /**                                               186 /**
189  * srp_rport_add - add a SRP remote port to th    187  * srp_rport_add - add a SRP remote port to the device hierarchy
190  * @shost:      scsi host the remote port is c    188  * @shost:      scsi host the remote port is connected to.
191  * @ids:        The port id for the remote por    189  * @ids:        The port id for the remote port.
192  *                                                190  *
193  * Publishes a port to the rest of the system.    191  * Publishes a port to the rest of the system.
194  */                                               192  */
195 struct srp_rport *srp_rport_add(struct Scsi_Ho    193 struct srp_rport *srp_rport_add(struct Scsi_Host *shost,
196                                 struct srp_rpo    194                                 struct srp_rport_identifiers *ids)
197 {                                                 195 {
198         struct srp_rport *rport;                  196         struct srp_rport *rport;
199         struct device *parent = &shost->shost_    197         struct device *parent = &shost->shost_gendev;
200         int id, ret;                              198         int id, ret;
201                                                   199 
202         rport = kzalloc(sizeof(*rport), GFP_KE    200         rport = kzalloc(sizeof(*rport), GFP_KERNEL);
203         if (!rport)                               201         if (!rport)
204                 return ERR_PTR(-ENOMEM);          202                 return ERR_PTR(-ENOMEM);
205                                                   203 
206         device_initialize(&rport->dev);           204         device_initialize(&rport->dev);
207                                                   205 
208         rport->dev.parent = get_device(parent)    206         rport->dev.parent = get_device(parent);
209         rport->dev.release = srp_rport_release    207         rport->dev.release = srp_rport_release;
210                                                   208 
211         memcpy(rport->port_id, ids->port_id, s    209         memcpy(rport->port_id, ids->port_id, sizeof(rport->port_id));
212         rport->roles = ids->roles;                210         rport->roles = ids->roles;
213                                                   211 
214         id = atomic_inc_return(&to_srp_host_at    212         id = atomic_inc_return(&to_srp_host_attrs(shost)->next_port_id);
215         dev_set_name(&rport->dev, "port-%d:%d" !! 213         sprintf(rport->dev.bus_id, "port-%d:%d", shost->host_no, id);
216                                                   214 
217         transport_setup_device(&rport->dev);      215         transport_setup_device(&rport->dev);
218                                                   216 
219         ret = device_add(&rport->dev);            217         ret = device_add(&rport->dev);
220         if (ret) {                                218         if (ret) {
221                 transport_destroy_device(&rpor    219                 transport_destroy_device(&rport->dev);
222                 put_device(&rport->dev);          220                 put_device(&rport->dev);
223                 return ERR_PTR(ret);              221                 return ERR_PTR(ret);
224         }                                         222         }
225                                                   223 
226         if (shost->active_mode & MODE_TARGET &    224         if (shost->active_mode & MODE_TARGET &&
227             ids->roles == SRP_RPORT_ROLE_INITI    225             ids->roles == SRP_RPORT_ROLE_INITIATOR) {
228                 ret = srp_tgt_it_nexus_create(    226                 ret = srp_tgt_it_nexus_create(shost, (unsigned long)rport,
229                                                   227                                               rport->port_id);
230                 if (ret) {                        228                 if (ret) {
231                         device_del(&rport->dev    229                         device_del(&rport->dev);
232                         transport_destroy_devi    230                         transport_destroy_device(&rport->dev);
233                         put_device(&rport->dev    231                         put_device(&rport->dev);
234                         return ERR_PTR(ret);      232                         return ERR_PTR(ret);
235                 }                                 233                 }
236         }                                         234         }
237                                                   235 
238         transport_add_device(&rport->dev);        236         transport_add_device(&rport->dev);
239         transport_configure_device(&rport->dev    237         transport_configure_device(&rport->dev);
240                                                   238 
241         return rport;                             239         return rport;
242 }                                                 240 }
243 EXPORT_SYMBOL_GPL(srp_rport_add);                 241 EXPORT_SYMBOL_GPL(srp_rport_add);
244                                                   242 
245 /**                                               243 /**
246  * srp_rport_del  -  remove a SRP remote port     244  * srp_rport_del  -  remove a SRP remote port
247  * @rport:      SRP remote port to remove         245  * @rport:      SRP remote port to remove
248  *                                                246  *
249  * Removes the specified SRP remote port.         247  * Removes the specified SRP remote port.
250  */                                               248  */
251 void srp_rport_del(struct srp_rport *rport)       249 void srp_rport_del(struct srp_rport *rport)
252 {                                                 250 {
253         struct device *dev = &rport->dev;         251         struct device *dev = &rport->dev;
254         struct Scsi_Host *shost = dev_to_shost    252         struct Scsi_Host *shost = dev_to_shost(dev->parent);
255                                                   253 
256         if (shost->active_mode & MODE_TARGET &    254         if (shost->active_mode & MODE_TARGET &&
257             rport->roles == SRP_RPORT_ROLE_INI    255             rport->roles == SRP_RPORT_ROLE_INITIATOR)
258                 srp_tgt_it_nexus_destroy(shost    256                 srp_tgt_it_nexus_destroy(shost, (unsigned long)rport);
259                                                   257 
260         transport_remove_device(dev);             258         transport_remove_device(dev);
261         device_del(dev);                          259         device_del(dev);
262         transport_destroy_device(dev);            260         transport_destroy_device(dev);
263         put_device(dev);                          261         put_device(dev);
264 }                                                 262 }
265 EXPORT_SYMBOL_GPL(srp_rport_del);                 263 EXPORT_SYMBOL_GPL(srp_rport_del);
266                                                   264 
267 static int do_srp_rport_del(struct device *dev    265 static int do_srp_rport_del(struct device *dev, void *data)
268 {                                                 266 {
269         if (scsi_is_srp_rport(dev))               267         if (scsi_is_srp_rport(dev))
270                 srp_rport_del(dev_to_rport(dev    268                 srp_rport_del(dev_to_rport(dev));
271         return 0;                                 269         return 0;
272 }                                                 270 }
273                                                   271 
274 /**                                               272 /**
275  * srp_remove_host  -  tear down a Scsi_Host's    273  * srp_remove_host  -  tear down a Scsi_Host's SRP data structures
276  * @shost:      Scsi Host that is torn down       274  * @shost:      Scsi Host that is torn down
277  *                                                275  *
278  * Removes all SRP remote ports for a given Sc    276  * Removes all SRP remote ports for a given Scsi_Host.
279  * Must be called just before scsi_remove_host    277  * Must be called just before scsi_remove_host for SRP HBAs.
280  */                                               278  */
281 void srp_remove_host(struct Scsi_Host *shost)     279 void srp_remove_host(struct Scsi_Host *shost)
282 {                                                 280 {
283         device_for_each_child(&shost->shost_ge    281         device_for_each_child(&shost->shost_gendev, NULL, do_srp_rport_del);
284 }                                                 282 }
285 EXPORT_SYMBOL_GPL(srp_remove_host);               283 EXPORT_SYMBOL_GPL(srp_remove_host);
286                                                   284 
287 static int srp_tsk_mgmt_response(struct Scsi_H    285 static int srp_tsk_mgmt_response(struct Scsi_Host *shost, u64 nexus, u64 tm_id,
288                                  int result)      286                                  int result)
289 {                                                 287 {
290         struct srp_internal *i = to_srp_intern    288         struct srp_internal *i = to_srp_internal(shost->transportt);
291         return i->f->tsk_mgmt_response(shost,     289         return i->f->tsk_mgmt_response(shost, nexus, tm_id, result);
292 }                                                 290 }
293                                                   291 
294 static int srp_it_nexus_response(struct Scsi_H    292 static int srp_it_nexus_response(struct Scsi_Host *shost, u64 nexus, int result)
295 {                                                 293 {
296         struct srp_internal *i = to_srp_intern    294         struct srp_internal *i = to_srp_internal(shost->transportt);
297         return i->f->it_nexus_response(shost,     295         return i->f->it_nexus_response(shost, nexus, result);
298 }                                                 296 }
299                                                   297 
300 /**                                               298 /**
301  * srp_attach_transport  -  instantiate SRP tr    299  * srp_attach_transport  -  instantiate SRP transport template
302  * @ft:         SRP transport class function t    300  * @ft:         SRP transport class function template
303  */                                               301  */
304 struct scsi_transport_template *                  302 struct scsi_transport_template *
305 srp_attach_transport(struct srp_function_templ    303 srp_attach_transport(struct srp_function_template *ft)
306 {                                                 304 {
307         int count;                                305         int count;
308         struct srp_internal *i;                   306         struct srp_internal *i;
309                                                   307 
310         i = kzalloc(sizeof(*i), GFP_KERNEL);      308         i = kzalloc(sizeof(*i), GFP_KERNEL);
311         if (!i)                                   309         if (!i)
312                 return NULL;                      310                 return NULL;
313                                                   311 
314         i->t.tsk_mgmt_response = srp_tsk_mgmt_    312         i->t.tsk_mgmt_response = srp_tsk_mgmt_response;
315         i->t.it_nexus_response = srp_it_nexus_    313         i->t.it_nexus_response = srp_it_nexus_response;
316                                                   314 
317         i->t.host_size = sizeof(struct srp_hos    315         i->t.host_size = sizeof(struct srp_host_attrs);
318         i->t.host_attrs.ac.attrs = &i->host_at    316         i->t.host_attrs.ac.attrs = &i->host_attrs[0];
319         i->t.host_attrs.ac.class = &srp_host_c    317         i->t.host_attrs.ac.class = &srp_host_class.class;
320         i->t.host_attrs.ac.match = srp_host_ma    318         i->t.host_attrs.ac.match = srp_host_match;
321         i->host_attrs[0] = NULL;                  319         i->host_attrs[0] = NULL;
322         transport_container_register(&i->t.hos    320         transport_container_register(&i->t.host_attrs);
323                                                   321 
324         i->rport_attr_cont.ac.attrs = &i->rpor    322         i->rport_attr_cont.ac.attrs = &i->rport_attrs[0];
325         i->rport_attr_cont.ac.class = &srp_rpo    323         i->rport_attr_cont.ac.class = &srp_rport_class.class;
326         i->rport_attr_cont.ac.match = srp_rpor    324         i->rport_attr_cont.ac.match = srp_rport_match;
327         transport_container_register(&i->rport    325         transport_container_register(&i->rport_attr_cont);
328                                                   326 
329         count = 0;                                327         count = 0;
330         SETUP_RPORT_ATTRIBUTE_RD(port_id);        328         SETUP_RPORT_ATTRIBUTE_RD(port_id);
331         SETUP_RPORT_ATTRIBUTE_RD(roles);          329         SETUP_RPORT_ATTRIBUTE_RD(roles);
332         i->rport_attrs[count] = NULL;             330         i->rport_attrs[count] = NULL;
333                                                   331 
334         i->f = ft;                                332         i->f = ft;
335                                                   333 
336         return &i->t;                             334         return &i->t;
337 }                                                 335 }
338 EXPORT_SYMBOL_GPL(srp_attach_transport);          336 EXPORT_SYMBOL_GPL(srp_attach_transport);
339                                                   337 
340 /**                                               338 /**
341  * srp_release_transport  -  release SRP trans    339  * srp_release_transport  -  release SRP transport template instance
342  * @t:          transport template instance       340  * @t:          transport template instance
343  */                                               341  */
344 void srp_release_transport(struct scsi_transpo    342 void srp_release_transport(struct scsi_transport_template *t)
345 {                                                 343 {
346         struct srp_internal *i = to_srp_intern    344         struct srp_internal *i = to_srp_internal(t);
347                                                   345 
348         transport_container_unregister(&i->t.h    346         transport_container_unregister(&i->t.host_attrs);
349         transport_container_unregister(&i->rpo    347         transport_container_unregister(&i->rport_attr_cont);
350                                                   348 
351         kfree(i);                                 349         kfree(i);
352 }                                                 350 }
353 EXPORT_SYMBOL_GPL(srp_release_transport);         351 EXPORT_SYMBOL_GPL(srp_release_transport);
354                                                   352 
355 static __init int srp_transport_init(void)        353 static __init int srp_transport_init(void)
356 {                                                 354 {
357         int ret;                                  355         int ret;
358                                                   356 
359         ret = transport_class_register(&srp_ho    357         ret = transport_class_register(&srp_host_class);
360         if (ret)                                  358         if (ret)
361                 return ret;                       359                 return ret;
362         ret = transport_class_register(&srp_rp    360         ret = transport_class_register(&srp_rport_class);
363         if (ret)                                  361         if (ret)
364                 goto unregister_host_class;       362                 goto unregister_host_class;
365                                                   363 
366         return 0;                                 364         return 0;
367 unregister_host_class:                            365 unregister_host_class:
368         transport_class_unregister(&srp_host_c    366         transport_class_unregister(&srp_host_class);
369         return ret;                               367         return ret;
370 }                                                 368 }
371                                                   369 
372 static void __exit srp_transport_exit(void)       370 static void __exit srp_transport_exit(void)
373 {                                                 371 {
374         transport_class_unregister(&srp_host_c    372         transport_class_unregister(&srp_host_class);
375         transport_class_unregister(&srp_rport_    373         transport_class_unregister(&srp_rport_class);
376 }                                                 374 }
377                                                   375 
378 MODULE_AUTHOR("FUJITA Tomonori");                 376 MODULE_AUTHOR("FUJITA Tomonori");
379 MODULE_DESCRIPTION("SRP Transport Attributes")    377 MODULE_DESCRIPTION("SRP Transport Attributes");
380 MODULE_LICENSE("GPL");                            378 MODULE_LICENSE("GPL");
381                                                   379 
382 module_init(srp_transport_init);                  380 module_init(srp_transport_init);
383 module_exit(srp_transport_exit);                  381 module_exit(srp_transport_exit);
384                                                   382 
  This page was automatically generated by the LXR engine.