From 0685230c59b5482e04ab50e7afc51119ceaba651 Mon Sep 17 00:00:00 2001 From: Joe Eykholt <jeykholt@cisco.com> Date: Tue, 20 Jul 2010 15:19:53 -0700 Subject: [SCSI] libfc: add discovery-private pointer for LLD For VN_port to VN_port mode, FIP will do discovery and needs a way to find its state from the local port or discovery structure. It seems that any other LLD that implements its own discovery would also need something like this. Replace disc->lport with disc->priv, and use container_of to find the lport. We could use disc->priv for that, but container_of is smaller and faster. 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> --- include/scsi/libfc.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/scsi/libfc.h b/include/scsi/libfc.h index fcbee8c38b0..5f64e593cca 100644 --- a/include/scsi/libfc.h +++ b/include/scsi/libfc.h @@ -739,7 +739,7 @@ struct libfc_function_template { * @buf_len: Length of the discovery buffer * @disc_id: Discovery ID * @rports: List of discovered remote ports - * @lport: The local port that discovery is for + * @priv: Private pointer for use by discovery code * @disc_mutex: Mutex that protects the discovery context * @partial_buf: Partial name buffer (if names are returned * in multiple frames) @@ -755,7 +755,7 @@ struct fc_disc { u16 disc_id; struct list_head rports; - struct fc_lport *lport; + void *priv; struct mutex disc_mutex; struct fc_gpn_ft_resp partial_buf; struct delayed_work disc_work; @@ -1003,6 +1003,11 @@ void fc_rport_terminate_io(struct fc_rport *); *****************************/ int fc_disc_init(struct fc_lport *); +static inline struct fc_lport *fc_disc_lport(struct fc_disc *disc) +{ + return container_of(disc, struct fc_lport, disc); +} + /* * FCP LAYER *****************************/ -- cgit v1.2.3-70-g09d2