From 4a86321638e6c2e9ca8e935e2e645e4113699906 Mon Sep 17 00:00:00 2001 From: Pete Wyckoff Date: Fri, 22 Feb 2008 15:05:23 -0500 Subject: [PATCH] bmi_ib: Malloc rename Avoid exporting Malloc symbol; it may clash in the global namespace. --- src/io/bmi/bmi_ib/ib.c | 26 +++++++++++++------------- src/io/bmi/bmi_ib/ib.h | 2 +- src/io/bmi/bmi_ib/mem.c | 7 ++++--- src/io/bmi/bmi_ib/openib.c | 9 +++++---- src/io/bmi/bmi_ib/util.c | 2 +- src/io/bmi/bmi_ib/vapi.c | 9 +++++---- 6 files changed, 29 insertions(+), 26 deletions(-) diff --git a/src/io/bmi/bmi_ib/ib.c b/src/io/bmi/bmi_ib/ib.c index 9261708..8528333 100644 --- a/src/io/bmi/bmi_ib/ib.c +++ b/src/io/bmi/bmi_ib/ib.c @@ -452,7 +452,7 @@ find_matching_recv(rq_state_t statemask, const ib_connection_t *c, static struct ib_work * alloc_new_recv(ib_connection_t *c, struct buf_head *bh) { - struct ib_work *rq = Malloc(sizeof(*rq)); + struct ib_work *rq = bmi_ib_malloc(sizeof(*rq)); rq->type = BMI_RECV; rq->c = c; ++rq->c->refcnt; @@ -730,7 +730,7 @@ send_cts(struct ib_work *rq) reg_recv_buflist.buf.recv = ®_recv_buflist_buf; reg_recv_buflist.len = ®_recv_buflist_len; reg_recv_buflist.tot_len = reg_recv_buflist_len; - reg_recv_buflist_buf = Malloc(reg_recv_buflist_len); + reg_recv_buflist_buf = bmi_ib_malloc(reg_recv_buflist_len); memcache_register(ib_device->memcache, ®_recv_buflist); } if (rq->buflist.tot_len > reg_recv_buflist_len) @@ -818,7 +818,7 @@ post_send(bmi_op_id_t *id, struct bmi_method_addr *remote_map, ibmap = remote_map->method_data; /* alloc and build new sendq structure */ - sq = Malloc(sizeof(*sq)); + sq = bmi_ib_malloc(sizeof(*sq)); sq->type = BMI_SEND; sq->state.send = SQ_WAITING_BUFFER; @@ -869,7 +869,7 @@ post_send(bmi_op_id_t *id, struct bmi_method_addr *remote_map, qlist_add_tail(&sq->list, &ib_device->sendq); /* generate identifier used by caller to test for message later */ - mop = Malloc(sizeof(*mop)); + mop = bmi_ib_malloc(sizeof(*mop)); id_gen_fast_register(&mop->op_id, mop); mop->addr = remote_map; /* set of function pointers, essentially */ mop->method_data = sq; @@ -995,7 +995,7 @@ post_recv(bmi_op_id_t *id, struct bmi_method_addr *remote_map, __func__, lld(tot_expected_len), lld(rq->buflist.tot_len)); /* generate identifier used by caller to test for message later */ - mop = Malloc(sizeof(*mop)); + mop = bmi_ib_malloc(sizeof(*mop)); id_gen_fast_register(&mop->op_id, mop); mop->addr = remote_map; /* set of function pointers, essentially */ mop->method_data = rq; @@ -1386,7 +1386,7 @@ BMI_ib_testunexpected(int incount __unused, int *outcount, debug(2, "%s: found waiting testunexpected", __func__); ui->error_code = 0; ui->addr = c->remote_map; /* hand back permanent method_addr */ - ui->buffer = Malloc((unsigned long) rq->actual_len); + ui->buffer = bmi_ib_malloc((unsigned long) rq->actual_len); ui->size = rq->actual_len; memcpy(ui->buffer, (msg_header_eager_t *) rq->bh->buf + 1, @@ -1575,7 +1575,7 @@ static struct bmi_method_addr *BMI_ib_method_addr_lookup(const char *id) error("%s: no ':' found", __func__); /* copy to permanent storage */ - hostname = Malloc((unsigned long) (cp - s + 1)); + hostname = bmi_ib_malloc((unsigned long) (cp - s + 1)); strncpy(hostname, s, (size_t) (cp-s)); hostname[cp-s] = '\0'; @@ -1623,19 +1623,19 @@ static ib_connection_t *ib_new_connection(int sock, const char *peername, ib_connection_t *c; int i, ret; - c = Malloc(sizeof(*c)); + c = bmi_ib_malloc(sizeof(*c)); c->peername = strdup(peername); /* fill send and recv free lists and buf heads */ - c->eager_send_buf_contig = Malloc(ib_device->eager_buf_num + c->eager_send_buf_contig = bmi_ib_malloc(ib_device->eager_buf_num * ib_device->eager_buf_size); - c->eager_recv_buf_contig = Malloc(ib_device->eager_buf_num + c->eager_recv_buf_contig = bmi_ib_malloc(ib_device->eager_buf_num * ib_device->eager_buf_size); INIT_QLIST_HEAD(&c->eager_send_buf_free); INIT_QLIST_HEAD(&c->eager_recv_buf_free); - c->eager_send_buf_head_contig = Malloc(ib_device->eager_buf_num + c->eager_send_buf_head_contig = bmi_ib_malloc(ib_device->eager_buf_num * sizeof(*c->eager_send_buf_head_contig)); - c->eager_recv_buf_head_contig = Malloc(ib_device->eager_buf_num + c->eager_recv_buf_head_contig = bmi_ib_malloc(ib_device->eager_buf_num * sizeof(*c->eager_recv_buf_head_contig)); for (i=0; ieager_buf_num; i++) { struct buf_head *ebs = &c->eager_send_buf_head_contig[i]; @@ -1982,7 +1982,7 @@ static int BMI_ib_initialize(struct bmi_method_addr *listen_addr, int method_id, bmi_ib_method_id = method_id; - ib_device = Malloc(sizeof(*ib_device)); + ib_device = bmi_ib_malloc(sizeof(*ib_device)); /* try, in order, OpenIB then VAPI; set up function pointers */ ret = 1; diff --git a/src/io/bmi/bmi_ib/ib.h b/src/io/bmi/bmi_ib/ib.h index 8bc0738..a7da524 100644 --- a/src/io/bmi/bmi_ib/ib.h +++ b/src/io/bmi/bmi_ib/ib.h @@ -398,7 +398,7 @@ void warning_errno(const char *fmt, ...) __attribute__((format(printf,1,2))); void warning_xerrno(int errnum, const char *fmt, ...) __attribute__((format(printf,2,3))); void info(const char *fmt, ...) __attribute__((format(printf,1,2))); -void *Malloc(unsigned long n) __attribute__((malloc)); +void *bmi_ib_malloc(unsigned long n) __attribute__((malloc)); void *qlist_del_head(struct qlist_head *list); void *qlist_try_del_head(struct qlist_head *list); const char *sq_state_name(sq_state_t num); diff --git a/src/io/bmi/bmi_ib/mem.c b/src/io/bmi/bmi_ib/mem.c index c860c1e..b1533fa 100644 --- a/src/io/bmi/bmi_ib/mem.c +++ b/src/io/bmi/bmi_ib/mem.c @@ -228,7 +228,8 @@ memcache_register(void *md, ib_buflist_t *buflist) int i, ret; memcache_device_t *memcache_device = md; - buflist->memcache = Malloc(buflist->num * sizeof(*buflist->memcache)); + buflist->memcache = bmi_ib_malloc(buflist->num * + sizeof(*buflist->memcache)); gen_mutex_lock(&memcache_device->mutex); for (i=0; inum; i++) { #if ENABLE_MEMCACHE @@ -256,7 +257,7 @@ memcache_register(void *md, ib_buflist_t *buflist) } buflist->memcache[i] = c; #else - memcache_entry_t cp = Malloc(sizeof(*cp)); + memcache_entry_t cp = bmi_ib_malloc(sizeof(*cp)); cp->buf = buflist->buf.recv[i]; cp->len = buflist->len[i]; cp->type = type; @@ -337,7 +338,7 @@ void *memcache_init(int (*mem_register)(memcache_entry_t *), { memcache_device_t *memcache_device; - memcache_device = Malloc(sizeof(*memcache_device)); + memcache_device = bmi_ib_malloc(sizeof(*memcache_device)); INIT_QLIST_HEAD(&memcache_device->list); gen_mutex_init(&memcache_device->mutex); INIT_QLIST_HEAD(&memcache_device->free_chunk_list); diff --git a/src/io/bmi/bmi_ib/openib.c b/src/io/bmi/bmi_ib/openib.c index e104c08..2cc2d49 100644 --- a/src/io/bmi/bmi_ib/openib.c +++ b/src/io/bmi/bmi_ib/openib.c @@ -115,7 +115,7 @@ static int openib_new_connection(ib_connection_t *c, int sock, int is_server) } ch_in, ch_out; /* build new connection/context */ - oc = Malloc(sizeof(*oc)); + oc = bmi_ib_malloc(sizeof(*oc)); c->priv = oc; /* register memory region, Recv side */ @@ -163,7 +163,8 @@ static int openib_new_connection(ib_connection_t *c, int sock, int is_server) od->sg_max_len = att.cap.max_send_sge; if (att.cap.max_recv_sge < od->sg_max_len) od->sg_max_len = att.cap.max_recv_sge; - od->sg_tmp_array = Malloc(od->sg_max_len * sizeof(*od->sg_tmp_array)); + od->sg_tmp_array = bmi_ib_malloc(od->sg_max_len * + sizeof(*od->sg_tmp_array)); } else { if (att.cap.max_send_sge < od->sg_max_len) error("%s: new conn has smaller send SG array size %d vs %d", @@ -477,7 +478,7 @@ static void openib_post_sr_rdmaw(struct ib_work *sq, msg_header_cts_t *mh_cts, reg_send_buflist.buf.recv = ®_send_buflist_buf; reg_send_buflist.len = ®_send_buflist_len; reg_send_buflist.tot_len = reg_send_buflist_len; - reg_send_buflist_buf = Malloc(reg_send_buflist_len); + reg_send_buflist_buf = bmi_ib_malloc(reg_send_buflist_len); memcache_register(ib_device->memcache, ®_send_buflist, BMI_SEND); } if (sq->buflist.tot_len > reg_send_buflist_len) @@ -877,7 +878,7 @@ int openib_ib_initialize(void) } VALGRIND_MAKE_MEM_DEFINED(ctx, sizeof(*ctx)); - od = Malloc(sizeof(*od)); + od = bmi_ib_malloc(sizeof(*od)); ib_device->priv = od; /* set the function pointers for openib */ diff --git a/src/io/bmi/bmi_ib/util.c b/src/io/bmi/bmi_ib/util.c index 8db1a7a..314ebbc 100644 --- a/src/io/bmi/bmi_ib/util.c +++ b/src/io/bmi/bmi_ib/util.c @@ -94,7 +94,7 @@ warning_xerrno(int errnum, const char *fmt, ...) } void * __attribute__((malloc)) __hidden -Malloc(unsigned long n) +bmi_ib_malloc(unsigned long n) { char *x; diff --git a/src/io/bmi/bmi_ib/vapi.c b/src/io/bmi/bmi_ib/vapi.c index 71dd9a1..a7e31f1 100644 --- a/src/io/bmi/bmi_ib/vapi.c +++ b/src/io/bmi/bmi_ib/vapi.c @@ -115,7 +115,7 @@ static int vapi_new_connection(ib_connection_t *c, int sock, int is_server) VAPI_qp_num_t qp_num; } ch_in, ch_out; - vc = Malloc(sizeof(*vc)); + vc = bmi_ib_malloc(sizeof(*vc)); c->priv = vc; /* register memory region, recv */ @@ -248,7 +248,8 @@ static void verify_prop_caps(VAPI_qp_cap_t *cap) vd->sg_max_len = cap->max_sg_size_sq; if (cap->max_sg_size_rq < vd->sg_max_len) vd->sg_max_len = cap->max_sg_size_rq; - vd->sg_tmp_array = Malloc(vd->sg_max_len * sizeof(*vd->sg_tmp_array)); + vd->sg_tmp_array = bmi_ib_malloc(vd->sg_max_len * + sizeof(*vd->sg_tmp_array)); } else { if (cap->max_sg_size_sq < vd->sg_max_len) error( @@ -487,7 +488,7 @@ static void vapi_post_sr_rdmaw(struct ib_work *sq, msg_header_cts_t *mh_cts, reg_send_buflist.buf.recv = ®_send_buflist_buf; reg_send_buflist.len = ®_send_buflist_len; reg_send_buflist.tot_len = reg_send_buflist_len; - reg_send_buflist_buf = Malloc(reg_send_buflist_len); + reg_send_buflist_buf = bmi_ib_malloc(reg_send_buflist_len); memcache_register(ib_device->memcache, ®_send_buflist); } if (sq->buflist.tot_len > reg_send_buflist_len) @@ -897,7 +898,7 @@ int vapi_ib_initialize(void) if (num_hcas > 1) warning("%s: found %d HCAs, choosing the first", __func__, num_hcas); - vd = Malloc(sizeof(*vd)); + vd = bmi_ib_malloc(sizeof(*vd)); ib_device->priv = vd; /* set the function pointers for vapi */