summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCsaba Henk <csaba@gluster.com>2011-05-26 03:32:25 +0000
committerAnand Avati <avati@gluster.com>2011-05-26 08:55:13 -0700
commit3435813379c276c3c020cb4e3942554be0040ecc (patch)
tree176a4968eab461b211d31243d84f98443bc32a5f
parent6ff690a54ea7d26089be29470e499292971dd30e (diff)
libglusterfs: clean up memory types
Unify them in one header, weed out overlap. Signed-off-by: Csaba Henk <csaba@gluster.com> Signed-off-by: Anand Avati <avati@gluster.com> BUG: 2562 (invoke external commands precisely with fork + exec) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2562
-rw-r--r--libglusterfs/src/Makefile.am2
-rw-r--r--libglusterfs/src/graph-mem-types.h31
-rw-r--r--libglusterfs/src/graph-print.c3
-rw-r--r--libglusterfs/src/mem-types.h8
-rw-r--r--libglusterfs/src/trie-mem-types.h34
-rw-r--r--libglusterfs/src/trie.c11
6 files changed, 15 insertions, 74 deletions
diff --git a/libglusterfs/src/Makefile.am b/libglusterfs/src/Makefile.am
index 4c1c87360fb..cc7a8e889bd 100644
--- a/libglusterfs/src/Makefile.am
+++ b/libglusterfs/src/Makefile.am
@@ -8,7 +8,7 @@ lib_LTLIBRARIES = libglusterfs.la
libglusterfs_la_SOURCES = dict.c graph.lex.c y.tab.c xlator.c logging.c hashfn.c defaults.c common-utils.c timer.c inode.c call-stub.c compat.c fd.c compat-errno.c event.c mem-pool.c gf-dirent.c syscall.c iobuf.c globals.c statedump.c stack.c checksum.c $(CONTRIBDIR)/md5/md5.c $(CONTRIBDIR)/rbtree/rb.c rbthash.c latency.c graph.c $(CONTRIBDIR)/uuid/clear.c $(CONTRIBDIR)/uuid/copy.c $(CONTRIBDIR)/uuid/gen_uuid.c $(CONTRIBDIR)/uuid/pack.c $(CONTRIBDIR)/uuid/parse.c $(CONTRIBDIR)/uuid/unparse.c $(CONTRIBDIR)/uuid/uuid_time.c $(CONTRIBDIR)/uuid/compare.c $(CONTRIBDIR)/uuid/isnull.c $(CONTRIBDIR)/uuid/unpack.c syncop.c graph-print.c trie.c
-noinst_HEADERS = common-utils.h defaults.h dict.h glusterfs.h hashfn.h logging.h xlator.h stack.h timer.h list.h inode.h call-stub.h compat.h fd.h revision.h compat-errno.h event.h mem-pool.h byte-order.h gf-dirent.h locking.h syscall.h iobuf.h globals.h statedump.h checksum.h $(CONTRIBDIR)/md5/md5.h $(CONTRIBDIR)/rbtree/rb.h rbthash.h iatt.h latency.h mem-types.h $(CONTRIBDIR)/uuid/uuidd.h $(CONTRIBDIR)/uuid/uuid.h $(CONTRIBDIR)/uuid/uuidP.h $(CONTRIBDIR)/uuid/uuid_types.h syncop.h graph-utils.h graph-mem-types.h trie.h trie-mem-types.h
+noinst_HEADERS = common-utils.h defaults.h dict.h glusterfs.h hashfn.h logging.h xlator.h stack.h timer.h list.h inode.h call-stub.h compat.h fd.h revision.h compat-errno.h event.h mem-pool.h byte-order.h gf-dirent.h locking.h syscall.h iobuf.h globals.h statedump.h checksum.h $(CONTRIBDIR)/md5/md5.h $(CONTRIBDIR)/rbtree/rb.h rbthash.h iatt.h latency.h mem-types.h $(CONTRIBDIR)/uuid/uuidd.h $(CONTRIBDIR)/uuid/uuid.h $(CONTRIBDIR)/uuid/uuidP.h $(CONTRIBDIR)/uuid/uuid_types.h syncop.h graph-utils.h trie.h
EXTRA_DIST = graph.l graph.y $(CONTRIBDIR)/apple/daemon.c $(CONTRIBDIR)/apple/daemon.h
diff --git a/libglusterfs/src/graph-mem-types.h b/libglusterfs/src/graph-mem-types.h
deleted file mode 100644
index 86e0749cd03..00000000000
--- a/libglusterfs/src/graph-mem-types.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- Copyright (c) 2010 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 Affero 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
- Affero General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License
- along with this program. If not, see
- <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef __GRAPH_MEM_TYPES_H__
-#define __GRAPH_MEM_TYPES_H__
-
-#include "mem-types.h"
-
-#define GF_MEM_TYPE_START (gf_common_mt_end + 1)
-
-enum gf_graph_mem_types {
- gf_graph_mt_buf = GF_MEM_TYPE_START,
- gf_graph_mt_end
-};
-#endif
diff --git a/libglusterfs/src/graph-print.c b/libglusterfs/src/graph-print.c
index f9a2f6cb6f4..9eb26ef751a 100644
--- a/libglusterfs/src/graph-print.c
+++ b/libglusterfs/src/graph-print.c
@@ -26,7 +26,6 @@
#include "common-utils.h"
#include "xlator.h"
-#include "graph-mem-types.h"
#include "graph-utils.h"
@@ -180,7 +179,7 @@ glusterfs_graph_print_buf (glusterfs_graph_t *graph)
if (len == -1)
return NULL;
- buf = GF_CALLOC (1, len + 1, gf_graph_mt_buf);
+ buf = GF_CALLOC (1, len + 1, gf_common_mt_graph_buf);
if (!buf) {
return NULL;
}
diff --git a/libglusterfs/src/mem-types.h b/libglusterfs/src/mem-types.h
index 9840dac4375..9d63d28af97 100644
--- a/libglusterfs/src/mem-types.h
+++ b/libglusterfs/src/mem-types.h
@@ -98,6 +98,12 @@ enum gf_common_mem_types_ {
gf_common_mt_sge = 73,
gf_common_mt_rpcclnt_cb_program_t = 74,
gf_common_mt_libxl_marker_local = 75,
- gf_common_mt_end = 76
+ gf_common_mt_graph_buf = 76,
+ gf_common_mt_trie_trie = 77,
+ gf_common_mt_trie_data = 78,
+ gf_common_mt_trie_node = 79,
+ gf_common_mt_trie_buf = 80,
+ gf_common_mt_trie_end = 81,
+ gf_common_mt_end = 82
};
#endif
diff --git a/libglusterfs/src/trie-mem-types.h b/libglusterfs/src/trie-mem-types.h
deleted file mode 100644
index 98a1766da30..00000000000
--- a/libglusterfs/src/trie-mem-types.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- Copyright (c) 2010 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 Affero 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
- Affero General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License
- along with this program. If not, see
- <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef __TRIE_MEM_TYPES_H__
-#define __TRIE_MEM_TYPES_H__
-
-#include "mem-types.h"
-
-#define GF_MEM_TYPE_START (gf_common_mt_end + 1)
-
-enum gf_trie_mem_types_ {
- gf_trie_mt_trie = GF_MEM_TYPE_START,
- gf_trie_mt_data,
- gf_trie_mt_node,
- gf_trie_mt_buf,
- gf_trie_mt_end,
-};
-#endif
diff --git a/libglusterfs/src/trie.c b/libglusterfs/src/trie.c
index 2501e71a540..758e068c324 100644
--- a/libglusterfs/src/trie.c
+++ b/libglusterfs/src/trie.c
@@ -23,7 +23,6 @@
#include <ctype.h>
#include "common-utils.h"
-#include "trie-mem-types.h"
#include "trie.h"
#define DISTANCE_EDIT 1
@@ -53,7 +52,7 @@ trie_new ()
{
trie_t *trie = NULL;
- trie = GF_CALLOC (1, sizeof (*trie), gf_trie_mt_trie);
+ trie = GF_CALLOC (1, sizeof (*trie), gf_common_mt_trie_trie);
if (!trie)
return NULL;
@@ -70,7 +69,8 @@ trie_subnode (trienode_t *node, int id)
subnode = node->subnodes[id];
if (!subnode) {
- subnode = GF_CALLOC (1, sizeof (*subnode), gf_trie_mt_node);
+ subnode = GF_CALLOC (1, sizeof (*subnode),
+ gf_common_mt_trie_node);
if (!subnode)
return NULL;
@@ -202,7 +202,7 @@ trienode_get_word (trienode_t *node, char **bufp)
{
char *buf = NULL;
- buf = GF_CALLOC (1, node->depth + 1, gf_trie_mt_buf);
+ buf = GF_CALLOC (1, node->depth + 1, gf_common_mt_trie_buf);
if (!buf)
return -1;
*bufp = buf;
@@ -226,7 +226,8 @@ calc_dist (trienode_t *node, void *data)
word = data;
- node->data = GF_CALLOC (node->trie->len, sizeof (int), gf_trie_mt_data);
+ node->data = GF_CALLOC (node->trie->len, sizeof (int),
+ gf_common_mt_trie_data);
if (!node->data)
return -1;
row = node->data;