mountinfo

package
v0.0.0-...-c34bea4 Latest Latest
Warning

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

Go to latest
Published: May 20, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// FilesystemType superblock magic numbers for filesystems,
	// to be used for IsMountFS.
	FilesystemTypeBPFFS   = unix.BPF_FS_MAGIC
	FilesystemTypeCgroup2 = unix.CGROUP2_SUPER_MAGIC
)

Variables

This section is empty.

Functions

func IsMountFS

func IsMountFS(mntType int64, path string) (bool, bool, error)

IsMountFS returns two boolean values, checking

  • whether the path is a mount point;
  • if yes, whether its filesystem type is mntType.

Note that this function can not detect bind mounts, and is not working properly when path="/".

Types

type MountInfo

type MountInfo struct {
	MountID        int64
	ParentID       int64
	StDev          string
	Root           string
	MountPoint     string
	MountOptions   string
	OptionalFields []string
	FilesystemType string
	MountSource    string
	SuperOptions   string
}

MountInfo is a struct representing information from /proc/pid/mountinfo. More information about file syntax: https://www.kernel.org/doc/Documentation/filesystems/proc.txt

func GetMountInfo

func GetMountInfo() ([]*MountInfo, error)

GetMountInfo returns a slice of *MountInfo with information parsed from /proc/self/mountinfo

Jump to

Keyboard shortcuts

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