diff options
Diffstat (limited to 'libglusterfs/src/generator.py')
-rwxr-xr-x | libglusterfs/src/generator.py | 209 |
1 files changed, 104 insertions, 105 deletions
diff --git a/libglusterfs/src/generator.py b/libglusterfs/src/generator.py index 3b7df986f1f..64db4e8c479 100755 --- a/libglusterfs/src/generator.py +++ b/libglusterfs/src/generator.py @@ -543,170 +543,170 @@ ops['getspec'] = ( ) ops['lease'] = ( - ('fop-arg', 'loc', 'loc_t *'), - ('fop-arg', 'lease', 'struct gf_lease *'), - ('fop-arg', 'xdata', 'dict_t *'), - ('cbk-arg', 'lease', 'struct gf_lease *'), - ('cbk-arg', 'xdata', 'dict_t *'), + ('fop-arg', 'loc', 'loc_t *'), + ('fop-arg', 'lease', 'struct gf_lease *'), + ('fop-arg', 'xdata', 'dict_t *'), + ('cbk-arg', 'lease', 'struct gf_lease *'), + ('cbk-arg', 'xdata', 'dict_t *'), ) ops['getactivelk'] = ( - ('fop-arg', 'loc', 'loc_t *'), - ('fop-arg', 'xdata', 'dict_t *'), - ('cbk-arg', 'locklist', 'lock_migration_info_t *'), - ('cbk-arg', 'xdata', 'dict_t *'), + ('fop-arg', 'loc', 'loc_t *'), + ('fop-arg', 'xdata', 'dict_t *'), + ('cbk-arg', 'locklist', 'lock_migration_info_t *'), + ('cbk-arg', 'xdata', 'dict_t *'), ) ops['setactivelk'] = ( - ('fop-arg', 'loc', 'loc_t *'), - ('fop-arg', 'locklist', 'lock_migration_info_t *'), - ('fop-arg', 'xdata', 'dict_t *'), - ('cbk-arg', 'xdata', 'dict_t *'), + ('fop-arg', 'loc', 'loc_t *'), + ('fop-arg', 'locklist', 'lock_migration_info_t *'), + ('fop-arg', 'xdata', 'dict_t *'), + ('cbk-arg', 'xdata', 'dict_t *'), ) ops['put'] = ( - ('fop-arg', 'loc', 'loc_t *', 'loc'), - ('fop-arg', 'mode', 'mode_t', 'mode'), - ('fop-arg', 'umask', 'mode_t', 'umask'), - ('fop-arg', 'flags', 'uint32_t', 'flags'), - ('fop-arg', 'vector', 'struct iovec *', 'vector'), - ('fop-arg', 'count', 'int32_t'), - ('fop-arg', 'off', 'off_t', 'offset'), - ('fop-arg', 'iobref', 'struct iobref *'), - ('fop-arg', 'dict', 'dict_t *', 'xattr'), - ('fop-arg', 'xdata', 'dict_t *', 'xdata'), - ('cbk-arg', 'inode', 'inode_t *'), - ('cbk-arg', 'buf', 'struct iatt *'), - ('cbk-arg', 'preparent', 'struct iatt *'), - ('cbk-arg', 'postparent', 'struct iatt *'), - ('cbk-arg', 'xdata', 'dict_t *'), + ('fop-arg', 'loc', 'loc_t *', 'loc'), + ('fop-arg', 'mode', 'mode_t', 'mode'), + ('fop-arg', 'umask', 'mode_t', 'umask'), + ('fop-arg', 'flags', 'uint32_t', 'flags'), + ('fop-arg', 'vector', 'struct iovec *', 'vector'), + ('fop-arg', 'count', 'int32_t'), + ('fop-arg', 'off', 'off_t', 'offset'), + ('fop-arg', 'iobref', 'struct iobref *'), + ('fop-arg', 'dict', 'dict_t *', 'xattr'), + ('fop-arg', 'xdata', 'dict_t *', 'xdata'), + ('cbk-arg', 'inode', 'inode_t *'), + ('cbk-arg', 'buf', 'struct iatt *'), + ('cbk-arg', 'preparent', 'struct iatt *'), + ('cbk-arg', 'postparent', 'struct iatt *'), + ('cbk-arg', 'xdata', 'dict_t *'), ) ops['icreate'] = ( - ('fop-arg', 'loc', 'loc_t *'), - ('fop-arg', 'mode', 'mode_t'), - ('fop-arg', 'xdata', 'dict_t *'), - ('cbk-arg', 'inode', 'inode_t *'), - ('cbk-arg', 'buf', 'struct iatt *'), - ('cbk-arg', 'xdata', 'dict_t *'), + ('fop-arg', 'loc', 'loc_t *'), + ('fop-arg', 'mode', 'mode_t'), + ('fop-arg', 'xdata', 'dict_t *'), + ('cbk-arg', 'inode', 'inode_t *'), + ('cbk-arg', 'buf', 'struct iatt *'), + ('cbk-arg', 'xdata', 'dict_t *'), ) ops['namelink'] = ( - ('fop-arg', 'loc', 'loc_t *'), - ('fop-arg', 'xdata', 'dict_t *'), - ('cbk-arg', 'prebuf', 'struct iatt *'), - ('cbk-arg', 'postbuf', 'struct iatt *'), - ('cbk-arg', 'xdata', 'dict_t *'), + ('fop-arg', 'loc', 'loc_t *'), + ('fop-arg', 'xdata', 'dict_t *'), + ('cbk-arg', 'prebuf', 'struct iatt *'), + ('cbk-arg', 'postbuf', 'struct iatt *'), + ('cbk-arg', 'xdata', 'dict_t *'), ) ##################################################################### xlator_cbks['forget'] = ( - ('fn-arg', 'this', 'xlator_t *'), - ('fn-arg', 'inode', 'inode_t *'), + ('fn-arg', 'this', 'xlator_t *'), + ('fn-arg', 'inode', 'inode_t *'), ('ret-val', 'int32_t', '0'), ) xlator_cbks['release'] = ( - ('fn-arg', 'this', 'xlator_t *'), - ('fn-arg', 'fd', 'fd_t *'), - ('ret-val', 'int32_t', '0'), + ('fn-arg', 'this', 'xlator_t *'), + ('fn-arg', 'fd', 'fd_t *'), + ('ret-val', 'int32_t', '0'), ) xlator_cbks['releasedir'] = ( - ('fn-arg', 'this', 'xlator_t *'), - ('fn-arg', 'fd', 'fd_t *'), - ('ret-val', 'int32_t', '0'), + ('fn-arg', 'this', 'xlator_t *'), + ('fn-arg', 'fd', 'fd_t *'), + ('ret-val', 'int32_t', '0'), ) xlator_cbks['invalidate'] = ( - ('fn-arg', 'this', 'xlator_t *'), - ('fn-arg', 'inode', 'inode_t *'), - ('ret-val', 'int32_t', '0'), + ('fn-arg', 'this', 'xlator_t *'), + ('fn-arg', 'inode', 'inode_t *'), + ('ret-val', 'int32_t', '0'), ) xlator_cbks['client_destroy'] = ( - ('fn-arg', 'this', 'xlator_t *'), - ('fn-arg', 'client', 'client_t *'), - ('ret-val', 'int32_t', '0'), + ('fn-arg', 'this', 'xlator_t *'), + ('fn-arg', 'client', 'client_t *'), + ('ret-val', 'int32_t', '0'), ) xlator_cbks['client_disconnect'] = ( - ('fn-arg', 'this', 'xlator_t *'), - ('fn-arg', 'client', 'client_t *'), - ('ret-val', 'int32_t', '0'), + ('fn-arg', 'this', 'xlator_t *'), + ('fn-arg', 'client', 'client_t *'), + ('ret-val', 'int32_t', '0'), ) xlator_cbks['ictxmerge'] = ( - ('fn-arg', 'this', 'xlator_t *'), - ('fn-arg', 'fd', 'fd_t *'), - ('fn-arg', 'inode', 'inode_t *'), - ('fn-arg', 'linked_inode', 'inode_t *'), - ('ret-val', 'void', ''), + ('fn-arg', 'this', 'xlator_t *'), + ('fn-arg', 'fd', 'fd_t *'), + ('fn-arg', 'inode', 'inode_t *'), + ('fn-arg', 'linked_inode', 'inode_t *'), + ('ret-val', 'void', ''), ) ##################################################################### xlator_dumpops['priv'] = ( - ('fn-arg', 'this', 'xlator_t *'), - ('ret-val', 'int32_t', '0'), + ('fn-arg', 'this', 'xlator_t *'), + ('ret-val', 'int32_t', '0'), ) xlator_dumpops['inode'] = ( - ('fn-arg', 'this', 'xlator_t *'), - ('ret-val', 'int32_t', '0'), + ('fn-arg', 'this', 'xlator_t *'), + ('ret-val', 'int32_t', '0'), ) xlator_dumpops['fd'] = ( - ('fn-arg', 'this', 'xlator_t *'), - ('ret-val', 'int32_t', '0'), + ('fn-arg', 'this', 'xlator_t *'), + ('ret-val', 'int32_t', '0'), ) xlator_dumpops['inodectx'] = ( - ('fn-arg', 'this', 'xlator_t *'), - ('fn-arg', 'ino', 'inode_t *'), - ('ret-val', 'int32_t', '0'), + ('fn-arg', 'this', 'xlator_t *'), + ('fn-arg', 'ino', 'inode_t *'), + ('ret-val', 'int32_t', '0'), ) xlator_dumpops['fdctx'] = ( - ('fn-arg', 'this', 'xlator_t *'), - ('fn-arg', 'fd', 'fd_t *'), - ('ret-val', 'int32_t', '0'), + ('fn-arg', 'this', 'xlator_t *'), + ('fn-arg', 'fd', 'fd_t *'), + ('ret-val', 'int32_t', '0'), ) xlator_dumpops['priv_to_dict'] = ( - ('fn-arg', 'this', 'xlator_t *'), - ('fn-arg', 'dict', 'dict_t *'), - ('ret-val', 'int32_t', '0'), + ('fn-arg', 'this', 'xlator_t *'), + ('fn-arg', 'dict', 'dict_t *'), + ('ret-val', 'int32_t', '0'), ) xlator_dumpops['inode_to_dict'] = ( - ('fn-arg', 'this', 'xlator_t *'), - ('fn-arg', 'dict', 'dict_t *'), - ('ret-val', 'int32_t', '0'), + ('fn-arg', 'this', 'xlator_t *'), + ('fn-arg', 'dict', 'dict_t *'), + ('ret-val', 'int32_t', '0'), ) xlator_dumpops['fd_to_dict'] = ( - ('fn-arg', 'this', 'xlator_t *'), - ('fn-arg', 'dict', 'dict_t *'), - ('ret-val', 'int32_t', '0'), + ('fn-arg', 'this', 'xlator_t *'), + ('fn-arg', 'dict', 'dict_t *'), + ('ret-val', 'int32_t', '0'), ) xlator_dumpops['inodectx_to_dict'] = ( - ('fn-arg', 'this', 'xlator_t *'), - ('fn-arg', 'ino', 'inode_t *'), - ('fn-arg', 'dict', 'dict_t *'), - ('ret-val', 'int32_t', '0'), + ('fn-arg', 'this', 'xlator_t *'), + ('fn-arg', 'ino', 'inode_t *'), + ('fn-arg', 'dict', 'dict_t *'), + ('ret-val', 'int32_t', '0'), ) xlator_dumpops['fdctx_to_dict'] = ( - ('fn-arg', 'this', 'xlator_t *'), - ('fn-arg', 'fd', 'fd_t *'), - ('fn-arg', 'dict', 'dict_t *'), - ('ret-val', 'int32_t', '0'), + ('fn-arg', 'this', 'xlator_t *'), + ('fn-arg', 'fd', 'fd_t *'), + ('fn-arg', 'dict', 'dict_t *'), + ('ret-val', 'int32_t', '0'), ) xlator_dumpops['history'] = ( - ('fn-arg', 'this', 'xlator_t *'), - ('ret-val', 'int32_t', '0'), + ('fn-arg', 'this', 'xlator_t *'), + ('ret-val', 'int32_t', '0'), ) def get_error_arg (type_str): @@ -716,18 +716,17 @@ def get_error_arg (type_str): def get_subs (names, types, cbktypes=None): sdict = {} - sdict["@SHORT_ARGS@"] = string.join(names, ", ") + sdict["@SHORT_ARGS@"] = ', '.join(names) # Convert two separate tuples to one of (name, type) sub-tuples. as_tuples = list(zip(types, names)) # Convert each sub-tuple into a "type name" string. - as_strings = list(map(string.join, as_tuples)) + as_strings = [' '.join(item) for item in as_tuples] # Join all of those into one big string. - sdict["@LONG_ARGS@"] = string.join(as_strings, ",\n\t") + sdict["@LONG_ARGS@"] = ',\n\t'.join(as_strings) # So much more readable than string.join(map(string.join,zip(...)))) - sdict["@ERROR_ARGS@"] = string.join(list(map(get_error_arg, types)), ", ") - if cbktypes is not None: - sdict["@CBK_ERROR_ARGS@"] = string.join(list(map( - get_error_arg, cbktypes)), ", ") + sdict["@ERROR_ARGS@"] = ', '.join(list(map(get_error_arg, types))) + if cbktypes is not None: + sdict["@CBK_ERROR_ARGS@"] = ', '.join(list(map(get_error_arg, cbktypes))) return sdict def generate (tmpl, name, subs): @@ -735,24 +734,24 @@ def generate (tmpl, name, subs): if name == "writev": # More spurious inconsistency. text = text.replace("@UPNAME@", "WRITE") - elif name == "readv": - text = text.replace("@UPNAME@", "READ") + elif name == "readv": + text = text.replace("@UPNAME@", "READ") else: text = text.replace("@UPNAME@", name.upper()) - for old, new in subs[name].iteritems(): + for old, new in subs[name].items(): text = text.replace(old, new) # TBD: reindent/reformat the result for maximum readability. - return text + return text fop_subs = {} cbk_subs = {} -for name, args in ops.iteritems(): +for name, args in ops.items(): # Create the necessary substitution strings for fops. arg_names = [ a[1] for a in args if a[0] == 'fop-arg'] arg_types = [ a[2] for a in args if a[0] == 'fop-arg'] - cbk_types = [ a[2] for a in args if a[0] == 'cbk-arg'] + cbk_types = [ a[2] for a in args if a[0] == 'cbk-arg'] fop_subs[name] = get_subs(arg_names, arg_types, cbk_types) # Same thing for callbacks. |