summaryrefslogtreecommitdiffstats
path: root/xlators/experimental/fdl/src/gen_dumper.py
diff options
context:
space:
mode:
authorKaleb S. KEITHLEY <kkeithle@redhat.com>2017-01-20 11:11:46 -0500
committerShyamsundarR <srangana@redhat.com>2017-11-06 09:57:36 -0500
commit6662516d8d8cc935378a734c5c790a23bcc00ab0 (patch)
tree1d0f488d0f6a76262473e8e18408a8076e12f8f4 /xlators/experimental/fdl/src/gen_dumper.py
parentaa2c149e0555a8e3d194a5328f66623477e337b9 (diff)
core: remove experimental xlators and associated tests
experimental xlators removed from 3.13 > Cherry picked from 4231c40973c60999f5ef759db450d25e129ef6ba: > Reviewed-on: https://review.gluster.org/17953 > Reviewed-by: jiffin tony Thottan <jthottan@redhat.com> Signed-off-by: ShyamsundarR <srangana@redhat.com> Change-Id: I34419ce22ca09b7626b8f9382c377a614fd9fed8 BUG: 1510022
Diffstat (limited to 'xlators/experimental/fdl/src/gen_dumper.py')
-rwxr-xr-xxlators/experimental/fdl/src/gen_dumper.py116
1 files changed, 0 insertions, 116 deletions
diff --git a/xlators/experimental/fdl/src/gen_dumper.py b/xlators/experimental/fdl/src/gen_dumper.py
deleted file mode 100755
index 42db55d2cb3..00000000000
--- a/xlators/experimental/fdl/src/gen_dumper.py
+++ /dev/null
@@ -1,116 +0,0 @@
-#!/usr/bin/python
-
-import os
-import re
-import sys
-
-curdir = os.path.dirname (sys.argv[0])
-gendir = os.path.join (curdir, '../../../../libglusterfs/src')
-sys.path.append (gendir)
-from generator import ops, fop_subs, cbk_subs, generate
-
-# See the big header comment at the start of gen_fdl.py to see how the stages
-# fit together. The big difference here is that *all* of the C code is in the
-# template file as labelled fragments, instead of as Python strings. That
-# makes it much easier to edit in one place, with proper syntax highlighting
-# and indentation.
-#
-# Stage 1 uses type-specific fragments to generate FUNCTION_BODY, instead of
-# LEN_*_TEMPLATE and SERLZ_*_TEMPLATE to generate LEN_CODE and SER_CODE.
-#
-# Stage 2 uses the FOP and CASE fragments instead of RECON_TEMPLATE and
-# FOP_TEMPLATE. The expanded FOP code (including FUNCTION_BODY substitution
-# in the middle of each function) is emitted immediately; the expanded CASE
-# code is saved for the next stage.
-#
-# Stage 3 uses the PROLOG and EPILOG fragments, with the expanded CASE code
-# in the middle of EPILOG, to generate the whole output file.
-#
-# Another way of looking at it is to consider how the fragments appear in
-# the final output:
-#
-# PROLOG
-# FOP (expanded for CREATE)
-# FOP before FUNCTION_BODY
-# LOC, INTEGER, GFID, etc. (one per arg, by type)
-# FOP after FUNCTION_BODY
-# FOP (expanded for WRITEV)
-# FOP before FUNCTION_BODY
-# GFID, VECTOR, etc. (on per arg, by type)
-# FOP after FUNCTION_BODY
-# (more FOPs)
-# EPILOG
-# EPILOG before CASE
-# CASE statements (one per fop)
-# EPILOG after CASE
-
-typemap = {
- 'dict_t *': ( "DICT", ""),
- 'fd_t *': ( "GFID", ""),
- 'dev_t': ( "DOUBLE", "%ld (0x%lx)"),
- 'gf_xattrop_flags_t': ( "INTEGER", "%d (0x%x)"),
- 'int32_t': ( "INTEGER", "%d (0x%x)"),
- 'mode_t': ( "INTEGER", "%d (0x%x)"),
- 'off_t': ( "DOUBLE", "%ld (0x%lx)"),
- 'size_t': ( "DOUBLE", "%ld (0x%lx)"),
- 'uint32_t': ( "INTEGER", "%d (0x%x)"),
- 'loc_t *': ( "LOC", ""),
- 'const char *': ( "STRING", ""),
- 'struct iovec *': ( "VECTOR", ""),
- 'struct iatt *': ( "IATT", ""),
-}
-
-def get_special_subs (args):
- code = ""
- for arg in args:
- if (arg[0] != 'fop-arg') or (len(arg) < 4):
- continue
- recon_type, recon_fmt = typemap[arg[2]]
- code += fragments[recon_type].replace("@ARGNAME@",arg[3]) \
- .replace("@FORMAT@",recon_fmt)
- return code
-
-def gen_functions ():
- code = ""
- for name, value in ops.iteritems():
- if "journal" not in [ x[0] for x in value ]:
- continue
- fop_subs[name]["@FUNCTION_BODY@"] = get_special_subs(value)
- # Print the FOP fragment with @FUNCTION_BODY@ in the middle.
- code += generate(fragments["FOP"],name,fop_subs)
- return code
-
-def gen_cases ():
- code = ""
- for name, value in ops.iteritems():
- if "journal" not in [ x[0] for x in value ]:
- continue
- # Add the CASE fragment for this fop.
- code += generate(fragments["CASE"],name,fop_subs)
- return code
-
-def load_fragments (path="recon-tmpl.c"):
- pragma_re = re.compile('pragma fragment (.*)')
- cur_symbol = None
- cur_value = ""
- result = {}
- for line in open(path,"r").readlines():
- m = pragma_re.search(line)
- if m:
- if cur_symbol:
- result[cur_symbol] = cur_value
- cur_symbol = m.group(1)
- cur_value = ""
- else:
- cur_value += line
- if cur_symbol:
- result[cur_symbol] = cur_value
- return result
-
-if __name__ == "__main__":
- fragments = load_fragments(sys.argv[1])
- print "/* BEGIN GENERATED CODE - DO NOT MODIFY */"
- print fragments["PROLOG"]
- print gen_functions()
- print fragments["EPILOG"].replace("@SWITCH_BODY@",gen_cases())
- print "/* END GENERATED CODE */"