"Fossies" - the Fresh Open Source Software Archive

Member "glusterfs-8.2/xlators/features/cloudsync/src/cloudsync-fops-h.py" (16 Sep 2020, 786 Bytes) of package /linux/misc/glusterfs-8.2.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Python source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. For more information about "cloudsync-fops-h.py" see the Fossies "Dox" file reference documentation.

    1 #!/usr/bin/python3
    2 
    3 from __future__ import print_function
    4 import os
    5 import sys
    6 
    7 curdir = os.path.dirname(sys.argv[0])
    8 gendir = os.path.join(curdir, '../../../../libglusterfs/src')
    9 sys.path.append(gendir)
   10 from generator import ops, fop_subs, cbk_subs, generate
   11 
   12 OP_FOP_TEMPLATE = """
   13 int32_t
   14 cs_@NAME@ (call_frame_t *frame, xlator_t *this,
   15                    @LONG_ARGS@);
   16 """
   17 
   18 def gen_defaults():
   19     for name, value in ops.items():
   20         if name == 'getspec':
   21             continue
   22         print(generate(OP_FOP_TEMPLATE, name, fop_subs))
   23 
   24 
   25 for l in open(sys.argv[1], 'r').readlines():
   26     if l.find('#pragma generate') != -1:
   27         print("/* BEGIN GENERATED CODE - DO NOT MODIFY */")
   28         gen_defaults()
   29         print("/* END GENERATED CODE */")
   30     else:
   31         print(l[:-1])