fuse

package
v0.0.0-...-d6a869a Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AttribCacheTimeout int64 = 0x7fffffffffffffff

Attribute's cache-timeout: This is the maximum amount of time that kernel will hold attributes associated to any given file/dir. Refer to man fuse(4) for details.

View Source
var DentryCacheTimeout int64 = 0x7fffffffffffffff

Default dentry-cache-timeout interval: This is the maximum amount of time that VFS will hold on to dentry elements before starting to forward lookup() operations to FUSE server. We want to set this to infinite ideally; we set it to the max allowed value.

Functions

func NewFuseServer

func NewFuseServer(
	path string,
	mountpoint string,
	container domain.ContainerIface,
	service *FuseServerService) domain.FuseServerIface

Types

type Dir

type Dir struct {
	//
	// Underlying File struct representing each directory.
	//
	File
}

Dir struct serves as a FUSE-friendly abstraction to represent directories present in the host FS.

func NewDir

func NewDir(req *domain.HandlerRequest, attr *fuse.Attr, srv *fuseServer) *Dir

NewDir method serves as Dir constructor.

func (*Dir) Create

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

Create FS operation.

func (*Dir) Forget

func (d *Dir) Forget()

Forget FS operation.

func (*Dir) Lookup

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

Lookup FS operation.

func (*Dir) Mkdir

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

Mkdir FS operation.

func (*Dir) Open

func (d *Dir) Open(
	ctx context.Context,
	req *fuse.OpenRequest,
	resp *fuse.OpenResponse) (fs.Handle, error)

Open FS operation.

func (*Dir) ReadDirAll

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

ReadDirAll FS operation.

type File

type File struct {
	// contains filtered or unexported fields
}

func NewFile

func NewFile(req *domain.HandlerRequest, attr *fuse.Attr, srv *fuseServer) *File

NewFile method serves as File constructor.

func (*File) Attr

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

Attr FS operation.

func (*File) Forget

func (f *File) Forget()

Forget FS operation.

func (*File) ModTime

func (f *File) ModTime() time.Time

ModTime method returns the modification-time of a File element.

func (*File) Mode

func (f *File) Mode() os.FileMode

Mode method returns the 'mode' of a File element.

func (*File) Open

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

Open FS operation.

func (*File) Read

func (f *File) Read(
	ctx context.Context,
	req *fuse.ReadRequest,
	resp *fuse.ReadResponse) error

Read FS operation.

func (f *File) Readlink(
	ctx context.Context,
	req *fuse.ReadlinkRequest) (string, error)

func (*File) Release

func (f *File) Release(ctx context.Context, req *fuse.ReleaseRequest) error

Release FS operation.

func (*File) Setattr

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

Setattr FS operation.

func (*File) Size

func (f *File) Size() uint64

Size method returns the 'size' of a File element.

func (*File) Write

func (f *File) Write(
	ctx context.Context,
	req *fuse.WriteRequest,
	resp *fuse.WriteResponse) error

Write FS operation.

type FuseServerService

type FuseServerService struct {
	sync.RWMutex // servers map protection
	// contains filtered or unexported fields
}

func NewFuseServerService

func NewFuseServerService() *FuseServerService

FuseServerService constructor.

func (*FuseServerService) CreateFuseServer

func (fss *FuseServerService) CreateFuseServer(serveCntr, stateCntr domain.ContainerIface) error

Creates new fuse-server.

serveCntr is the container on which the fuse server will listen. stateCntr is the container object tracking the state for the fuse accesses.

Normally serveCntr and stateCntr refer to the same cntr object. However, if multiple containers want to share the same fuse state (as sysbox-fs does for kubernetes pods), then this function may be called with different serveCntr objects but the same stateCntr object.

func (*FuseServerService) DestroyFuseServer

func (fss *FuseServerService) DestroyFuseServer(cntrId string) error

Destroy a fuse-server.

func (*FuseServerService) DestroyFuseService

func (fss *FuseServerService) DestroyFuseService()

FuseServerService destructor.

func (*FuseServerService) FuseServerCntrRegComplete

func (fss *FuseServerService) FuseServerCntrRegComplete(cntr domain.ContainerIface) error

func (*FuseServerService) Setup

type IOerror

type IOerror struct {
	RcvError error         `json:"-"`
	Type     string        `json:"type"`
	Code     syscall.Errno `json:"code"`
	Message  string        `json:"message"`
}

IOerror's purpose is to encapsulate errors to be delivered to FUSE-Bazil library, which imposes certain demands on the error types that can be handled (i.e. it must satisfy 'errorNumber' interface).

As part of this 'error' implementation, we are also providing an encoding specialization method to the (un)marshalling routines involved in 'nsenter' processing events. Note that without this specialization, we wouldn't be able to encode generic 'error' interface types; which is precisely the reason that the 'RcvError' member below is not being exposed to JSON marshalling logic.

func (IOerror) Errno

func (e IOerror) Errno() fuse.Errno

Method requested by fuse.ErrorNumber interface. By implementing this interface, we are allowed to return IOerrors back to our FUSE-lib modules without making any modification to Bazil-FUSE code.

func (IOerror) Error

func (e IOerror) Error() string

func (*IOerror) MarshalJSON

func (e *IOerror) MarshalJSON() ([]byte, error)

MarshallJSON's interface specialization to allow a customized encoding of IOerror struct.

Jump to

Keyboard shortcuts

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