From 5ba81308d58b26f8baff17b44c235d68f88d5f19 Mon Sep 17 00:00:00 2001 From: Amar Tumballi Date: Wed, 24 Apr 2019 22:29:55 +0530 Subject: libglusterfs: remove compound-fop helper functions updates: bz#1693692 Change-Id: If69702990af273be1f38855ba56b3b89fabff167 Signed-off-by: Amar Tumballi --- libglusterfs/src/Makefile.am | 6 +- libglusterfs/src/compound-fop-utils.c | 138 ------------------------ libglusterfs/src/glusterfs/compound-fop-utils.h | 36 ------- 3 files changed, 3 insertions(+), 177 deletions(-) delete mode 100644 libglusterfs/src/compound-fop-utils.c delete mode 100644 libglusterfs/src/glusterfs/compound-fop-utils.h (limited to 'libglusterfs') diff --git a/libglusterfs/src/Makefile.am b/libglusterfs/src/Makefile.am index f030a70b0f0..79ab7ee93f2 100644 --- a/libglusterfs/src/Makefile.am +++ b/libglusterfs/src/Makefile.am @@ -37,7 +37,7 @@ libglusterfs_la_SOURCES = dict.c xlator.c logging.c \ $(CONTRIBDIR)/timer-wheel/timer-wheel.c \ $(CONTRIBDIR)/timer-wheel/find_last_bit.c default-args.c locking.c \ $(CONTRIBDIR)/xxhash/xxhash.c \ - compound-fop-utils.c throttle-tbf.c monitoring.c async.c + throttle-tbf.c monitoring.c async.c nodist_libglusterfs_la_SOURCES = y.tab.c graph.lex.c defaults.c nodist_libglusterfs_la_HEADERS = y.tab.h protocol-common.h @@ -68,8 +68,8 @@ libglusterfs_la_HEADERS = glusterfs/common-utils.h glusterfs/defaults.h \ glusterfs/libglusterfs-messages.h glusterfs/lvm-defaults.h \ glusterfs/quota-common-utils.h glusterfs/rot-buffs.h \ glusterfs/compat-uuid.h glusterfs/upcall-utils.h glusterfs/throttle-tbf.h \ - glusterfs/events.h glusterfs/compound-fop-utils.h glusterfs/atomic.h \ - glusterfs/monitoring.h glusterfs/async.h + glusterfs/events.h glusterfs/atomic.h glusterfs/monitoring.h \ + glusterfs/async.h libglusterfs_ladir = $(includedir)/glusterfs diff --git a/libglusterfs/src/compound-fop-utils.c b/libglusterfs/src/compound-fop-utils.c deleted file mode 100644 index a29ff808125..00000000000 --- a/libglusterfs/src/compound-fop-utils.c +++ /dev/null @@ -1,138 +0,0 @@ -/* - Copyright (c) 2016 Red Hat, Inc. - This file is part of GlusterFS. - - 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. -*/ - -#include "glusterfs/defaults.h" -#include "glusterfs/default-args.h" -#include "glusterfs/mem-types.h" -#include "glusterfs/dict.h" - -void -compound_args_cleanup(compound_args_t *args) -{ - int i; - - if (!args) - return; - - if (args->xdata) - dict_unref(args->xdata); - - if (args->req_list) { - for (i = 0; i < args->fop_length; i++) { - args_wipe(&args->req_list[i]); - } - } - - GF_FREE(args->enum_list); - GF_FREE(args->req_list); - GF_FREE(args); -} - -void -compound_args_cbk_cleanup(compound_args_cbk_t *args_cbk) -{ - int i; - - if (!args_cbk) - return; - - if (args_cbk->xdata) - dict_unref(args_cbk->xdata); - - if (args_cbk->rsp_list) { - for (i = 0; i < args_cbk->fop_length; i++) { - args_cbk_wipe(&args_cbk->rsp_list[i]); - } - } - - GF_FREE(args_cbk->rsp_list); - GF_FREE(args_cbk->enum_list); - GF_FREE(args_cbk); -} - -compound_args_cbk_t * -compound_args_cbk_alloc(int length, dict_t *xdata) -{ - int i = 0; - compound_args_cbk_t *args_cbk = NULL; - - args_cbk = GF_CALLOC(1, sizeof(*args_cbk), gf_mt_compound_rsp_t); - if (!args_cbk) - return NULL; - - args_cbk->fop_length = length; - - args_cbk->rsp_list = GF_CALLOC(length, sizeof(*args_cbk->rsp_list), - gf_mt_default_args_cbk_t); - if (!args_cbk->rsp_list) - goto out; - - for (i = 0; i < length; i++) { - args_cbk_init(&args_cbk->rsp_list[i]); - } - - args_cbk->enum_list = GF_CALLOC(length, sizeof(*args_cbk->enum_list), - gf_common_mt_int); - if (!args_cbk->enum_list) - goto out; - - if (xdata) { - args_cbk->xdata = dict_copy_with_ref(xdata, NULL); - if (!args_cbk->xdata) - goto out; - } - - return args_cbk; -out: - compound_args_cbk_cleanup(args_cbk); - return NULL; -} - -compound_args_t * -compound_fop_alloc(int length, glusterfs_compound_fop_t fop, dict_t *xdata) -{ - compound_args_t *args = NULL; - - args = GF_CALLOC(1, sizeof(*args), gf_mt_compound_req_t); - - if (!args) - return NULL; - - /* fop_enum can be used by xlators to see which fops are - * included as part of compound fop. This will help in checking - * for compatibility or support without going through the entire - * fop list packed. - */ - args->fop_enum = fop; - args->fop_length = length; - - args->enum_list = GF_CALLOC(length, sizeof(*args->enum_list), - gf_common_mt_int); - - if (!args->enum_list) - goto out; - - args->req_list = GF_CALLOC(length, sizeof(*args->req_list), - gf_mt_default_args_t); - - if (!args->req_list) - goto out; - - if (xdata) { - args->xdata = dict_copy_with_ref(xdata, args->xdata); - if (!args->xdata) - goto out; - } - - return args; -out: - compound_args_cleanup(args); - return NULL; -} diff --git a/libglusterfs/src/glusterfs/compound-fop-utils.h b/libglusterfs/src/glusterfs/compound-fop-utils.h deleted file mode 100644 index 1226e328704..00000000000 --- a/libglusterfs/src/glusterfs/compound-fop-utils.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - Copyright (c) 2016 Red Hat, Inc. - This file is part of GlusterFS. - - 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 __COMPOUND_FOP_UTILS_H__ -#define __COMPOUND_FOP_UTILS_H__ - -#include "glusterfs/defaults.h" -#include "glusterfs/default-args.h" -#include "glusterfs/mem-types.h" -#include "glusterfs/dict.h" - -#define COMPOUND_PACK_ARGS(fop, fop_enum, args, counter, params...) \ - do { \ - args->enum_list[counter] = fop_enum; \ - args_##fop##_store(&args->req_list[counter], params); \ - } while (0) - -compound_args_t * -compound_fop_alloc(int length, glusterfs_compound_fop_t fop, dict_t *xdata); - -void -compound_args_cleanup(compound_args_t *args); - -void -compound_args_cbk_cleanup(compound_args_cbk_t *args_cbk); - -compound_args_cbk_t * -compound_args_cbk_alloc(int length, dict_t *xdata); -#endif /* __COMPOUND_FOP_UTILS_H__ */ -- cgit