summaryrefslogtreecommitdiffstats
path: root/xlators/features/cloudsync/src/cloudsync-fops-h.py
blob: faa2de651a731c997df3400a9a7df8c7635e1576 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/python3

from __future__ import print_function
import os
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

OP_FOP_TEMPLATE = """
int32_t
cs_@NAME@ (call_frame_t *frame, xlator_t *this,
                   @LONG_ARGS@);
"""

def gen_defaults():
    for name, value in ops.items():
        if name == 'getspec':
            continue
        print(generate(OP_FOP_TEMPLATE, name, fop_subs))


for l in open(sys.argv[1], 'r').readlines():
    if l.find('#pragma generate') != -1:
        print("/* BEGIN GENERATED CODE - DO NOT MODIFY */")
        gen_defaults()
        print("/* END GENERATED CODE */")
    else:
        print(l[:-1])