diff options
Diffstat (limited to 'xlators/meta/src/tree.c')
| -rw-r--r-- | xlators/meta/src/tree.c | 43 |
1 files changed, 18 insertions, 25 deletions
diff --git a/xlators/meta/src/tree.c b/xlators/meta/src/tree.c index a5ba08a3f..dacbd665a 100644 --- a/xlators/meta/src/tree.c +++ b/xlators/meta/src/tree.c @@ -1,22 +1,12 @@ /* - Copyright (c) 2006-2009 Gluster, Inc. <http://www.gluster.com> + Copyright (c) 2006-2012 Red Hat, Inc. <http://www.redhat.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/>. + This file is licensed to you under your choice of the GNU Lesser + General Public License, version 3 or any later version (LGPLv3 or + later), or the GNU General Public License, version 2 (GPLv2), in all + cases as published by the Free Software Foundation. */ - #ifndef _CONFIG_H #define _CONFIG_H #include "config.h" @@ -31,6 +21,7 @@ #include "xlator.h" #include "meta.h" +#include "meta-mem-types.h" static int is_meta_path (const char *path) @@ -46,7 +37,7 @@ struct stat * new_stbuf (void) { static int next_inode = 0; - struct stat *stbuf = CALLOC (1, sizeof (struct stat)); + struct stat *stbuf = GF_CALLOC (1, sizeof (struct stat), gf_meta_mt_stat); ERR_ABORT (stbuf); @@ -99,7 +90,7 @@ meta_dirent_t * lookup_meta_entry (meta_dirent_t *root, const char *path, char **remain) { - char *_path = strdup (path); + char *_path = gf_strdup (path); if (!is_meta_path (path)) return NULL; @@ -119,10 +110,10 @@ lookup_meta_entry (meta_dirent_t *root, const char *path, while (piece) { char *tmp = *remain; if (*remain) - asprintf (remain, "/%s/%s", *remain, piece); + gf_asprintf (remain, "/%s/%s", *remain, piece); else - asprintf (remain, "/%s", piece); - if (tmp) free (tmp); + gf_asprintf (remain, "/%s", piece); + GF_FREE (tmp); piece = strtok (NULL, "/"); } } @@ -132,7 +123,7 @@ lookup_meta_entry (meta_dirent_t *root, const char *path, trav = ntrav; } - free (_path); + GF_FREE (_path); return trav; } @@ -148,9 +139,10 @@ insert_meta_entry (meta_dirent_t *root, const char *path, if (!dir) return NULL; - meta_dirent_t *new = CALLOC (1, sizeof (meta_dirent_t)); + meta_dirent_t *new = GF_CALLOC (1, sizeof (meta_dirent_t), + gf_meta_mt_meta_dirent_t); ERR_ABORT (new); - new->name = strdup (slashpos+1); + new->name = gf_strdup (slashpos+1); new->type = type; new->parent = parent; new->next = parent->children; @@ -167,9 +159,10 @@ insert_meta_entry (meta_dirent_t *root, const char *path, int main (void) { - meta_dirent_t *root = CALLOC (1, sizeof (meta_dirent_t)); + meta_dirent_t *root = GF_CALLOC (1, sizeof (meta_dirent_t), + gf_meta_mt_meta_dirent_t); ERR_ABORT (root); - root->name = strdup (".meta"); + root->name = gf_strdup (".meta"); insert_meta_entry (root, "/.meta/version", S_IFREG, NULL, NULL); return 0; |
