summaryrefslogtreecommitdiffstats
path: root/extras/create_new_xlator/new-xlator-tmpl.c
diff options
context:
space:
mode:
authorPoornima G <pgurusid@redhat.com>2015-12-15 00:19:41 -0500
committerJeff Darcy <jdarcy@redhat.com>2016-03-22 11:51:07 -0700
commit056bce103c31be8416bd3ede93c7258c5b3f8554 (patch)
tree419d25f903163237abad2b2e4e9041bec556a6ad /extras/create_new_xlator/new-xlator-tmpl.c
parent2eb8758bbc88b182bf0e33506b8352cd82c7ec2e (diff)
extras: Ease creation of new xlators
Add a python generator that creates a template for new xlator. Co-Authored by Jeff Darcy. Change-Id: I10820c0483794dcd450656684cf954f7b8f159e0 Signed-off-by: Poornima G <pgurusid@redhat.com> Reviewed-on: http://review.gluster.org/13061 Smoke: Gluster Build System <jenkins@build.gluster.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
Diffstat (limited to 'extras/create_new_xlator/new-xlator-tmpl.c')
-rw-r--r--extras/create_new_xlator/new-xlator-tmpl.c89
1 files changed, 89 insertions, 0 deletions
diff --git a/extras/create_new_xlator/new-xlator-tmpl.c b/extras/create_new_xlator/new-xlator-tmpl.c
new file mode 100644
index 00000000000..ac08f3732a7
--- /dev/null
+++ b/extras/create_new_xlator/new-xlator-tmpl.c
@@ -0,0 +1,89 @@
+#pragma fragment CBK_TEMPLATE
+int32_t
+@FOP_PREFIX@_@NAME@_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
+ int32_t op_ret, int32_t op_errno, @UNWIND_PARAMS@)
+{
+ STACK_UNWIND_STRICT (@NAME@, frame, op_ret, op_errno,
+ @UNWIND_ARGS@);
+ return 0;
+}
+
+#pragma fragment COMMENT
+If you are generating the leaf xlators, remove the STACK_WIND
+and replace the @ERROR_ARGS@ to @UNWIND_ARGS@ if necessary
+
+#pragma fragment FOP_TEMPLATE
+int32_t
+@FOP_PREFIX@_@NAME@ (call_frame_t *frame, xlator_t *this,
+ @WIND_PARAMS@)
+{
+ STACK_WIND (frame, @FOP_PREFIX@_@NAME@_cbk,
+ FIRST_CHILD(this), FIRST_CHILD(this)->fops->@NAME@,
+ @WIND_ARGS@);
+ return 0;
+err:
+ STACK_UNWIND_STRICT (@NAME@, frame, -1, errno,
+ @ERROR_ARGS@);
+ return 0;
+}
+
+#pragma fragment FUNC_TEMPLATE
+@RET_TYPE@
+@FOP_PREFIX@_@NAME@ (@FUNC_PARAMS@)
+{
+ return @RET_VAR@;
+}
+
+#pragma fragment CP
+/*
+ * Copyright (c) @CURRENT_YEAR@ 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.
+ */
+
+#pragma fragment INCLUDE_IN_SRC_FILE
+#include "@XL_NAME@.h"
+
+#pragma fragment INCLUDE_IN_HEADER_FILE
+#include "@XL_NAME@-mem-types.h"
+#include "@XL_NAME@-messages.h"
+#include "glusterfs.h"
+#include "xlator.h"
+#include "defaults.h"
+
+#pragma fragment XLATOR_METHODS
+int32_t
+init (xlator_t *this)
+{
+ return 0;
+}
+
+void
+fini (xlator_t *this)
+{
+ return;
+}
+
+int32_t
+reconfigure (xlator_t *this, dict_t *dict)
+{
+ return 0;
+}
+
+int
+notify (xlator_t *this, int event, void *data, ...)
+{
+ return default_notify (this, event, data);
+}
+
+#pragma fragment HEADER_FMT
+#ifndef __@HFL_NAME@_H__
+#define __@HFL_NAME@_H__
+
+@INCLUDE_SECT@
+
+#endif /* __@HFL_NAME@_H__ */