pathfs
packageThis package is not in the latest version of its module.
Details
Validgo.mod file
The Go module system was introduced in Go 1.11 and is the official dependency management solution for Go.
Redistributable license
Redistributable licenses place minimal restrictions on how software can be used, modified, and redistributed.
Tagged version
Modules with tagged versions give importers more predictable builds.
Stable version
When a project reaches major version v1 it is considered stable.
- Learn more about best practices
Repository
Links
Documentation¶
Overview¶
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.
Index¶
- func CopyFile(srcFs, destFs FileSystem, srcFile, destFile string, context *fuse.Context) fuse.Status
- type FileSystem
- type PathNodeFs
- func (fs *PathNodeFs) AllFiles(name string, mask uint32) []nodefs.WithFlags
- func (fs *PathNodeFs) Connector() *nodefs.FileSystemConnector
- func (fs *PathNodeFs) EntryNotify(dir string, name string) fuse.Status
- func (fs *PathNodeFs) FileNotify(path string, off int64, length int64) fuse.Status
- func (fs *PathNodeFs) ForgetClientInodes()
- func (fs *PathNodeFs) LastNode(name string) (*nodefs.Inode, []string)
- func (fs *PathNodeFs) LookupNode(name string) *nodefs.Inode
- func (fs *PathNodeFs) Mount(path string, root nodefs.Node, opts *nodefs.Options) fuse.Status
- func (fs *PathNodeFs) Node(name string) *nodefs.Inode
- func (fs *PathNodeFs) Notify(path string) fuse.Status
- func (fs *PathNodeFs) Path(node *nodefs.Inode) string
- func (fs *PathNodeFs) RereadClientInodes()
- func (fs *PathNodeFs) Root() nodefs.Node
- func (fs *PathNodeFs) SetDebug(dbg bool)
- func (fs *PathNodeFs) String() string
- func (fs *PathNodeFs) Unmount(path string) fuse.Status
- func (fs *PathNodeFs) UnmountNode(node *nodefs.Inode) fuse.Status
- type PathNodeFsOptions
Constants¶
This section is empty.
Variables¶
This section is empty.
Functions¶
Types¶
typeFileSystem¶
type FileSystem interface {// Used for pretty printing.String()string// If called, provide debug output through the log package.SetDebug(debugbool)// 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(namestring, context *fuse.Context) (*fuse.Attr,fuse.Status)// These should update the file's ctime too.Chmod(namestring, modeuint32, context *fuse.Context) (codefuse.Status)Chown(namestring, uiduint32, giduint32, context *fuse.Context) (codefuse.Status)Utimens(namestring, Atime *time.Time, Mtime *time.Time, context *fuse.Context) (codefuse.Status)Truncate(namestring, sizeuint64, context *fuse.Context) (codefuse.Status)Access(namestring, modeuint32, context *fuse.Context) (codefuse.Status)// Tree structureLink(oldNamestring, newNamestring, context *fuse.Context) (codefuse.Status)Mkdir(namestring, modeuint32, context *fuse.Context)fuse.StatusMknod(namestring, modeuint32, devuint32, context *fuse.Context)fuse.StatusRename(oldNamestring, newNamestring, context *fuse.Context) (codefuse.Status)Rmdir(namestring, context *fuse.Context) (codefuse.Status)Unlink(namestring, context *fuse.Context) (codefuse.Status)// Extended attributes.GetXAttr(namestring, attributestring, context *fuse.Context) (data []byte, codefuse.Status)ListXAttr(namestring, context *fuse.Context) (attributes []string, codefuse.Status)RemoveXAttr(namestring, attrstring, context *fuse.Context)fuse.StatusSetXAttr(namestring, attrstring, data []byte, flagsint, context *fuse.Context)fuse.Status// Called after mount.OnMount(nodeFs *PathNodeFs)OnUnmount()// File handling. If opening for writing, the file's mtime// should be updated too.Open(namestring, flagsuint32, context *fuse.Context) (filenodefs.File, codefuse.Status)Create(namestring, flagsuint32, modeuint32, context *fuse.Context) (filenodefs.File, codefuse.Status)// Directory handlingOpenDir(namestring, context *fuse.Context) (stream []fuse.DirEntry, codefuse.Status)// Symlinks.Symlink(valuestring, linkNamestring, context *fuse.Context) (codefuse.Status)Readlink(namestring, context *fuse.Context) (string,fuse.Status)StatFs(namestring) *fuse.StatfsOut}A filesystem API that uses paths rather than inodes. A minimalfile system should have at least a functional GetAttr method.Typically, each call happens in its own goroutine, so take care tomake the file system thread-safe.
NewDefaultFileSystem provides a null implementation of requiredmethods.
funcNewDefaultFileSystem¶
func NewDefaultFileSystem()FileSystem
NewDefaultFileSystem creates a filesystem that responds ENOSYS forall methods
funcNewLockingFileSystem¶
func NewLockingFileSystem(pfsFileSystem)FileSystem
NewLockingFileSystem is a wrapper that makes a FileSystemthreadsafe by serializing each operation.
funcNewLoopbackFileSystem¶
func NewLoopbackFileSystem(rootstring)FileSystem
A FUSE filesystem that shunts all request to an underlying filesystem. Its main purpose is to provide test coverage withouthaving to build a synthetic filesystem.
funcNewPrefixFileSystem¶
func NewPrefixFileSystem(fsFileSystem, prefixstring)FileSystem
funcNewReadonlyFileSystem¶
func NewReadonlyFileSystem(fsFileSystem)FileSystem
NewReadonlyFileSystem returns a wrapper that only exposes read-onlyoperations.
typePathNodeFs¶
type PathNodeFs struct {// contains filtered or unexported fields}PathNodeFs is the file system that can translate an inode back to apath. The path name is then used to call into an object that hasthe FileSystem interface.
Lookups (ie. FileSystem.GetAttr) may return a inode number in itsreturn value. The inode number ("clientInode") is used to indicatelinked files.
funcNewPathNodeFs¶
func NewPathNodeFs(fsFileSystem, opts *PathNodeFsOptions) *PathNodeFs
NewPathNodeFs returns a file system that translates from inodes topath names.
func (*PathNodeFs)AllFiles¶
func (fs *PathNodeFs) AllFiles(namestring, maskuint32) []nodefs.WithFlags
AllFiles returns all open files for the inode corresponding withthe given mask.
func (*PathNodeFs)Connector¶
func (fs *PathNodeFs) Connector() *nodefs.FileSystemConnector
Connector returns the FileSystemConnector (the bridge to the rawprotocol) for this PathNodeFs.
func (*PathNodeFs)EntryNotify¶
func (fs *PathNodeFs) EntryNotify(dirstring, namestring)fuse.Status
EntryNotify makes the kernel forget the entry data from the givenname from a directory. After this call, the kernel will issue anew lookup request for the given name when necessary.
func (*PathNodeFs)FileNotify¶
FileNotify notifies that file contents were changed within thegiven range. Use negative offset for metadata-only invalidation,and zero-length for invalidating all content.
func (*PathNodeFs)ForgetClientInodes¶
func (fs *PathNodeFs) ForgetClientInodes()
ForgetClientInodes forgets all known information on client inodes.
func (*PathNodeFs)LastNode¶
func (fs *PathNodeFs) LastNode(namestring) (*nodefs.Inode, []string)
LastNode finds the deepest inode known corresponding to a path. Theunknown part of the filename is also returned.
func (*PathNodeFs)LookupNode¶
func (fs *PathNodeFs) LookupNode(namestring) *nodefs.Inode
Like Node, but use Lookup to discover inodes we may not have yet.
func (*PathNodeFs)Mount¶
Mount mounts a another node filesystem with the given root on thepath. The last component of the path should not exist yet.
func (*PathNodeFs)Node¶
func (fs *PathNodeFs) Node(namestring) *nodefs.Inode
Node looks up the Inode that corresponds to the given path name, orreturns nil if not found.
func (*PathNodeFs)Notify¶
func (fs *PathNodeFs) Notify(pathstring)fuse.Status
Notify ensures that the path name is invalidates: if the inode isknown, it issues an file content Notify, if not, an entry notifyfor the path is issued. The latter will clear out non-existencecache entries.
func (*PathNodeFs)Path¶
func (fs *PathNodeFs) Path(node *nodefs.Inode)string
Path constructs a path for the given Inode. If the file systemimplements hard links through client-inode numbers, the path maynot be unique.
func (*PathNodeFs)RereadClientInodes¶
func (fs *PathNodeFs) RereadClientInodes()
Rereads all inode numbers for all known files.
func (*PathNodeFs)Root¶
func (fs *PathNodeFs) Root()nodefs.Node
Root returns the root node for the path filesystem.
func (*PathNodeFs)SetDebug¶
func (fs *PathNodeFs) SetDebug(dbgbool)
SetDebug toggles debug information: it will log path names foreach operation processed.
func (*PathNodeFs)String¶
func (fs *PathNodeFs) String()string
String returns a name for this file system
func (*PathNodeFs)Unmount¶
func (fs *PathNodeFs) Unmount(pathstring)fuse.Status
UnmountNode unmounts the node filesystem with the given root.
func (*PathNodeFs)UnmountNode¶
func (fs *PathNodeFs) UnmountNode(node *nodefs.Inode)fuse.Status
UnmountNode unmounts the node filesystem with the given root.