Skip to content

Commit

Permalink
Merge pull request ofiwg#5543 from aingerson/shm
Browse files Browse the repository at this point in the history
prov/shm: move ep_name_list initialization/cleanup
  • Loading branch information
aingerson authored Jan 10, 2020
2 parents ecf86e7 + 2c9aeb8 commit 6aad83e
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 8 deletions.
1 change: 1 addition & 0 deletions include/ofi_shm.h
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ struct smr_attr {
size_t tx_count;
};

void smr_cleanup(void);
int smr_map_create(const struct fi_provider *prov, int peer_count,
struct smr_map **map);
int smr_map_to_region(const struct fi_provider *prov,
Expand Down
3 changes: 3 additions & 0 deletions prov/efa/src/efa_fabric.c
Original file line number Diff line number Diff line change
Expand Up @@ -884,6 +884,9 @@ static void fi_efa_fini(void)
efa_dealloc_ctx(ctx_list[i]);
efa_device_free_context_list(ctx_list);
efa_device_free();
#if HAVE_EFA_DL
smr_cleanup();
#endif
}

struct fi_provider efa_prov = {
Expand Down
9 changes: 1 addition & 8 deletions prov/shm/src/smr_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,13 +136,7 @@ static int smr_getinfo(uint32_t version, const char *node, const char *service,

static void smr_fini(void)
{
struct smr_ep_name *ep_name;
struct dlist_entry *tmp;

dlist_foreach_container_safe(&ep_name_list, struct smr_ep_name,
ep_name, entry, tmp) {
free(ep_name);
}
smr_cleanup();
}

struct fi_provider smr_prov = {
Expand All @@ -162,7 +156,6 @@ struct util_prov smr_util_prov = {

SHM_INI
{
dlist_init(&ep_name_list);

/* Signal handlers to cleanup tmpfs files on an unclean shutdown */
smr_reg_sig_hander(SIGBUS);
Expand Down
12 changes: 12 additions & 0 deletions prov/util/src/util_shm.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,18 @@

struct dlist_entry ep_name_list;

DEFINE_LIST(ep_name_list);

void smr_cleanup(void)
{
struct smr_ep_name *ep_name;
struct dlist_entry *tmp;

dlist_foreach_container_safe(&ep_name_list, struct smr_ep_name,
ep_name, entry, tmp)
free(ep_name);
}

static void smr_peer_addr_init(struct smr_addr *peer)
{
memset(peer->name, 0, NAME_MAX);
Expand Down

0 comments on commit 6aad83e

Please sign in to comment.