Domanda

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)
È stato utile?

Soluzione

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.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top