diff options
author | Venky Shankar <vshankar@redhat.com> | 2015-01-07 11:14:31 +0530 |
---|---|---|
committer | Vijay Bellur <vbellur@redhat.com> | 2015-03-24 07:56:32 -0700 |
commit | 84db9f8271f150fbb6024186f7f681e941731280 (patch) | |
tree | c9a3fe9dceeac5f00714362af4c7f6c706b539b2 /xlators/features | |
parent | a37f3ca2b286732fff18f0b0897d8bb1713c89b7 (diff) | |
download | glusterfs-84db9f8271f150fbb6024186f7f681e941731280.tar.gz glusterfs-84db9f8271f150fbb6024186f7f681e941731280.tar.xz glusterfs-84db9f8271f150fbb6024186f7f681e941731280.zip |
mgmt/glusterd: generate volfile for BitD
* Implement the skeleton of bit-rot xlator.
Original-Author: Raghavendra Bhat <raghavendra@redhat.com>
Signed-off-by: Venky Shankar <vshankar@redhat.com>
Signed-off-by: Gaurav Kumar Garg <ggarg@redhat.com>
Signed-off-by: Anand Nekkunti <anekkunt@redhat.com>
Change-Id: If33218bdc694f5f09cb7b8097c4fdb74d7a23b2d
BUG: 1170075
Reviewed-on: http://review.gluster.org/9710
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Tested-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'xlators/features')
-rw-r--r-- | xlators/features/bit-rot/src/Makefile.am | 17 | ||||
-rw-r--r-- | xlators/features/bit-rot/src/bit-rot-mem-types.h | 24 | ||||
-rw-r--r-- | xlators/features/bit-rot/src/bit-rot.c | 89 | ||||
-rw-r--r-- | xlators/features/bit-rot/src/bit-rot.h | 33 |
4 files changed, 163 insertions, 0 deletions
diff --git a/xlators/features/bit-rot/src/Makefile.am b/xlators/features/bit-rot/src/Makefile.am index 7581732c7d..1f59a71ebe 100644 --- a/xlators/features/bit-rot/src/Makefile.am +++ b/xlators/features/bit-rot/src/Makefile.am @@ -1 +1,18 @@ + SUBDIRS = stub + +xlator_LTLIBRARIES = bit-rot.la +xlatordir = $(libdir)/glusterfs/$(PACKAGE_VERSION)/xlator/features + +bit_rot_la_LDFLAGS = -module -avoid-version + +bit_rot_la_SOURCES = bit-rot.c +bit_rot_la_LIBADD = $(top_builddir)/libglusterfs/src/libglusterfs.la + +noinst_HEADERS = bit-rot.h bit-rot-mem-types.h + +AM_CPPFLAGS = $(GF_CPPFLAGS) -I$(top_srcdir)/libglusterfs/src + +AM_CFLAGS = -Wall $(GF_CFLAGS) + +CLEANFILES = diff --git a/xlators/features/bit-rot/src/bit-rot-mem-types.h b/xlators/features/bit-rot/src/bit-rot-mem-types.h new file mode 100644 index 0000000000..19c2aca0f8 --- /dev/null +++ b/xlators/features/bit-rot/src/bit-rot-mem-types.h @@ -0,0 +1,24 @@ +/* + Copyright (c) 2014 Red Hat, Inc. <http://www.redhat.com> + 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 _BR_MEM_TYPES_H +#define _BR_MEM_TYPES_H + +#include "mem-types.h" + +enum br_mem_types { + gf_br_mt_br_private_t = gf_common_mt_end + 1, + gf_br_mt_br_local_t, + gf_br_mt_br_inode_t, + gf_br_mt_br_fd_t, + gf_br_mt_end +}; + +#endif diff --git a/xlators/features/bit-rot/src/bit-rot.c b/xlators/features/bit-rot/src/bit-rot.c new file mode 100644 index 0000000000..0ba8b80825 --- /dev/null +++ b/xlators/features/bit-rot/src/bit-rot.c @@ -0,0 +1,89 @@ +/* + Copyright (c) 2014 Red Hat, Inc. <http://www.redhat.com> + 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 <ctype.h> +#include <sys/uio.h> + +#ifndef _CONFIG_H +#define _CONFIG_H +#include "config.h" +#endif + +#include "glusterfs.h" +#include "xlator.h" +#include "logging.h" + +#include "bit-rot.h" +#include "bit-rot-mem-types.h" + +int32_t +mem_acct_init (xlator_t *this) +{ + int32_t ret = -1; + + if (!this) + return ret; + + ret = xlator_mem_acct_init (this, gf_br_mt_end + 1); + + if (ret != 0) { + gf_log (this->name, GF_LOG_WARNING, "Memory accounting" + " init failed"); + return ret; + } + + return ret; +} + +int32_t +init (xlator_t *this) +{ + br_private_t *priv = NULL; + int32_t ret = -1; + + if (!this->children) { + gf_log (this->name, GF_LOG_ERROR, + "FATAL: no children"); + goto out; + } + + priv = GF_CALLOC (1, sizeof (*priv), gf_br_mt_br_private_t); + if (!priv) + goto out; + + this->private = priv; + + ret = 0; + +out: + gf_log (this->name, GF_LOG_DEBUG, "bit-rot xlator loaded"); + return ret; +} + +void +fini (xlator_t *this) +{ + br_private_t *priv = this->private; + + if (!priv) + return; + this->private = NULL; + GF_FREE (priv); + + return; +} + +struct xlator_fops fops; + +struct xlator_cbks cbks; + +struct volume_options options[] = { + { .key = {NULL} }, +}; diff --git a/xlators/features/bit-rot/src/bit-rot.h b/xlators/features/bit-rot/src/bit-rot.h new file mode 100644 index 0000000000..b275c0e953 --- /dev/null +++ b/xlators/features/bit-rot/src/bit-rot.h @@ -0,0 +1,33 @@ + /* + Copyright (c) 2014 Red Hat, Inc. <http://www.redhat.com> + 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 __BIT_ROT_H__ +#define __BIT_ROT_H__ + +#ifndef _CONFIG_H +#define _CONFIG_H +#include "config.h" +#endif + +#include "glusterfs.h" +#include "logging.h" +#include "dict.h" +#include "xlator.h" +#include "defaults.h" +#include "bit-rot-mem-types.h" +#include "syncop.h" + +struct br_private { + xlator_t *xl; + gf_lock_t lock; +}; + +typedef struct br_private br_private_t; + +#endif /* __BIR_ROT_H__ */ |