diff options
| author | Amar Tumballi <amarts@redhat.com> | 2019-06-20 09:17:36 +0530 | 
|---|---|---|
| committer | Xavi Hernandez <xhernandez@redhat.com> | 2019-06-20 21:00:54 +0000 | 
| commit | eae5f062ae008eb3b615170a102c715d70aa68e6 (patch) | |
| tree | 3535dc28338f9063f11b93717ae10cd84cfe9d57 | |
| parent | 2e11f61029d0b36893c4aa859f99c22b6202ad12 (diff) | |
fix template file after clang-format
clang-format gets applied for all the files ending with .c or .h
but in this case, new-xlator.c was a template file. hence
change the suffix to reflect the same, also to avoid the
auto-formatting on template file.
updates: bz#1193929
Change-Id: I1c00a28f165f34dbe00fd3b6b070d868a56f9157
Signed-off-by: Amar Tumballi <amarts@redhat.com>
| -rwxr-xr-x | extras/create_new_xlator/generate_xlator.py | 2 | ||||
| -rw-r--r-- | extras/create_new_xlator/new-xlator.c.tmpl (renamed from extras/create_new_xlator/new-xlator-tmpl.c) | 74 | 
2 files changed, 37 insertions, 39 deletions
diff --git a/extras/create_new_xlator/generate_xlator.py b/extras/create_new_xlator/generate_xlator.py index e334b0d7642..983868c04db 100755 --- a/extras/create_new_xlator/generate_xlator.py +++ b/extras/create_new_xlator/generate_xlator.py @@ -169,7 +169,7 @@ def load_fragments ():          cur_value = ""          result = {}          basepath = os.path.abspath(os.path.dirname(__file__)) -        fragpath = basepath + "/new-xlator-tmpl.c" +        fragpath = basepath + "/new-xlator.c.tmpl"          for line in open(fragpath, "r").readlines():                  m = pragma_re.search(line)                  if m: diff --git a/extras/create_new_xlator/new-xlator-tmpl.c b/extras/create_new_xlator/new-xlator.c.tmpl index 9bb9aa6e4bc..fe9735bfcf1 100644 --- a/extras/create_new_xlator/new-xlator-tmpl.c +++ b/extras/create_new_xlator/new-xlator.c.tmpl @@ -1,32 +1,30 @@  #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 @) +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 @); +    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 +    @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 @) +        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 @); +    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 @); +    STACK_UNWIND_STRICT(@NAME@, frame, -1, errno, @ERROR_ARGS@);      return 0;  }  #pragma fragment FUNC_TEMPLATE -@RET_TYPE @ @FOP_PREFIX @_ @NAME @(@FUNC_PARAMS @) +@RET_TYPE@ @FOP_PREFIX@_@NAME@(@FUNC_PARAMS@)  { -    return @RET_VAR @; +    return @RET_VAR@;  }  #pragma fragment CP @@ -45,40 +43,40 @@ err:  #pragma fragment XLATOR_METHODS -static int32_t @FOP_PREFIX @_init(xlator_t *this) +static int32_t @FOP_PREFIX@_init(xlator_t *this)  {      return 0;  } -static void @FOP_PREFIX @_fini(xlator_t *this) +static void @FOP_PREFIX@_fini(xlator_t *this)  {      return;  } -static int32_t @FOP_PREFIX @_reconfigure(xlator_t *this, dict_t *dict) +static int32_t @FOP_PREFIX@_reconfigure(xlator_t *this, dict_t *dict)  {      return 0;  } -static int @FOP_PREFIX @_notify(xlator_t *this, int event, void *data, ...) +static int @FOP_PREFIX@_notify(xlator_t *this, int event, void *data, ...)  {      return default_notify(this, event, data);  } -static int32_t @FOP_PREFIX @_mem_acct_init(xlator_t *this) +static int32_t @FOP_PREFIX@_mem_acct_init(xlator_t *this)  {      int ret = -1; -    ret = xlator_mem_acct_init(this, gf_ @FOP_PREFIX @_mt_end + 1); +    ret = xlator_mem_acct_init(this, gf_@FOP_PREFIX@_mt_end + 1);      return ret;  } -static int32_t @FOP_PREFIX @_dump_metrics(xlator_t *this, int fd) +static int32_t @FOP_PREFIX@_dump_metrics(xlator_t *this, int fd)  {      return 0;  } -struct volume_options @FOP_PREFIX @_options[] = { +struct volume_options @FOP_PREFIX@_options[] = {      /*{ .key  = {""},        .type = GF_OPTION_TYPE_BOOL,        .default_value = "", @@ -93,23 +91,23 @@ struct volume_options @FOP_PREFIX @_options[] = {  };  xlator_api_t xlator_api = { -    .init = @FOP_PREFIX @_init, -    .fini = @FOP_PREFIX @_fini, -    .notify = @FOP_PREFIX @_notify, -    .reconfigure = @FOP_PREFIX @_reconfigure, -    .mem_acct_init = @FOP_PREFIX @_mem_acct_init, -    .dump_metrics = @FOP_PREFIX @_dump_metrics, +    .init = @FOP_PREFIX@_init, +    .fini = @FOP_PREFIX@_fini, +    .notify = @FOP_PREFIX@_notify, +    .reconfigure = @FOP_PREFIX@_reconfigure, +    .mem_acct_init = @FOP_PREFIX@_mem_acct_init, +    .dump_metrics = @FOP_PREFIX@_dump_metrics,      .op_version = {GD_OP_VERSION_}, -    .dumpops = &@FOP_PREFIX @_dumpops, -    .fops = &@FOP_PREFIX @_fops, +    .dumpops = &@FOP_PREFIX@_dumpops, +    .fops = &@FOP_PREFIX@_fops,      .cbks = &@FOP_PREFIX @_cbks, -    .options = @FOP_PREFIX @_options, +    .options = @FOP_PREFIX@_options,      .identifier = "@XL_NAME@",      .category = GF_EXPERIMENTAL,  };  #pragma fragment HEADER_FMT -#ifndef __ @HFL_NAME @_H__ -#define __ @HFL_NAME @_H__ +#ifndef __ @HFL_NAME@_H__ +#define __ @HFL_NAME@_H__  #include "@XL_NAME@-mem-types.h"  #include "@XL_NAME@-messages.h" @@ -120,21 +118,21 @@ xlator_api_t xlator_api = {  #endif /* __@HFL_NAME@_H__ */  #pragma fragment MEM_HEADER_FMT -#ifndef __ @HFL_NAME @_H__ -#define __ @HFL_NAME @_H__ +#ifndef __ @HFL_NAME@_H__ +#define __ @HFL_NAME@_H__  #include <glusterfs/mem-types.h>  enum gf_mdc_mem_types_ { -    gf_ @FOP_PREFIX @_mt_ = gf_common_mt_end + 1, -    gf_ @FOP_PREFIX @_mt_end +    gf_@FOP_PREFIX@_mt_ = gf_common_mt_end + 1, +    gf_@FOP_PREFIX@_mt_end  };  #endif /* __@HFL_NAME@_H__ */  #pragma fragment MSG_HEADER_FMT -#ifndef __ @HFL_NAME @_H__ -#define __ @HFL_NAME @_H__ +#ifndef __@HFL_NAME@_H__ +#define __@HFL_NAME@_H__  #include <glusterfs/glfs-message-id.h> @@ -148,6 +146,6 @@ enum gf_mdc_mem_types_ {   * glfs-message-id.h.   */ -GLFS_MSGID(@FOP_PREFIX @, @FOP_PREFIX @_MSG_NO_MEMORY); +GLFS_MSGID(@FOP_PREFIX@, @FOP_PREFIX@_MSG_NO_MEMORY);  #endif /* __@HFL_NAME@_H__ */  | 
