diff options
author | Vijay Bellur <vijay@gluster.com> | 2010-04-22 13:33:09 +0000 |
---|---|---|
committer | Anand V. Avati <avati@dev.gluster.com> | 2010-04-23 06:32:52 -0700 |
commit | 582de0677da4be19fc6f873625c58c45d069ab1c (patch) | |
tree | f10cb3e26e1f92f6ea91034e6f7bb925790dd9bc /xlators/nfs/lib | |
parent | 72baa17282f5cf749fa743fd601c7b728ece4fa2 (diff) |
Memory accounting changes
Memory accounting Changes. Thanks to Vinayak Hegde and Csaba Henk for their
contributions.
Signed-off-by: Vijay Bellur <vijay@gluster.com>
Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
BUG: 329 (Replacing memory allocation functions with mem-type functions)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=329
Diffstat (limited to 'xlators/nfs/lib')
-rw-r--r-- | xlators/nfs/lib/src/rpcsvc-auth.c | 12 | ||||
-rw-r--r-- | xlators/nfs/lib/src/rpcsvc.c | 32 | ||||
-rw-r--r-- | xlators/nfs/lib/src/xdr-nfs3.c | 18 |
3 files changed, 31 insertions, 31 deletions
diff --git a/xlators/nfs/lib/src/rpcsvc-auth.c b/xlators/nfs/lib/src/rpcsvc-auth.c index 38697965b..f61fe91d0 100644 --- a/xlators/nfs/lib/src/rpcsvc-auth.c +++ b/xlators/nfs/lib/src/rpcsvc-auth.c @@ -36,7 +36,7 @@ rpcsvc_auth_add_initer (struct list_head *list, char *idfier, if ((!list) || (!init) || (!idfier)) return -1; - new = CALLOC (1, sizeof (*new)); + new = GF_CALLOC (1, sizeof (*new), gf_common_mt_rpcsvc_auth_list); if (!new) { gf_log (GF_RPCSVC, GF_LOG_ERROR, "Memory allocation failed"); return -1; @@ -312,7 +312,7 @@ rpcsvc_auth_array (rpcsvc_t *svc, char *volname, int *autharr, int arrlen) if (count >= arrlen) break; - gen = asprintf (&srchstr, "rpc-auth.%s", auth->name); + gen = gf_asprintf (&srchstr, "rpc-auth.%s", auth->name); if (gen == -1) { count = -1; goto err; @@ -334,9 +334,9 @@ rpcsvc_auth_array (rpcsvc_t *svc, char *volname, int *autharr, int arrlen) "d to read auth val"); } - FREE (srchstr); - spec = asprintf (&srchstr, "rpc-auth.%s.%s", auth->name, - volname); + GF_FREE (srchstr); + spec = gf_asprintf (&srchstr, "rpc-auth.%s.%s", auth->name, + volname); if (spec == -1) { count = -1; goto err; @@ -360,7 +360,7 @@ rpcsvc_auth_array (rpcsvc_t *svc, char *volname, int *autharr, int arrlen) "d to read auth val"); } - FREE (srchstr); + GF_FREE (srchstr); final = rpcsvc_combine_gen_spec_volume_checks (gen, spec); if (final == RPCSVC_AUTH_ACCEPT) { autharr[count] = auth->auth->authnum; diff --git a/xlators/nfs/lib/src/rpcsvc.c b/xlators/nfs/lib/src/rpcsvc.c index 47510ad8a..bcb8af652 100644 --- a/xlators/nfs/lib/src/rpcsvc.c +++ b/xlators/nfs/lib/src/rpcsvc.c @@ -78,7 +78,7 @@ rpcsvc_stage_init (rpcsvc_t *svc) if (!svc) return NULL; - stg = CALLOC (1, sizeof(*stg)); + stg = GF_CALLOC (1, sizeof(*stg), gf_common_mt_rpcsvc_stage_t); if (!stg) return NULL; @@ -106,7 +106,7 @@ rpcsvc_stage_init (rpcsvc_t *svc) ret = 0; free_stg: if (ret == -1) { - FREE (stg); + GF_FREE (stg); stg = NULL; } @@ -135,7 +135,7 @@ rpcsvc_init (glusterfs_ctx_t *ctx, dict_t *options) if ((!ctx) || (!options)) return NULL; - svc = CALLOC (1, sizeof (*svc)); + svc = GF_CALLOC (1, sizeof (*svc), gf_common_mt_rpcsvc_t); if (!svc) return NULL; @@ -169,7 +169,7 @@ rpcsvc_init (glusterfs_ctx_t *ctx, dict_t *options) ret = 0; free_svc: if (ret == -1) { - FREE (svc); + GF_FREE (svc); svc = NULL; } @@ -248,7 +248,7 @@ rpcsvc_conn_peer_check_allow (dict_t *options, char *volname, char *clstr) * subvolumes. */ if (volname) { - ret = asprintf (&srchstr, "rpc-auth.addr.%s.allow", volname); + ret = gf_asprintf (&srchstr, "rpc-auth.addr.%s.allow", volname); if (ret == -1) { gf_log (GF_RPCSVC, GF_LOG_ERROR, "asprintf failed"); ret = RPCSVC_AUTH_DONTCARE; @@ -259,7 +259,7 @@ rpcsvc_conn_peer_check_allow (dict_t *options, char *volname, char *clstr) ret = rpcsvc_conn_peer_check_search (options, srchstr, clstr); if (volname) - FREE (srchstr); + GF_FREE (srchstr); if (ret == 0) ret = RPCSVC_AUTH_ACCEPT; @@ -280,7 +280,7 @@ rpcsvc_conn_peer_check_reject (dict_t *options, char *volname, char *clstr) return ret; if (volname) { - ret = asprintf (&srchstr, "rpc-auth.addr.%s.reject", volname); + ret = gf_asprintf (&srchstr, "rpc-auth.addr.%s.reject", volname); if (ret == -1) { gf_log (GF_RPCSVC, GF_LOG_ERROR, "asprintf failed"); ret = RPCSVC_AUTH_REJECT; @@ -291,7 +291,7 @@ rpcsvc_conn_peer_check_reject (dict_t *options, char *volname, char *clstr) ret = rpcsvc_conn_peer_check_search (options, srchstr, clstr); if (volname) - FREE (srchstr); + GF_FREE (srchstr); if (ret == 0) ret = RPCSVC_AUTH_REJECT; @@ -591,14 +591,14 @@ rpcsvc_volume_allowed (dict_t *options, char *volname) if ((!options) || (!volname)) return NULL; - ret = asprintf (&srchstr, "rpc-auth.addr.%s.allow", volname); + ret = gf_asprintf (&srchstr, "rpc-auth.addr.%s.allow", volname); if (ret == -1) { gf_log (GF_RPCSVC, GF_LOG_ERROR, "asprintf failed"); goto out; } if (!dict_get (options, srchstr)) { - FREE (srchstr); + GF_FREE (srchstr); srchstr = globalrule; ret = dict_get_str (options, srchstr, &addrstr); } else @@ -617,7 +617,7 @@ rpcsvc_conn_init (rpcsvc_t *svc, rpcsvc_program_t *prog, int sockfd) int ret = -1; unsigned int poolcount = 0; - conn = CALLOC (1, sizeof(*conn)); + conn = GF_CALLOC (1, sizeof(*conn), gf_common_mt_rpcsvc_conn_t); if (!conn) { gf_log (GF_RPCSVC, GF_LOG_ERROR, "memory allocation failed"); return NULL; @@ -659,7 +659,7 @@ free_txp: free_conn: if (ret == -1) { - FREE (conn); + GF_FREE (conn); conn = NULL; } @@ -677,7 +677,7 @@ rpcsvc_conn_destroy (rpcsvc_conn_t *conn) conn->program->conn_destroy (conn->program->private, conn); /* Need to destory record state, txlists etc. */ - FREE (conn); + GF_FREE (conn); gf_log (GF_RPCSVC, GF_LOG_DEBUG, "Connection destroyed"); } @@ -917,7 +917,7 @@ rpcsvc_conn_privport_check (rpcsvc_t *svc, char *volname, rpcsvc_conn_t *conn) } /* Disabled by default */ - ret = asprintf (&srchstr, "rpc-auth.ports.%s.insecure", volname); + ret = gf_asprintf (&srchstr, "rpc-auth.ports.%s.insecure", volname); if (ret == -1) { gf_log (GF_RPCSVC, GF_LOG_ERROR, "asprintf failed"); ret = RPCSVC_AUTH_REJECT; @@ -2632,7 +2632,7 @@ rpcsvc_program_register (rpcsvc_t *svc, rpcsvc_program_t program) if (!svc) return -1; - newprog = CALLOC (1, sizeof(*newprog)); + newprog = GF_CALLOC (1, sizeof(*newprog), gf_common_mt_rpcsvc_program_t); if (!newprog) return -1; @@ -2666,7 +2666,7 @@ free_prog: gf_log (GF_RPCSVC, GF_LOG_ERROR, "Program registration failed:" " %s, Num: %d, Ver: %d, Port: %d", newprog->progname, newprog->prognum, newprog->progver, newprog->progport); - FREE (newprog); + GF_FREE (newprog); } return ret; diff --git a/xlators/nfs/lib/src/xdr-nfs3.c b/xlators/nfs/lib/src/xdr-nfs3.c index 7d8075a56..d7984be56 100644 --- a/xlators/nfs/lib/src/xdr-nfs3.c +++ b/xlators/nfs/lib/src/xdr-nfs3.c @@ -1841,15 +1841,15 @@ xdr_free_exports_list (struct exportnode *first) while (first) { elist = first->ex_next; if (first->ex_dir) - FREE (first->ex_dir); + GF_FREE (first->ex_dir); if (first->ex_groups) { if (first->ex_groups->gr_name) - FREE (first->ex_groups->gr_name); - FREE (first->ex_groups); + GF_FREE (first->ex_groups->gr_name); + GF_FREE (first->ex_groups); } - FREE (first); + GF_FREE (first); first = elist; } @@ -1865,10 +1865,10 @@ xdr_free_mountlist (mountlist ml) return; while (ml) { - FREE (ml->ml_hostname); - FREE (ml->ml_directory); + GF_FREE (ml->ml_hostname); + GF_FREE (ml->ml_directory); next = ml->ml_next; - FREE (ml); + GF_FREE (ml); ml = next; } @@ -1885,8 +1885,8 @@ xdr_free_write3args_nocopy (write3args *wa) if (!wa) return; - FREE (wa->file.data.data_val); - FREE (wa); + GF_FREE (wa->file.data.data_val); + GF_FREE (wa); } |