@@ -1098,14 +1098,10 @@ __public int nvmf_connect_ctrl(nvme_ctrl_t c)
10981098
10991099static int nvmf_connect_disc_entry (nvme_host_t h ,
11001100 struct nvmf_disc_log_entry * e ,
1101- const char * host_traddr , const char * host_iface ,
1101+ struct nvmf_context * fctx ,
11021102 const struct nvme_fabrics_config * cfg ,
11031103 bool * discover , nvme_ctrl_t * cp )
11041104{
1105- struct nvmf_context fctx = {
1106- .host_traddr = host_traddr ,
1107- .host_iface = host_iface ,
1108- };
11091105 nvme_ctrl_t c ;
11101106 int ret ;
11111107
@@ -1115,8 +1111,8 @@ static int nvmf_connect_disc_entry(nvme_host_t h,
11151111 switch (e -> adrfam ) {
11161112 case NVMF_ADDR_FAMILY_IP4 :
11171113 case NVMF_ADDR_FAMILY_IP6 :
1118- fctx . traddr = e -> traddr ;
1119- fctx . trsvcid = e -> trsvcid ;
1114+ fctx -> traddr = e -> traddr ;
1115+ fctx -> trsvcid = e -> trsvcid ;
11201116 break ;
11211117 default :
11221118 nvme_msg (h -> ctx , LOG_ERR ,
@@ -1128,7 +1124,7 @@ static int nvmf_connect_disc_entry(nvme_host_t h,
11281124 case NVMF_TRTYPE_FC :
11291125 switch (e -> adrfam ) {
11301126 case NVMF_ADDR_FAMILY_FC :
1131- fctx . traddr = e -> traddr ;
1127+ fctx -> traddr = e -> traddr ;
11321128 break ;
11331129 default :
11341130 nvme_msg (h -> ctx , LOG_ERR ,
@@ -1138,26 +1134,26 @@ static int nvmf_connect_disc_entry(nvme_host_t h,
11381134 }
11391135 break ;
11401136 case NVMF_TRTYPE_LOOP :
1141- fctx . traddr = strlen (e -> traddr ) ? e -> traddr : NULL ;
1137+ fctx -> traddr = strlen (e -> traddr ) ? e -> traddr : NULL ;
11421138 break ;
11431139 default :
11441140 nvme_msg (h -> ctx , LOG_ERR , "skipping unsupported transport %d\n" ,
11451141 e -> trtype );
11461142 return - EINVAL ;
11471143 }
11481144
1149- fctx . transport = nvmf_trtype_str (e -> trtype );
1150- fctx . subsysnqn = e -> subnqn ;
1145+ fctx -> transport = nvmf_trtype_str (e -> trtype );
1146+ fctx -> subsysnqn = e -> subnqn ;
11511147
11521148 nvme_msg (h -> ctx , LOG_DEBUG , "lookup ctrl "
11531149 "(transport: %s, traddr: %s, trsvcid %s)\n" ,
1154- fctx . transport , fctx . traddr , fctx . trsvcid );
1150+ fctx -> transport , fctx -> traddr , fctx -> trsvcid );
11551151
1156- ret = _nvme_create_ctrl (h -> ctx , & fctx , & c );
1152+ ret = _nvme_create_ctrl (h -> ctx , fctx , & c );
11571153 if (ret ) {
11581154 nvme_msg (h -> ctx , LOG_DEBUG , "skipping discovery entry, "
11591155 "failed to allocate %s controller with traddr %s\n" ,
1160- fctx . transport , fctx . traddr );
1156+ fctx -> transport , fctx -> traddr );
11611157 return ret ;
11621158 }
11631159
@@ -1996,8 +1992,7 @@ static int _nvmf_discovery(struct nvme_global_ctx *ctx,
19961992 disconnect = false;
19971993 }
19981994
1999- err = nvmf_connect_disc_entry (h , e , nfctx .host_traddr ,
2000- nfctx .host_iface , nfctx .cfg ,
1995+ err = nvmf_connect_disc_entry (h , e , & nfctx , nfctx .cfg ,
20011996 & discover , & child );
20021997
20031998 nfctx .cfg -> keep_alive_tmo = tmo ;
@@ -2648,8 +2643,7 @@ static int nbft_discovery(struct nvme_global_ctx *ctx,
26482643 if (e -> subtype == NVME_NQN_DISC ) {
26492644 nvme_ctrl_t child ;
26502645
2651- ret = nvmf_connect_disc_entry (h , e ,
2652- nfctx .host_traddr , nfctx .host_iface ,
2646+ ret = nvmf_connect_disc_entry (h , e , & nfctx ,
26532647 defcfg , NULL , & child );
26542648 if (ret )
26552649 continue ;
0 commit comments