• Jonathon Reinhart's avatar
    nodefs: Change defaultNode.GetAttr() to call file.GetAttr() if not nil · 994fc0fe
    Jonathon Reinhart authored
    This enhances nodes which embed defaultNode (which is most of them),
    allowing those implementations to omit a GetAttr() method. Without this,
    when the kernel calls GetAttr() for an open file, FUSE will return a
    size of zero, causing a read() of the file to always return 0, even
    though fuse returns a nonzero number of bytes.
    
    One can leverage this behavior to create a Linux procfs-like file, which
    stat shows to be zero bytes, but can be successfully read.
    
    N.B. This behavior is only useful if the FileSystemConnector Options
    specify AttrTimeout of zero. Otherwise, the result of the first call to
    GetAttr() (file == nil) is cached, and the kernel allows zero bytes to
    be read. With this caching disabled, the next GetAttr() call (file !=
    nil) will be used to control the number of readable bytes.
    994fc0fe
defaultnode.go 4.64 KB