aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/target
diff options
context:
space:
mode:
authorAndy Grover <agrover@redhat.com>2014-04-04 19:54:13 -0400
committerNicholas Bellinger <nab@linux-iscsi.org>2014-04-11 18:30:51 -0400
commit705665da222b810fced1273169d63f31635df6f0 (patch)
tree86d175551f987c2423a3deee415362d10e8fc79e /drivers/target
parentd242c1d7d39bb50d2816a2834b84c420c3e7084e (diff)
target/tcm_fc: Rename structs and list members for clarity
Rename struct ft_lport_acl to ft_lport_wwn. "acl" is associated with something different in LIO terms. Really, ft_lport_wwn is the fabric-specific wrapper for the struct se_wwn. Rename "lacl" local variables to "ft_wwn" as well. Rename list_heads used as list members to make it clear they're nodes, not heads. Rename lport_node to ft_wwn_node. Rename ft_lport_list to ft_wwn_list Signed-off-by: Andy Grover <agrover@redhat.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'drivers/target')
-rw-r--r--drivers/target/tcm_fc/tcm_fc.h8
-rw-r--r--drivers/target/tcm_fc/tfc_conf.c57
2 files changed, 32 insertions, 33 deletions
diff --git a/drivers/target/tcm_fc/tcm_fc.h b/drivers/target/tcm_fc/tcm_fc.h
index 7290f8fb53f0..a0bcfd3e7e7d 100644
--- a/drivers/target/tcm_fc/tcm_fc.h
+++ b/drivers/target/tcm_fc/tcm_fc.h
@@ -94,19 +94,19 @@ struct ft_lun {
94 */ 94 */
95struct ft_tpg { 95struct ft_tpg {
96 u32 index; 96 u32 index;
97 struct ft_lport_acl *lport_acl; 97 struct ft_lport_wwn *lport_wwn;
98 struct ft_tport *tport; /* active tport or NULL */ 98 struct ft_tport *tport; /* active tport or NULL */
99 struct list_head lun_list; /* head of LUNs */ 99 struct list_head lun_list; /* head of LUNs */
100 struct se_portal_group se_tpg; 100 struct se_portal_group se_tpg;
101 struct workqueue_struct *workqueue; 101 struct workqueue_struct *workqueue;
102}; 102};
103 103
104struct ft_lport_acl { 104struct ft_lport_wwn {
105 u64 wwpn; 105 u64 wwpn;
106 char name[FT_NAMELEN]; 106 char name[FT_NAMELEN];
107 struct list_head ft_wwn_node;
107 struct ft_tpg *tpg; 108 struct ft_tpg *tpg;
108 struct list_head list; 109 struct se_wwn se_wwn;
109 struct se_wwn fc_lport_wwn;
110}; 110};
111 111
112/* 112/*
diff --git a/drivers/target/tcm_fc/tfc_conf.c b/drivers/target/tcm_fc/tfc_conf.c
index ccfa328e0367..bd7d544d5478 100644
--- a/drivers/target/tcm_fc/tfc_conf.c
+++ b/drivers/target/tcm_fc/tfc_conf.c
@@ -50,7 +50,7 @@
50 50
51struct target_fabric_configfs *ft_configfs; 51struct target_fabric_configfs *ft_configfs;
52 52
53static LIST_HEAD(ft_lport_list); 53static LIST_HEAD(ft_wwn_list);
54DEFINE_MUTEX(ft_lport_lock); 54DEFINE_MUTEX(ft_lport_lock);
55 55
56unsigned int ft_debug_logging; 56unsigned int ft_debug_logging;
@@ -298,7 +298,7 @@ static struct se_portal_group *ft_add_tpg(
298 struct config_group *group, 298 struct config_group *group,
299 const char *name) 299 const char *name)
300{ 300{
301 struct ft_lport_acl *lacl; 301 struct ft_lport_wwn *ft_wwn;
302 struct ft_tpg *tpg; 302 struct ft_tpg *tpg;
303 struct workqueue_struct *wq; 303 struct workqueue_struct *wq;
304 unsigned long index; 304 unsigned long index;
@@ -323,12 +323,12 @@ static struct se_portal_group *ft_add_tpg(
323 return ERR_PTR(-ENOSYS); 323 return ERR_PTR(-ENOSYS);
324 } 324 }
325 325
326 lacl = container_of(wwn, struct ft_lport_acl, fc_lport_wwn); 326 ft_wwn = container_of(wwn, struct ft_lport_wwn, se_wwn);
327 tpg = kzalloc(sizeof(*tpg), GFP_KERNEL); 327 tpg = kzalloc(sizeof(*tpg), GFP_KERNEL);
328 if (!tpg) 328 if (!tpg)
329 return NULL; 329 return NULL;
330 tpg->index = index; 330 tpg->index = index;
331 tpg->lport_acl = lacl; 331 tpg->lport_wwn = ft_wwn;
332 INIT_LIST_HEAD(&tpg->lun_list); 332 INIT_LIST_HEAD(&tpg->lun_list);
333 333
334 wq = alloc_workqueue("tcm_fc", 0, 1); 334 wq = alloc_workqueue("tcm_fc", 0, 1);
@@ -347,7 +347,7 @@ static struct se_portal_group *ft_add_tpg(
347 tpg->workqueue = wq; 347 tpg->workqueue = wq;
348 348
349 mutex_lock(&ft_lport_lock); 349 mutex_lock(&ft_lport_lock);
350 lacl->tpg = tpg; 350 ft_wwn->tpg = tpg;
351 mutex_unlock(&ft_lport_lock); 351 mutex_unlock(&ft_lport_lock);
352 352
353 return &tpg->se_tpg; 353 return &tpg->se_tpg;
@@ -356,7 +356,7 @@ static struct se_portal_group *ft_add_tpg(
356static void ft_del_tpg(struct se_portal_group *se_tpg) 356static void ft_del_tpg(struct se_portal_group *se_tpg)
357{ 357{
358 struct ft_tpg *tpg = container_of(se_tpg, struct ft_tpg, se_tpg); 358 struct ft_tpg *tpg = container_of(se_tpg, struct ft_tpg, se_tpg);
359 struct ft_lport_acl *lacl = tpg->lport_acl; 359 struct ft_lport_wwn *ft_wwn = tpg->lport_wwn;
360 360
361 pr_debug("del tpg %s\n", 361 pr_debug("del tpg %s\n",
362 config_item_name(&tpg->se_tpg.tpg_group.cg_item)); 362 config_item_name(&tpg->se_tpg.tpg_group.cg_item));
@@ -367,8 +367,7 @@ static void ft_del_tpg(struct se_portal_group *se_tpg)
367 synchronize_rcu(); 367 synchronize_rcu();
368 368
369 mutex_lock(&ft_lport_lock); 369 mutex_lock(&ft_lport_lock);
370 lacl->tpg = NULL; 370 ft_wwn->tpg = NULL;
371
372 if (tpg->tport) { 371 if (tpg->tport) {
373 tpg->tport->tpg = NULL; 372 tpg->tport->tpg = NULL;
374 tpg->tport = NULL; 373 tpg->tport = NULL;
@@ -387,11 +386,11 @@ static void ft_del_tpg(struct se_portal_group *se_tpg)
387 */ 386 */
388struct ft_tpg *ft_lport_find_tpg(struct fc_lport *lport) 387struct ft_tpg *ft_lport_find_tpg(struct fc_lport *lport)
389{ 388{
390 struct ft_lport_acl *lacl; 389 struct ft_lport_wwn *ft_wwn;
391 390
392 list_for_each_entry(lacl, &ft_lport_list, list) { 391 list_for_each_entry(ft_wwn, &ft_wwn_list, ft_wwn_node) {
393 if (lacl->wwpn == lport->wwpn) 392 if (ft_wwn->wwpn == lport->wwpn)
394 return lacl->tpg; 393 return ft_wwn->tpg;
395 } 394 }
396 return NULL; 395 return NULL;
397} 396}
@@ -409,44 +408,44 @@ static struct se_wwn *ft_add_lport(
409 struct config_group *group, 408 struct config_group *group,
410 const char *name) 409 const char *name)
411{ 410{
412 struct ft_lport_acl *lacl; 411 struct ft_lport_wwn *ft_wwn;
413 struct ft_lport_acl *old_lacl; 412 struct ft_lport_wwn *old_ft_wwn;
414 u64 wwpn; 413 u64 wwpn;
415 414
416 pr_debug("add lport %s\n", name); 415 pr_debug("add lport %s\n", name);
417 if (ft_parse_wwn(name, &wwpn, 1) < 0) 416 if (ft_parse_wwn(name, &wwpn, 1) < 0)
418 return NULL; 417 return NULL;
419 lacl = kzalloc(sizeof(*lacl), GFP_KERNEL); 418 ft_wwn = kzalloc(sizeof(*ft_wwn), GFP_KERNEL);
420 if (!lacl) 419 if (!ft_wwn)
421 return NULL; 420 return NULL;
422 lacl->wwpn = wwpn; 421 ft_wwn->wwpn = wwpn;
423 422
424 mutex_lock(&ft_lport_lock); 423 mutex_lock(&ft_lport_lock);
425 list_for_each_entry(old_lacl, &ft_lport_list, list) { 424 list_for_each_entry(old_ft_wwn, &ft_wwn_list, ft_wwn_node) {
426 if (old_lacl->wwpn == wwpn) { 425 if (old_ft_wwn->wwpn == wwpn) {
427 mutex_unlock(&ft_lport_lock); 426 mutex_unlock(&ft_lport_lock);
428 kfree(lacl); 427 kfree(ft_wwn);
429 return NULL; 428 return NULL;
430 } 429 }
431 } 430 }
432 list_add_tail(&lacl->list, &ft_lport_list); 431 list_add_tail(&ft_wwn->ft_wwn_node, &ft_wwn_list);
433 ft_format_wwn(lacl->name, sizeof(lacl->name), wwpn); 432 ft_format_wwn(ft_wwn->name, sizeof(ft_wwn->name), wwpn);
434 mutex_unlock(&ft_lport_lock); 433 mutex_unlock(&ft_lport_lock);
435 434
436 return &lacl->fc_lport_wwn; 435 return &ft_wwn->se_wwn;
437} 436}
438 437
439static void ft_del_lport(struct se_wwn *wwn) 438static void ft_del_lport(struct se_wwn *wwn)
440{ 439{
441 struct ft_lport_acl *lacl = container_of(wwn, 440 struct ft_lport_wwn *ft_wwn = container_of(wwn,
442 struct ft_lport_acl, fc_lport_wwn); 441 struct ft_lport_wwn, se_wwn);
443 442
444 pr_debug("del lport %s\n", lacl->name); 443 pr_debug("del lport %s\n", ft_wwn->name);
445 mutex_lock(&ft_lport_lock); 444 mutex_lock(&ft_lport_lock);
446 list_del(&lacl->list); 445 list_del(&ft_wwn->ft_wwn_node);
447 mutex_unlock(&ft_lport_lock); 446 mutex_unlock(&ft_lport_lock);
448 447
449 kfree(lacl); 448 kfree(ft_wwn);
450} 449}
451 450
452static ssize_t ft_wwn_show_attr_version( 451static ssize_t ft_wwn_show_attr_version(
@@ -473,7 +472,7 @@ static char *ft_get_fabric_wwn(struct se_portal_group *se_tpg)
473{ 472{
474 struct ft_tpg *tpg = se_tpg->se_tpg_fabric_ptr; 473 struct ft_tpg *tpg = se_tpg->se_tpg_fabric_ptr;
475 474
476 return tpg->lport_acl->name; 475 return tpg->lport_wwn->name;
477} 476}
478 477
479static u16 ft_get_tag(struct se_portal_group *se_tpg) 478static u16 ft_get_tag(struct se_portal_group *se_tpg)