diff options
author | Kotresh HR <khiremat@redhat.com> | 2018-04-30 04:43:58 -0400 |
---|---|---|
committer | Amar Tumballi <amarts@redhat.com> | 2018-05-06 07:09:18 +0530 |
commit | 487aaafacac8af16c08eb44fe9bf178768d372fa (patch) | |
tree | 69a8ff6a8be0f40e129a71bf28ef5e4a558d5109 /xlators/features/utime/src/utime-gen-fops-h.py | |
parent | f8fe0771f0b450713595a7d298ed5a758cf2ce3e (diff) |
utime: ctime client side xlator
The client side utime xlator does two things.
1. Update unix epoch time in frame->root->ctime
2. Update the frame->root->flags based on the fop
which indicates time attributes that should be
updated for the parent/entry.
Credits: Rafi KC <rkavunga@redhat.com>
Updates: #208
Change-Id: I9cad297040c70798a0a8468a080eb4aeff73138d
Signed-off-by: Kotresh HR <khiremat@redhat.com>
Diffstat (limited to 'xlators/features/utime/src/utime-gen-fops-h.py')
-rw-r--r-- | xlators/features/utime/src/utime-gen-fops-h.py | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/xlators/features/utime/src/utime-gen-fops-h.py b/xlators/features/utime/src/utime-gen-fops-h.py new file mode 100644 index 00000000000..9f0270d5ae8 --- /dev/null +++ b/xlators/features/utime/src/utime-gen-fops-h.py @@ -0,0 +1,34 @@ +#!/usr/bin/python + +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, generate + +OP_FOP_TEMPLATE = """ +int32_t +gf_utime_@NAME@ (call_frame_t *frame, xlator_t *this, + @LONG_ARGS@); +""" + +utime_ops = ['fallocate', 'zerofill', 'opendir', 'readlink', 'mknod', 'mkdir', + 'unlink', 'rmdir', 'symlink', 'rename', 'link', 'truncate', + 'ftruncate', 'create', 'open', 'removexattr', 'fremovexattr', + 'readv', 'writev', 'setattr', 'fsetattr'] + +def gen_defaults(): + for name, value in ops.iteritems(): + if name in utime_ops: + 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] |