opentree

package
v0.1.21 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2026 License: MPL-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package opentree provides a simple interface to create and manage a subfilesystem using the `open_tree` syscall. It allows for creating a new subfilesystem by cloning an existing filesystem tree and provides a method to close the filesystem when it is no longer needed.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FS

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

FS represents a subfilesystem that can be created and managed. It uses a file descriptor to represent the mounted filesystem and provides methods to create and close the filesystem. The creation of the filesystem is idempotent, meaning it can be called multiple times without side effects.

func NewFromFd

func NewFromFd(fd int) *FS

NewFromFd creates a new fs instance from file descriptor.

func NewFromPath

func NewFromPath(path string) *FS

NewFromPath creates a new fs instance from path.

func (*FS) Close

func (fs *FS) Close() error

Close closes the file descriptor.

func (*FS) FSType

func (fs *FS) FSType() string

FSType is no-op for opentree fs.

func (*FS) Open

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

Open initializes the fs 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 repairs the filesystem if needed. This method is a no-op as the `open_tree` syscall does not support repair operations.

func (*FS) Source

func (fs *FS) Source() string

Source returns the source path of the filesystem.

Jump to

Keyboard shortcuts

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