fseval

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2025 License: Apache-2.0 Imports: 9 Imported by: 2

Documentation

Overview

Package fseval provides a generic interface for all filesystem operations done by umoci when working in the image rootfs, which allows for alternative implementations of the filesystem operations to be easily swapped in.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FsEval

type FsEval interface {
	// We inherit all of the base methods from mtree.FsEval.
	mtree.FsEval

	// Create is equivalent to os.Create.
	Create(path string) (*os.File, error)

	// Lstatx is equivalent to unix.Lstat.
	Lstatx(path string) (unix.Stat_t, error)

	// Readlink is equivalent to os.Readlink.
	Readlink(path string) (string, error)

	// Symlink is equivalent to os.Symlink.
	Symlink(linkname, path string) error

	// Link is equivalent to os.Link.
	Link(linkname, path string) error

	// Chmod is equivalent to os.Chmod.
	Chmod(path string, mode os.FileMode) error

	// Lutimes is equivalent to os.Lutimes.
	Lutimes(path string, atime, mtime time.Time) error

	// RemoveAll is equivalent to os.RemoveAll.
	RemoveAll(path string) error

	// MkdirAll is equivalent to os.MkdirAll.
	MkdirAll(path string, perm os.FileMode) error

	// Mknod is equivalent to unix.Mknod.
	Mknod(path string, mode os.FileMode, dev uint64) error

	// Llistxattr is equivalent to system.Llistxattr
	Llistxattr(path string) ([]string, error)

	// Lremovexattr is equivalent to system.Lremovexattr
	Lremovexattr(path, name string) error

	// Lsetxattr is equivalent to system.Lsetxattr
	Lsetxattr(path, name string, value []byte, flags int) error

	// Lgetxattr is equivalent to system.Lgetxattr
	Lgetxattr(path string, name string) ([]byte, error)

	// Lclearxattrs is equivalent to system.Lclearxattrs
	Lclearxattrs(path string, skipFn func(xattr string) bool) error

	// Walk is equivalent to filepath.Walk.
	Walk(root string, fn filepath.WalkFunc) error
}

FsEval is a super-interface that implements everything required for mtree.FsEval as well as including all of the imporant os.* wrapper functions needed for "oci/layers".tarExtractor.

var Default FsEval = osFsEval(0)

Default is the "identity" form of FsEval. In particular, it does not do any trickery and calls directly to the relevant os.* functions (and does not wrap KeywordFunc). This should be used by default, because there are no weird side-effects.

var Rootless FsEval = unprivFsEval(0)

Rootless is an FsEval implementation that uses "umoci/pkg/unpriv".* functions in order to provide the ability for unprivileged users (those without CAP_DAC_OVERRIDE and CAP_DAC_READ_SEARCH) to evaluate parts of a filesystem that they own. Note that by necessity this requires modifying the filesystem (and thus will not work on read-only filesystems).

Jump to

Keyboard shortcuts

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