What is happening when this code calls FUSE like this?

限于喜欢 提交于 2019-12-11 01:37:28

问题


I am working through another person's implementation of file system with python fuse. I am trying to understand the flow of the program. When the code's main method is called it somehow calls the listDirectory method. Where is the code for this FUSE method defined? Where can I find documentation of what is happening? I searched the fuse.py file for this method and can't find it.

def listDirectory():
    print '[*] Listing Directory'
    message = str({"RequestType":4})
    print "sending message " + message
    return sendMessage(message)

def main(a, b):
    print "\n[*] Calling main method"
    FUSE(FuseHandler(a), b, foreground=True)

回答1:


In the Fuse.py is the definition of the class FUSE.

class FUSE(object):

    """This class is the lower level interface and should not be subclassed

       under normal use. Its methods are called by fuse.

       Assumes API version 2.6 or later."""



    def __init__(self, operations, mountpoint, raw_fi=False, **kwargs):

        """Setting raw_fi to True will cause FUSE to pass the fuse_file_info

           class as is to Operations, instead of just the fh field.

           This gives you access to direct_io, keep_cache, etc."""

You're just calling the init method implicitly.



来源:https://stackoverflow.com/questions/20275164/what-is-happening-when-this-code-calls-fuse-like-this

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!