glusterfs
183 строки · 4.8 Кб
1#pragma fragment CBK_TEMPLATE
2int32_t @FOP_PREFIX@_@NAME@_cbk(call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret,
3int32_t op_errno, @UNWIND_PARAMS@)
4{
5STACK_UNWIND_STRICT(@NAME@, frame, op_ret, op_errno, @UNWIND_ARGS@);
6return 0;
7}
8
9#pragma fragment COMMENT
10If you are generating the leaf xlators, remove the STACK_WIND and replace the
11@ERROR_ARGS@ to @UNWIND_ARGS@ if necessary
12
13#pragma fragment FOP_TEMPLATE
14int32_t @FOP_PREFIX@_@NAME@(call_frame_t *frame, xlator_t *this, @WIND_PARAMS@)
15{
16STACK_WIND(frame, @FOP_PREFIX@_@NAME@_cbk, FIRST_CHILD(this),
17FIRST_CHILD(this)->fops->@NAME@, @WIND_ARGS@);
18return 0;
19err:
20STACK_UNWIND_STRICT(@NAME@, frame, -1, errno, @ERROR_ARGS@);
21return 0;
22}
23
24#pragma fragment FUNC_TEMPLATE
25@RET_TYPE@ @FOP_PREFIX@_@NAME@(@FUNC_PARAMS@)
26{
27return @RET_VAR@;
28}
29
30#pragma fragment CP
31/*
32* Copyright (c) @CURRENT_YEAR@ Red Hat, Inc. <http://www.redhat.com>
33* This file is part of GlusterFS.
34*
35* This file is licensed to you under your choice of the GNU Lesser
36* General Public License, version 3 or any later version (LGPLv3 or
37* later), or the GNU General Public License, version 2 (GPLv2), in all
38* cases as published by the Free Software Foundation.
39*/
40
41#pragma fragment INCLUDE_IN_SRC_FILE
42#include "@XL_NAME@.h"
43
44#pragma fragment XLATOR_METHODS
45
46static int32_t @FOP_PREFIX@_init(xlator_t *this)
47{
48return 0;
49}
50
51static void @FOP_PREFIX@_fini(xlator_t *this)
52{
53return;
54}
55
56static int32_t @FOP_PREFIX@_reconfigure(xlator_t *this, dict_t *dict)
57{
58return 0;
59}
60
61static int @FOP_PREFIX@_notify(xlator_t *this, int event, void *data, ...)
62{
63return default_notify(this, event, data);
64}
65
66static int32_t @FOP_PREFIX@_mem_acct_init(xlator_t *this)
67{
68int ret = -1;
69
70ret = xlator_mem_acct_init(this, gf_@FOP_PREFIX@_mt_end + 1);
71return ret;
72}
73
74static int32_t @FOP_PREFIX@_dump_metrics(xlator_t *this, int fd)
75{
76return 0;
77}
78
79struct volume_options @FOP_PREFIX@_options[] = {
80/*{ .key = {""},
81.type = GF_OPTION_TYPE_BOOL,
82.default_value = "",
83.op_version = {GD_OP_VERSION_},
84.flags = OPT_FLAG_SETTABLE | OPT_FLAG_DOC | OPT_FLAG_CLIENT_OPT,
85.tags = {""},
86.description = "",
87.category = GF_EXPERIMENTAL,
88},
89{ .key = {NULL} },
90*/
91};
92
93xlator_api_t xlator_api = {
94.init = @FOP_PREFIX@_init,
95.fini = @FOP_PREFIX@_fini,
96.notify = @FOP_PREFIX@_notify,
97.reconfigure = @FOP_PREFIX@_reconfigure,
98.mem_acct_init = @FOP_PREFIX@_mem_acct_init,
99.dump_metrics = @FOP_PREFIX@_dump_metrics,
100.op_version = {GD_OP_VERSION_},
101.dumpops = &@FOP_PREFIX@_dumpops,
102.fops = &@FOP_PREFIX@_fops,
103.cbks = &@FOP_PREFIX @_cbks,
104.options = @FOP_PREFIX@_options,
105.identifier = "@XL_NAME@",
106.category = GF_EXPERIMENTAL,
107};
108#pragma fragment HEADER_FMT
109#ifndef __ @HFL_NAME@_H__
110#define __ @HFL_NAME@_H__
111
112#include "@XL_NAME@-mem-types.h"
113#include "@XL_NAME@-messages.h"
114#include <glusterfs/glusterfs.h>
115#include <glusterfs/xlator.h>
116#include <glusterfs/defaults.h>
117
118#endif /* __@HFL_NAME@_H__ */
119
120#pragma fragment MEM_HEADER_FMT
121#ifndef __ @HFL_NAME@_H__
122#define __ @HFL_NAME@_H__
123
124#include <glusterfs/mem-types.h>
125
126enum gf_mdc_mem_types_ {
127gf_@FOP_PREFIX@_mt_ = gf_common_mt_end + 1,
128gf_@FOP_PREFIX@_mt_end
129};
130
131#endif /* __@HFL_NAME@_H__ */
132
133#pragma fragment MSG_HEADER_FMT
134#ifndef __@HFL_NAME@_H__
135#define __@HFL_NAME@_H__
136
137#include <glusterfs/glfs-message-id.h>
138
139/* First of all the new component needs to be declared at the end of
140* enum _msgid_comp in glusterfs/glfs-message-id.h. Then the ID used
141* needs to be referenced here to start defining messages associated
142* with this component.
143*
144* More than one component can be defined, but its messages need to
145* be defined sequentially. There can't be definitions of messages
146* from different components interleaved. */
147
148/* Example:
149*
150* GLFS_COMPONENT(COMPONENT);
151*/
152
153/* Add every new message at the end. The position of the message
154* determines its ID, so adding the message at the beginning would
155* change the IDs of all other messages. Also never remove one message
156* once it has been present in at least one release. This would cause
157* the same message id to be reused by another message.
158*
159* For new messages, use GLFS_NEW(). To deprecate a message, leave
160* it as it is, but change GLFS_NEW by GLFS_OLD. To remove a message
161* (i.e. the message cannot be used by the code), replace GLFS_OLD
162* by GLFS_GONE. */
163
164// clang-format off
165
166/* Example:
167*
168* GLFS_NEW(COMPONENT, MSGID, "Message text", 7 /* num fields */,
169* GLFS_INT(integer),
170* GLFS_UINT(number),
171* GLFS_STR(name),
172* GLFS_UUID(gfid),
173* GLFS_PTR(pointer),
174* GLFS_ERR(error),
175* GLFS_RES(result)
176* )
177*/
178
179/* Add new messages above this line. */
180
181// clang-format on
182
183#endif /* __@HFL_NAME@_H__ */
184