diff options
Diffstat (limited to 'scheduler/rr')
-rw-r--r-- | scheduler/rr/src/rr-mem-types.h | 32 | ||||
-rw-r--r-- | scheduler/rr/src/rr-options.c | 4 | ||||
-rw-r--r-- | scheduler/rr/src/rr.c | 20 |
3 files changed, 45 insertions, 11 deletions
diff --git a/scheduler/rr/src/rr-mem-types.h b/scheduler/rr/src/rr-mem-types.h new file mode 100644 index 00000000000..4b283ca841d --- /dev/null +++ b/scheduler/rr/src/rr-mem-types.h @@ -0,0 +1,32 @@ +/* + Copyright (c) 2008-2009 Gluster, Inc. <http://www.gluster.com> + This file is part of GlusterFS. + + GlusterFS is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published + by the Free Software Foundation; either version 3 of the License, + or (at your option) any later version. + + GlusterFS is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see + <http://www.gnu.org/licenses/>. +*/ + + +#ifndef __RR_MEM_TYPES_H__ +#define __RR_MEM_TYPES_H__ + +#include "mem-types.h" + +enum gf_rr_mem_types_ { + gf_rr_mt_rr_t = gf_common_mt_end + 1, + gf_rr_mt_rr_subvolume_t, + gf_rr_mt_end +}; +#endif + diff --git a/scheduler/rr/src/rr-options.c b/scheduler/rr/src/rr-options.c index b76c9fcccfc..b454ccd7c22 100644 --- a/scheduler/rr/src/rr-options.c +++ b/scheduler/rr/src/rr-options.c @@ -143,9 +143,9 @@ _rr_options_read_only_subvolumes_validate (const char *value_string, free_exit: for (i = 0; i < vcount; i++) { - free (vlist[i]); + GF_FREE (vlist[i]); } - free (vlist); + GF_FREE (vlist); return -1; } diff --git a/scheduler/rr/src/rr.c b/scheduler/rr/src/rr.c index d47f87278bc..83a0f267fd2 100644 --- a/scheduler/rr/src/rr.c +++ b/scheduler/rr/src/rr.c @@ -31,6 +31,7 @@ #include "rr-options.h" #include "rr.h" +#include "rr-mem-types.h" #define RR_MIN_FREE_DISK_NOT_REACHED 0 #define RR_MIN_FREE_DISK_REACHED 1 @@ -58,14 +59,14 @@ _cleanup_rr (rr_t *rr) { for (i = 0; i < rr->options.read_only_subvolume_count; i++) { - free (rr->options.read_only_subvolume_list[i]); + GF_FREE (rr->options.read_only_subvolume_list[i]); } - free (rr->options.read_only_subvolume_list); + GF_FREE (rr->options.read_only_subvolume_list); } - free (rr->subvolume_list); + GF_FREE (rr->subvolume_list); - free (rr); + GF_FREE (rr); return 0; } @@ -95,14 +96,14 @@ rr_init (xlator_t *this_xl) return -1; } - if ((rr = CALLOC (1, sizeof (rr_t))) == NULL) + if ((rr = GF_CALLOC (1, sizeof (rr_t), gf_rr_mt_rr_t)) == NULL) { return -1; } if (rr_options_validate (options, &rr->options) != 0) { - free (rr); + GF_FREE (rr); return -1; } @@ -147,8 +148,9 @@ rr_init (xlator_t *this_xl) return -1; } - if ((rr->subvolume_list = CALLOC (rr->subvolume_count, - sizeof (rr_subvolume_t))) == NULL) + if ((rr->subvolume_list = GF_CALLOC (rr->subvolume_count, + sizeof (rr_subvolume_t), + gf_rr_mt_rr_subvolume_t)) == NULL) { _cleanup_rr (rr); return -1; @@ -476,7 +478,7 @@ rr_notify (xlator_t *this_xl, int32_t event, void *data) if (xattr) dict_ref (xattr); - loc.path = strdup ("/"); + loc.path = gf_strdup ("/"); for (trav = this_xl->parents->xlator; trav; trav = trav->parents->xlator) { if (trav->itable) { loc.inode = trav->itable->root; |