mount

package
v1.67.3 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package mount implements a FUSE mounting system for rclone remotes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dir

type Dir struct {
	*vfs.Dir
	// contains filtered or unexported fields
}

Dir represents a directory entry

func (*Dir) Attr

func (d *Dir) Attr(ctx context.Context, a *fuse.Attr) (err error)

Attr updates the attributes of a directory

func (*Dir) Create

func (d *Dir) Create(ctx context.Context, req *fuse.CreateRequest, resp *fuse.CreateResponse) (node fusefs.Node, handle fusefs.Handle, err error)

Create makes a new file

func (*Dir) Fsync

func (d *Dir) Fsync(ctx context.Context, req *fuse.FsyncRequest) (err error)

Fsync the directory

func (d *Dir) Link(ctx context.Context, req *fuse.LinkRequest, old fusefs.Node) (newNode fusefs.Node, err error)

Link creates a new directory entry in the receiver based on an existing Node. Receiver must be a directory.

func (*Dir) Lookup

func (d *Dir) Lookup(ctx context.Context, req *fuse.LookupRequest, resp *fuse.LookupResponse) (node fusefs.Node, err error)

Lookup looks up a specific entry in the receiver.

Lookup should return a Node corresponding to the entry. If the name does not exist in the directory, Lookup should return ENOENT.

Lookup need not to handle the names "." and "..".

func (*Dir) Mkdir

func (d *Dir) Mkdir(ctx context.Context, req *fuse.MkdirRequest) (node fusefs.Node, err error)

Mkdir creates a new directory

func (*Dir) Mknod added in v1.55.0

func (d *Dir) Mknod(ctx context.Context, req *fuse.MknodRequest) (node fusefs.Node, err error)

Mknod is called to create a file. Since we define create this will be called in preference, however NFS likes to call it for some reason. We don't actually create a file here just the Node.

func (*Dir) ReadDirAll

func (d *Dir) ReadDirAll(ctx context.Context) (dirents []fuse.Dirent, err error)

ReadDirAll reads the contents of the directory

func (*Dir) Remove

func (d *Dir) Remove(ctx context.Context, req *fuse.RemoveRequest) (err error)

Remove removes the entry with the given name from the receiver, which must be a directory. The entry to be removed may correspond to a file (unlink) or to a directory (rmdir).

func (*Dir) Rename

func (d *Dir) Rename(ctx context.Context, req *fuse.RenameRequest, newDir fusefs.Node) (err error)

Rename the file

func (*Dir) Setattr

func (d *Dir) Setattr(ctx context.Context, req *fuse.SetattrRequest, resp *fuse.SetattrResponse) (err error)

Setattr handles attribute changes from FUSE. Currently supports ModTime only.

type FS

type FS struct {
	*vfs.VFS
	// contains filtered or unexported fields
}

FS represents the top level filing system

func NewFS

func NewFS(VFS *vfs.VFS, opt *mountlib.Options) *FS

NewFS makes a new FS

func (*FS) Root

func (f *FS) Root() (node fusefs.Node, err error)

Root returns the root node

func (*FS) Statfs

func (f *FS) Statfs(ctx context.Context, req *fuse.StatfsRequest, resp *fuse.StatfsResponse) (err error)

Statfs is called to obtain file system metadata. It should write that data to resp.

type File

type File struct {
	*vfs.File
	// contains filtered or unexported fields
}

File represents a file

func (*File) Attr

func (f *File) Attr(ctx context.Context, a *fuse.Attr) (err error)

Attr fills out the attributes for the file

func (*File) Fsync

func (f *File) Fsync(ctx context.Context, req *fuse.FsyncRequest) (err error)

Fsync the file

Note that we don't do anything except return OK

func (*File) Getxattr

func (f *File) Getxattr(ctx context.Context, req *fuse.GetxattrRequest, resp *fuse.GetxattrResponse) error

Getxattr gets an extended attribute by the given name from the node.

If there is no xattr by that name, returns fuse.ErrNoXattr.

func (*File) Listxattr

func (f *File) Listxattr(ctx context.Context, req *fuse.ListxattrRequest, resp *fuse.ListxattrResponse) error

Listxattr lists the extended attributes recorded for the node.

func (*File) Open

func (f *File) Open(ctx context.Context, req *fuse.OpenRequest, resp *fuse.OpenResponse) (fh fusefs.Handle, err error)

Open the file for read or write

func (*File) Removexattr

func (f *File) Removexattr(ctx context.Context, req *fuse.RemovexattrRequest) error

Removexattr removes an extended attribute for the name.

If there is no xattr by that name, returns fuse.ErrNoXattr.

func (*File) Setattr

func (f *File) Setattr(ctx context.Context, req *fuse.SetattrRequest, resp *fuse.SetattrResponse) (err error)

Setattr handles attribute changes from FUSE. Currently supports ModTime and Size only

func (*File) Setxattr

func (f *File) Setxattr(ctx context.Context, req *fuse.SetxattrRequest) error

Setxattr sets an extended attribute with the given name and value for the node.

type FileHandle

type FileHandle struct {
	vfs.Handle
}

FileHandle is an open for read file handle on a File

func (*FileHandle) Flush

func (fh *FileHandle) Flush(ctx context.Context, req *fuse.FlushRequest) (err error)

Flush is called on each close() of a file descriptor. So if a filesystem wants to return write errors in close() and the file has cached dirty data, this is a good place to write back data and return any errors. Since many applications ignore close() errors this is not always useful.

NOTE: The flush() method may be called more than once for each open(). This happens if more than one file descriptor refers to an opened file due to dup(), dup2() or fork() calls. It is not possible to determine if a flush is final, so each flush should be treated equally. Multiple write-flush sequences are relatively rare, so this shouldn't be a problem.

Filesystems shouldn't assume that flush will always be called after some writes, or that if will be called at all.

func (*FileHandle) Read

func (fh *FileHandle) Read(ctx context.Context, req *fuse.ReadRequest, resp *fuse.ReadResponse) (err error)

Read from the file handle

func (*FileHandle) Release

func (fh *FileHandle) Release(ctx context.Context, req *fuse.ReleaseRequest) (err error)

Release is called when we are finished with the file handle

It isn't called directly from userspace so the error is ignored by the kernel

func (*FileHandle) Write

func (fh *FileHandle) Write(ctx context.Context, req *fuse.WriteRequest, resp *fuse.WriteResponse) (err error)

Write data to the file handle

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL