Movatterモバイル変換


[0]ホーム

URL:


pathfs

package
v2.0.3Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 3, 2020 License:BSD-3-ClauseImports:14Imported by:26

Details

Repository

github.com/hanwen/go-fuse

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

Constants

This section is empty.

Variables

This section is empty.

Functions

funcCopyFile

func CopyFile(srcFs, destFsFileSystem, srcFile, destFilestring, context *fuse.Context)fuse.Status

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

func (fs *PathNodeFs) FileNotify(pathstring, offint64, lengthint64)fuse.Status

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

func (fs *PathNodeFs) Mount(pathstring, rootnodefs.Node, opts *nodefs.Options)fuse.Status

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.

typePathNodeFsOptions

type PathNodeFsOptions struct {// If ClientInodes is set, use Inode returned from GetAttr to// find hard-linked files.ClientInodesbool// Debug controls printing of debug information.Debugbool}

Source Files

View all Source files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f orF : Jump to
y orY : Canonical URL
go.dev uses cookies from Google to deliver and enhance the quality of its services and to analyze traffic.Learn more.

[8]ページ先頭

©2009-2025 Movatter.jp