go-fuse: github.com/hanwen/go-fuse/fuse/pathfs Index | Files

package pathfs

import "github.com/hanwen/go-fuse/fuse/pathfs"

This package is deprecated. New projects should use the package "github.com/hanwen/go-fuse/v2/fs" instead.

Package pathfs provides a file system API expressed in filenames.


Package Files

api.go copy.go default.go locking.go loopback.go loopback_linux.go pathfs.go prefixfs.go readonlyfs.go syscall_linux.go

func CopyFile Uses

func CopyFile(srcFs, destFs FileSystem, srcFile, destFile string, context *fuse.Context) fuse.Status

type FileSystem Uses

type FileSystem interface {
    // Used for pretty printing.
    String() string

    // If called, provide debug output through the log package.
    SetDebug(debug bool)

    // Attributes.  This function is the main entry point, through
    // which FUSE discovers which files and directories exist.
    // If the filesystem wants to implement hard-links, it should
    // return consistent non-zero FileInfo.Ino data.  Using
    // hardlinks incurs a performance hit.
    GetAttr(name string, context *fuse.Context) (*fuse.Attr, fuse.Status)

    // These should update the file's ctime too.
    Chmod(name string, mode uint32, context *fuse.Context) (code fuse.Status)
    Chown(name string, uid uint32, gid uint32, context *fuse.Context) (code fuse.Status)
    Utimens(name string, Atime *time.Time, Mtime *time.Time, context *fuse.Context) (code fuse.Status)

    Truncate(name string, size uint64, context *fuse.Context) (code fuse.Status)

    Access(name string, mode uint32, context *fuse.Context) (code fuse.Status)

    // Tree structure
    Link(oldName string, newName string, context *fuse.Context) (code fuse.Status)
    Mkdir(name string, mode uint32, context *fuse.Context) fuse.Status
    Mknod(name string, mode uint32, dev uint32, context *fuse.Context) fuse.Status
    Rename(oldName string, newName string, context *fuse.Context) (code fuse.Status)
    Rmdir(name string, context *fuse.Context) (code fuse.Status)
    Unlink(name string, context *fuse.Context) (code fuse.Status)

    // Extended attributes.
    GetXAttr(name string, attribute string, context *fuse.Context) (data []byte, code fuse.Status)
    ListXAttr(name string, context *fuse.Context) (attributes []string, code fuse.Status)
    RemoveXAttr(name string, attr string, context *fuse.Context) fuse.Status
    SetXAttr(name string, attr string, data []byte, flags int, context *fuse.Context) fuse.Status

    // Called after mount.
    OnMount(nodeFs *PathNodeFs)

    // File handling.  If opening for writing, the file's mtime
    // should be updated too.
    Open(name string, flags uint32, context *fuse.Context) (file nodefs.File, code fuse.Status)
    Create(name string, flags uint32, mode uint32, context *fuse.Context) (file nodefs.File, code fuse.Status)

    // Directory handling
    OpenDir(name string, context *fuse.Context) (stream []fuse.DirEntry, code fuse.Status)

    // Symlinks.
    Symlink(value string, linkName string, context *fuse.Context) (code fuse.Status)
    Readlink(name string, context *fuse.Context) (string, fuse.Status)

    StatFs(name string) *fuse.StatfsOut

A filesystem API that uses paths rather than inodes. A minimal file system should have at least a functional GetAttr method. Typically, each call happens in its own goroutine, so take care to make the file system thread-safe.

NewDefaultFileSystem provides a null implementation of required methods.

func NewDefaultFileSystem Uses

func NewDefaultFileSystem() FileSystem

NewDefaultFileSystem creates a filesystem that responds ENOSYS for all methods

func NewLockingFileSystem Uses

func NewLockingFileSystem(pfs FileSystem) FileSystem

NewLockingFileSystem is a wrapper that makes a FileSystem threadsafe by serializing each operation.

func NewLoopbackFileSystem Uses

func NewLoopbackFileSystem(root string) FileSystem

A FUSE filesystem that shunts all request to an underlying file system. Its main purpose is to provide test coverage without having to build a synthetic filesystem.

func NewPrefixFileSystem Uses

func NewPrefixFileSystem(fs FileSystem, prefix string) FileSystem

func NewReadonlyFileSystem Uses

func NewReadonlyFileSystem(fs FileSystem) FileSystem

NewReadonlyFileSystem returns a wrapper that only exposes read-only operations.

type PathNodeFs Uses

type PathNodeFs struct {
    // contains filtered or unexported fields

PathNodeFs is the file system that can translate an inode back to a path. The path name is then used to call into an object that has the FileSystem interface.

Lookups (ie. FileSystem.GetAttr) may return a inode number in its return value. The inode number ("clientInode") is used to indicate linked files.

func NewPathNodeFs Uses

func NewPathNodeFs(fs FileSystem, opts *PathNodeFsOptions) *PathNodeFs

NewPathNodeFs returns a file system that translates from inodes to path names.

func (*PathNodeFs) AllFiles Uses

func (fs *PathNodeFs) AllFiles(name string, mask uint32) []nodefs.WithFlags

AllFiles returns all open files for the inode corresponding with the given mask.

func (*PathNodeFs) Connector Uses

func (fs *PathNodeFs) Connector() *nodefs.FileSystemConnector

Connector returns the FileSystemConnector (the bridge to the raw protocol) for this PathNodeFs.

func (*PathNodeFs) EntryNotify Uses

func (fs *PathNodeFs) EntryNotify(dir string, name string) fuse.Status

EntryNotify makes the kernel forget the entry data from the given name from a directory. After this call, the kernel will issue a new lookup request for the given name when necessary.

func (*PathNodeFs) FileNotify Uses

func (fs *PathNodeFs) FileNotify(path string, off int64, length int64) fuse.Status

FileNotify notifies that file contents were changed within the given range. Use negative offset for metadata-only invalidation, and zero-length for invalidating all content.

func (*PathNodeFs) ForgetClientInodes Uses

func (fs *PathNodeFs) ForgetClientInodes()

ForgetClientInodes forgets all known information on client inodes.

func (*PathNodeFs) LastNode Uses

func (fs *PathNodeFs) LastNode(name string) (*nodefs.Inode, []string)

LastNode finds the deepest inode known corresponding to a path. The unknown part of the filename is also returned.

func (*PathNodeFs) LookupNode Uses

func (fs *PathNodeFs) LookupNode(name string) *nodefs.Inode

Like Node, but use Lookup to discover inodes we may not have yet.

func (*PathNodeFs) Mount Uses

func (fs *PathNodeFs) Mount(path string, root nodefs.Node, opts *nodefs.Options) fuse.Status

Mount mounts a another node filesystem with the given root on the path. The last component of the path should not exist yet.

func (*PathNodeFs) Node Uses

func (fs *PathNodeFs) Node(name string) *nodefs.Inode

Node looks up the Inode that corresponds to the given path name, or returns nil if not found.

func (*PathNodeFs) Notify Uses

func (fs *PathNodeFs) Notify(path string) fuse.Status

Notify ensures that the path name is invalidates: if the inode is known, it issues an file content Notify, if not, an entry notify for the path is issued. The latter will clear out non-existence cache entries.

func (*PathNodeFs) Path Uses

func (fs *PathNodeFs) Path(node *nodefs.Inode) string

Path constructs a path for the given Inode. If the file system implements hard links through client-inode numbers, the path may not be unique.

func (*PathNodeFs) RereadClientInodes Uses

func (fs *PathNodeFs) RereadClientInodes()

Rereads all inode numbers for all known files.

func (*PathNodeFs) Root Uses

func (fs *PathNodeFs) Root() nodefs.Node

Root returns the root node for the path filesystem.

func (*PathNodeFs) SetDebug Uses

func (fs *PathNodeFs) SetDebug(dbg bool)

SetDebug toggles debug information: it will log path names for each operation processed.

func (*PathNodeFs) String Uses

func (fs *PathNodeFs) String() string

String returns a name for this file system

func (*PathNodeFs) Unmount Uses

func (fs *PathNodeFs) Unmount(path string) fuse.Status

UnmountNode unmounts the node filesystem with the given root.

func (*PathNodeFs) UnmountNode Uses

func (fs *PathNodeFs) UnmountNode(node *nodefs.Inode) fuse.Status

UnmountNode unmounts the node filesystem with the given root.

type PathNodeFsOptions Uses

type PathNodeFsOptions struct {
    // If ClientInodes is set, use Inode returned from GetAttr to
    // find hard-linked files.
    ClientInodes bool

    // Debug controls printing of debug information.
    Debug bool

Package pathfs imports 14 packages (graph) and is imported by 237 packages. Updated 2020-03-11. Refresh now. Tools for package owners.