mountinfo

package
v0.22.0 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package mountinfo parses /proc/self/mountinfo to discover filesystem mounts visible in the calling process's mount namespace.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindByFSType

func FindByFSType(fstype string) ([]string, error)

FindByFSType returns the mount points for filesystems of the given type, in order of appearance, with duplicates removed.

Types

type Entry

type Entry struct {
	// MountPoint is the absolute path where the filesystem is mounted,
	// with octal escapes (\040, \011, \012, \134) decoded.
	MountPoint string

	// Root is the path within the source filesystem that's exposed at
	// MountPoint, octal-decoded. It is "/" for a full filesystem mount and
	// some other path (e.g. "/events") when a subdirectory of the source
	// filesystem has been bind-mounted onto MountPoint. Callers that want
	// to use MountPoint as the root of a filesystem should reject entries
	// where Root != "/".
	Root string

	// FSType is the filesystem type, e.g. "bpf", "tracefs", "debugfs".
	FSType string
}

Entry represents one parsed line from /proc/self/mountinfo.

func Read

func Read() ([]Entry, error)

Read parses /proc/self/mountinfo and returns one Entry per mount line. The result is cached for the lifetime of the process; mounts that appear or disappear after the first call are not reflected.

On non-Linux, returns an error wrapping internal.ErrNotSupportedOnOS.

Jump to

Keyboard shortcuts

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