fsbridge

package
v0.0.0-...-ff2c174 Latest Latest
Warning

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

Go to latest
Published: May 9, 2021 License: Apache-2.0, MIT Imports: 12 Imported by: 0

Documentation

Overview

Package fsbridge provides common interfaces to bridge between VFS1 and VFS2 files.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type File

type File interface {
	// PathnameWithDeleted returns an absolute pathname to vd, consistent with
	// Linux's d_path(). In particular, if vd.Dentry() has been disowned,
	// PathnameWithDeleted appends " (deleted)" to the returned pathname.
	PathnameWithDeleted(ctx context.Context) string

	// ReadFull read all contents from the file.
	ReadFull(ctx context.Context, dst usermem.IOSequence, offset int64) (int64, error)

	// ConfigureMMap mutates opts to implement mmap(2) for the file.
	ConfigureMMap(context.Context, *memmap.MMapOpts) error

	// Type returns the file type, e.g. linux.S_IFREG.
	Type(context.Context) (linux.FileMode, error)

	// IncRef increments reference.
	IncRef()

	// DecRef decrements reference.
	DecRef(ctx context.Context)
}

File provides a common interface to bridge between VFS1 and VFS2 files.

func NewFSFile

func NewFSFile(file *fs.File) File

NewFSFile creates a new File over fs.File.

func NewVFSFile

func NewVFSFile(file *vfs.FileDescription) File

NewVFSFile creates a new File over fs.File.

type Lookup

type Lookup interface {
	// OpenPath opens a file.
	OpenPath(ctx context.Context, path string, opts vfs.OpenOptions, remainingTraversals *uint, resolveFinal bool) (File, error)
}

Lookup provides a common interface to open files.

func NewFSLookup

func NewFSLookup(mntns *fs.MountNamespace, root, workingDir *fs.Dirent) Lookup

NewFSLookup creates a new Lookup using VFS1.

func NewVFSLookup

func NewVFSLookup(mntns *vfs.MountNamespace, root, workingDir vfs.VirtualDentry) Lookup

NewVFSLookup creates a new Lookup using VFS2.

type VFSFile

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

VFSFile implements File interface over vfs.FileDescription.

+stateify savable

func (*VFSFile) ConfigureMMap

func (f *VFSFile) ConfigureMMap(ctx context.Context, opts *memmap.MMapOpts) error

ConfigureMMap implements File.

func (*VFSFile) DecRef

func (f *VFSFile) DecRef(ctx context.Context)

DecRef implements File.

func (*VFSFile) FileDescription

func (f *VFSFile) FileDescription() *vfs.FileDescription

FileDescription returns the FileDescription represented by f. It does not take an additional reference on the returned FileDescription.

func (*VFSFile) IncRef

func (f *VFSFile) IncRef()

IncRef implements File.

func (*VFSFile) PathnameWithDeleted

func (f *VFSFile) PathnameWithDeleted(ctx context.Context) string

PathnameWithDeleted implements File.

func (*VFSFile) ReadFull

func (f *VFSFile) ReadFull(ctx context.Context, dst usermem.IOSequence, offset int64) (int64, error)

ReadFull implements File.

func (*VFSFile) StateFields

func (f *VFSFile) StateFields() []string

func (*VFSFile) StateLoad

func (f *VFSFile) StateLoad(stateSourceObject state.Source)

+checklocksignore

func (*VFSFile) StateSave

func (f *VFSFile) StateSave(stateSinkObject state.Sink)

+checklocksignore

func (*VFSFile) StateTypeName

func (f *VFSFile) StateTypeName() string

func (*VFSFile) Type

func (f *VFSFile) Type(ctx context.Context) (linux.FileMode, error)

Type implements File.

Jump to

Keyboard shortcuts

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