diff options
author | Chris Leech <christopher.leech@intel.com> | 2009-11-03 14:46:08 -0500 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2009-12-04 13:00:56 -0500 |
commit | 86221969e20a2f60ce104160dc836a964974673b (patch) | |
tree | 83f40bc6490feddd18fe9650cbc3b61f0fb7b2e2 /include/scsi/libfc.h | |
parent | 93e6d5ab9969a9200752658677eafd96772302f0 (diff) |
[SCSI] libfc: changes to libfc_host_alloc to consolidate initialization with allocation
I'd like to keep basic initialization together with allocation, which means
this can't just be a tail-call to scsi_host_alloc.
This is needed to create a generic libfc host allocation routine for NPIV
VN_Ports, which will share the exchange ID space (through sharing exchange
manager structures) with the parent lport. In order to clone the exchange
manager list when the lport is allocated, the list head must be initialized
earlier.
Also, update fnic to use the libfc_host_alloc so that later changes do not break
it. (contribution by Joe Eykholt)
Signed-off-by: Chris Leech <christopher.leech@intel.com>
Signed-off-by: Joe Eykholt <jeykholt@cisco.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'include/scsi/libfc.h')
-rw-r--r-- | include/scsi/libfc.h | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/include/scsi/libfc.h b/include/scsi/libfc.h index 690f8296e633..ed3057b4e78d 100644 --- a/include/scsi/libfc.h +++ b/include/scsi/libfc.h | |||
@@ -739,12 +739,21 @@ static inline void *lport_priv(const struct fc_lport *lp) | |||
739 | * @sht: ptr to the scsi host templ | 739 | * @sht: ptr to the scsi host templ |
740 | * @priv_size: size of private data after fc_lport | 740 | * @priv_size: size of private data after fc_lport |
741 | * | 741 | * |
742 | * Returns: ptr to Scsi_Host | 742 | * Returns: libfc lport |
743 | */ | 743 | */ |
744 | static inline struct Scsi_Host * | 744 | static inline struct fc_lport * |
745 | libfc_host_alloc(struct scsi_host_template *sht, int priv_size) | 745 | libfc_host_alloc(struct scsi_host_template *sht, int priv_size) |
746 | { | 746 | { |
747 | return scsi_host_alloc(sht, sizeof(struct fc_lport) + priv_size); | 747 | struct fc_lport *lport; |
748 | struct Scsi_Host *shost; | ||
749 | |||
750 | shost = scsi_host_alloc(sht, sizeof(*lport) + priv_size); | ||
751 | if (!shost) | ||
752 | return NULL; | ||
753 | lport = shost_priv(shost); | ||
754 | lport->host = shost; | ||
755 | INIT_LIST_HEAD(&lport->ema_list); | ||
756 | return lport; | ||
748 | } | 757 | } |
749 | 758 | ||
750 | /* | 759 | /* |