diff options
author | Dmitry Bogdanov <d.bogdanov@yadro.com> | 2022-05-23 11:59:03 +0200 |
---|---|---|
committer | Martin K. Petersen <martin.petersen@oracle.com> | 2022-06-08 03:55:11 +0200 |
commit | a11b80692be5c408a33ea89e3fe1a240bef8c820 (patch) | |
tree | 75392d8ec55032080d99c6f5fe5c36bedfde749f /include/target | |
parent | scsi: qla2xxx: Update version to 10.02.07.500-k (diff) | |
download | linux-a11b80692be5c408a33ea89e3fe1a240bef8c820.tar.xz linux-a11b80692be5c408a33ea89e3fe1a240bef8c820.zip |
scsi: target: iscsi: Add upcast helpers
iSCSI target is cluttered with open-coded container_of() conversions from
se_nacl to iscsi_node_acl. The code could be cleaned by introducing a
helper - to_iscsi_nacl() (similar to other helpers in target core).
While at it, make another iSCSI conversion helper consistent and rename
iscsi_tpg() helper to to_iscsi_tpg().
Link: https://lore.kernel.org/r/20220523095905.26070-2-d.bogdanov@yadro.com
Reviewed-by: Roman Bolshakov <r.bolshakov@yadro.com>
Reviewed-by: Konstantin Shelekhin <k.shelekhin@yadro.com>
Reviewed-by: Mike Christie <michael.christie@oracle.com>
Reviewed-by: Lee Duncan <lduncan@suse.com>
Signed-off-by: Dmitry Bogdanov <d.bogdanov@yadro.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'include/target')
-rw-r--r-- | include/target/iscsi/iscsi_target_core.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/include/target/iscsi/iscsi_target_core.h b/include/target/iscsi/iscsi_target_core.h index 8e68ace428d9..4dd62947f8db 100644 --- a/include/target/iscsi/iscsi_target_core.h +++ b/include/target/iscsi/iscsi_target_core.h @@ -758,6 +758,12 @@ struct iscsi_node_acl { struct iscsi_node_stat_grps node_stat_grps; }; +static inline struct iscsi_node_acl * +to_iscsi_nacl(struct se_node_acl *se_nacl) +{ + return container_of(se_nacl, struct iscsi_node_acl, se_node_acl); +} + struct iscsi_tpg_attrib { u32 authentication; u32 login_timeout; @@ -839,6 +845,12 @@ struct iscsi_portal_group { struct list_head tpg_list; } ____cacheline_aligned; +static inline struct iscsi_portal_group * +to_iscsi_tpg(struct se_portal_group *se_tpg) +{ + return container_of(se_tpg, struct iscsi_portal_group, tpg_se_tpg); +} + struct iscsi_wwn_stat_grps { struct config_group iscsi_stat_group; struct config_group iscsi_instance_group; |