当这段代码像这样调用FUSE时会发生什么?

时间:2013-11-28 21:45:45

标签: python fuse

我正在通过另一个人使用python fuse实现文件系统。我想了解程序的流程。当调用代码的main方法时,它以某种方式调用listDirectory方法。这个FUSE方法的代码定义在哪里?我在哪里可以找到正在发生的事情的文件?我在fuse.py文件中搜索了此方法,但找不到它。

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 个答案:

答案 0 :(得分:4)

在Fuse.py中是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."""

您只是隐式调用 init 方法。

相关问题