fsopen

package
v1.12.2 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2026 License: MPL-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package fsopen provides a simple interface to create and manage a filesystem using the Linux syscalls for filesystem operations.

Index

Constants

This section is empty.

Variables

View Source
var ErrRepairUnsupported = errors.New("unsupported filesystem type for repair")

ErrRepairUnsupported is reported when the filesystem does not support repairs.

Functions

This section is empty.

Types

type FS

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

FS represents a filesystem that can be created and managed. It holds the flags and strings used for configuration, as well as the file descriptor for the mounted filesystem.

func New

func New(fstype string, opts ...Option) *FS

New creates a new FS instance with the provided options.

func (*FS) Close

func (fs *FS) Close() error

Close closes the file descriptor.

func (*FS) FSType

func (fs *FS) FSType() string

FSType returns the filesystem type string.

func (*FS) MountAt

func (fs *FS) MountAt(path string) (string, error)

MountAt mounts the filesystem at the specified path.

EXPERIMENTAL: This function is experimental and may change in the future.

func (*FS) Open

func (fs *FS) Open() (int, error)

Open initializes the filesystem and returns the file descriptor for the mounted filesystem. If the filesystem is already created, it returns the existing file descriptor. This method is idempotent, meaning it can be called multiple times without side effects.

func (*FS) Repair

func (fs *FS) Repair() error

Repair attempts to repair the filesystem if it is in a dirty state.

func (*FS) Source

func (fs *FS) Source() string

Source returns the source string used to create the filesystem.

func (*FS) UnmountFrom

func (fs *FS) UnmountFrom(path string) error

UnmountFrom unmounts the filesystem from the specified path.

EXPERIMENTAL: This function is experimental and may change in the future.

type Option

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

Option is a functional option for configuring a filesystem instance.

func WithBinaryParameters

func WithBinaryParameters(param string, value []byte) Option

WithBinaryParameters adds a map of byte arrays to the filesystem configuration.

func WithBoolParameter

func WithBoolParameter(param string) Option

WithBoolParameter adds a flag parameter to the filesystem configuration.

func WithMountFlags

func WithMountFlags(flag int) Option

WithMountFlags adds a flag set that will be passed to Fsmount syscall.

func WithProjectQuota

func WithProjectQuota(enabled bool) Option

WithProjectQuota sets the project quota flag.

func WithSource

func WithSource(source string) Option

WithSource adds a source to the filesystem configuration.

func WithStringParameter

func WithStringParameter(param, value string) Option

WithStringParameter adds a map of strings to the filesystem configuration.

Jump to

Keyboard shortcuts

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