@@ -921,11 +921,6 @@ char *nvme_ctrl_get_src_addr(nvme_ctrl_t c, char *src_addr, size_t src_addr_len)
921921 return src_addr ;
922922}
923923
924- const char * nvme_ctrl_get_phy_slot (nvme_ctrl_t c )
925- {
926- return c -> phy_slot ? c -> phy_slot : "" ;
927- }
928-
929924const char * nvme_ctrl_get_state (nvme_ctrl_t c )
930925{
931926 char * state = c -> state ;
@@ -1603,8 +1598,7 @@ static int nvme_ctrl_lookup_subsystem_name(struct nvme_global_ctx *ctx,
16031598}
16041599
16051600static int nvme_ctrl_lookup_phy_slot (struct nvme_global_ctx * ctx ,
1606- const char * address ,
1607- char * * slotp )
1601+ nvme_ctrl_t c )
16081602{
16091603 const char * slots_sysfs_dir = nvme_slots_sysfs_dir ();
16101604 _cleanup_free_ char * target_addr = NULL ;
@@ -1613,7 +1607,7 @@ static int nvme_ctrl_lookup_phy_slot(struct nvme_global_ctx *ctx,
16131607 char * slot ;
16141608 int ret ;
16151609
1616- if (!address )
1610+ if (!c -> address )
16171611 return - EINVAL ;
16181612
16191613 slots_dir = opendir (slots_sysfs_dir );
@@ -1623,7 +1617,7 @@ static int nvme_ctrl_lookup_phy_slot(struct nvme_global_ctx *ctx,
16231617 return - errno ;
16241618 }
16251619
1626- target_addr = strndup (address , 10 );
1620+ target_addr = strndup (c -> address , 10 );
16271621 while ((entry = readdir (slots_dir ))) {
16281622 if (entry -> d_type == DT_DIR &&
16291623 strncmp (entry -> d_name , "." , 1 ) != 0 &&
@@ -1647,7 +1641,7 @@ static int nvme_ctrl_lookup_phy_slot(struct nvme_global_ctx *ctx,
16471641 if (!slot )
16481642 return - ENOMEM ;
16491643
1650- * slotp = slot ;
1644+ c -> phy_slot = slot ;
16511645 return 0 ;
16521646 }
16531647 }
@@ -1760,7 +1754,7 @@ static int nvme_reconfigure_ctrl(struct nvme_global_ctx *ctx, nvme_ctrl_t c, con
17601754 c -> cntrltype = nvme_get_ctrl_attr (c , "cntrltype" );
17611755 c -> cntlid = nvme_get_ctrl_attr (c , "cntlid" );
17621756 c -> dctype = nvme_get_ctrl_attr (c , "dctype" );
1763- nvme_ctrl_lookup_phy_slot (ctx , c -> address , & c -> phy_slot );
1757+ nvme_ctrl_lookup_phy_slot (ctx , c );
17641758 nvme_read_sysfs_dhchap (ctx , c );
17651759 nvme_read_sysfs_tls (ctx , c );
17661760
0 commit comments