mount

package
v0.0.0-...-cedfd68 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Package mount holds mount related files

Package mount holds mount related files

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrMountUndefined is used when a mount identifier is undefined
	ErrMountUndefined = errors.New("undefined mountID")
	// ErrMountLoop is returned when there is a resolution loop
	ErrMountLoop = errors.New("mount resolution loop")
	// ErrMountPathEmpty is returned when the resolved mount path is empty
	ErrMountPathEmpty = errors.New("mount resolution return empty path")
	// ErrMountKernelID is returned when it's not a critical error
	ErrMountKernelID = errors.New("not a critical error")
)

Functions

func GetVFSLinkDentryPosition

func GetVFSLinkDentryPosition(kernelVersion *skernel.Version) uint64

GetVFSLinkDentryPosition gets VFS link dentry position

func GetVFSLinkTargetDentryPosition

func GetVFSLinkTargetDentryPosition(kernelVersion *skernel.Version) uint64

GetVFSLinkTargetDentryPosition gets VFS link target dentry position

func GetVFSMKDirDentryPosition

func GetVFSMKDirDentryPosition(kernelVersion *skernel.Version) uint64

GetVFSMKDirDentryPosition gets VFS MKDir dentry position

func GetVFSRemovexattrDentryPosition

func GetVFSRemovexattrDentryPosition(kernelVersion *skernel.Version) uint64

GetVFSRemovexattrDentryPosition gets VFS remove xattr dentry position

func GetVFSSetxattrDentryPosition

func GetVFSSetxattrDentryPosition(kernelVersion *skernel.Version) uint64

GetVFSSetxattrDentryPosition gets VFS set xattr dentry position

Types

type ErrMountNotFound

type ErrMountNotFound struct {
	MountID uint32
}

ErrMountNotFound is used when an unknown mount identifier is found

func (*ErrMountNotFound) Error

func (e *ErrMountNotFound) Error() string

type NoOpResolver

type NoOpResolver struct {
}

NoOpResolver returns an empty resolver

func (*NoOpResolver) DelPid

func (mr *NoOpResolver) DelPid(_ uint32)

DelPid removes the pid form the pid mapping

func (*NoOpResolver) Delete

func (mr *NoOpResolver) Delete(_ uint32) error

Delete a mount from the cache

func (*NoOpResolver) Insert

func (mr *NoOpResolver) Insert(_ model.Mount, _ uint32) error

Insert a new mount point in the cache

func (*NoOpResolver) IsMountIDValid

func (mr *NoOpResolver) IsMountIDValid(_ uint32) (bool, error)

IsMountIDValid returns whether the mountID is valid

func (*NoOpResolver) ResolveFilesystem

func (mr *NoOpResolver) ResolveFilesystem(_ uint32, _ uint32, _ uint32, _ string) (string, error)

ResolveFilesystem returns the name of the filesystem

func (*NoOpResolver) ResolveMount

ResolveMount returns the mount

func (*NoOpResolver) ResolveMountPath

func (mr *NoOpResolver) ResolveMountPath(_ uint32, _ uint32, _ uint32, _ string) (string, model.MountSource, model.MountOrigin, error)

ResolveMountPath returns the path of a mount identified by its mount ID.

func (*NoOpResolver) ResolveMountRoot

func (mr *NoOpResolver) ResolveMountRoot(_ uint32, _ uint32, _ uint32, _ string) (string, model.MountSource, model.MountOrigin, error)

ResolveMountRoot returns the root of a mount identified by its mount ID.

func (*NoOpResolver) SendStats

func (mr *NoOpResolver) SendStats() error

SendStats sends metrics about the current state of the mount resolver

func (*NoOpResolver) SyncCache

func (mr *NoOpResolver) SyncCache(_ uint32) error

SyncCache Snapshots the current mount points of the system by reading through /proc/[pid]/mountinfo.

func (*NoOpResolver) ToJSON

func (mr *NoOpResolver) ToJSON() ([]byte, error)

ToJSON return a json version of the cache

type Resolver

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

Resolver represents a cache for mountpoints and the corresponding file systems

func NewResolver

func NewResolver(statsdClient statsd.ClientInterface, cgroupsResolver *cgroup.Resolver, opts ResolverOpts) (*Resolver, error)

NewResolver instantiates a new mount resolver

func (*Resolver) DelPid

func (mr *Resolver) DelPid(pid uint32)

DelPid removes the pid form the pid mapping

func (*Resolver) Delete

func (mr *Resolver) Delete(mountID uint32) error

Delete a mount from the cache

func (*Resolver) Insert

func (mr *Resolver) Insert(m model.Mount, pid uint32) error

Insert a new mount point in the cache

func (*Resolver) IsMountIDValid

func (mr *Resolver) IsMountIDValid(mountID uint32) (bool, error)

IsMountIDValid returns whether the mountID is valid

func (*Resolver) ResolveFilesystem

func (mr *Resolver) ResolveFilesystem(mountID uint32, device uint32, pid uint32, containerID string) (string, error)

ResolveFilesystem returns the name of the filesystem

func (*Resolver) ResolveMount

func (mr *Resolver) ResolveMount(mountID uint32, device uint32, pid uint32, containerID string) (*model.Mount, model.MountSource, model.MountOrigin, error)

ResolveMount returns the mount

func (*Resolver) ResolveMountPath

func (mr *Resolver) ResolveMountPath(mountID uint32, device uint32, pid uint32, containerID string) (string, model.MountSource, model.MountOrigin, error)

ResolveMountPath returns the path of a mount identified by its mount ID.

func (*Resolver) ResolveMountRoot

func (mr *Resolver) ResolveMountRoot(mountID uint32, device uint32, pid uint32, containerID string) (string, model.MountSource, model.MountOrigin, error)

ResolveMountRoot returns the root of a mount identified by its mount ID.

func (*Resolver) SendStats

func (mr *Resolver) SendStats() error

SendStats sends metrics about the current state of the mount resolver

func (*Resolver) SyncCache

func (mr *Resolver) SyncCache(pid uint32) error

SyncCache Snapshots the current mount points of the system by reading through /proc/[pid]/mountinfo.

func (*Resolver) ToJSON

func (mr *Resolver) ToJSON() ([]byte, error)

ToJSON return a json version of the cache

type ResolverInterface

type ResolverInterface interface {
	IsMountIDValid(mountID uint32) (bool, error)
	SyncCache(pid uint32) error
	Delete(mountID uint32) error
	ResolveFilesystem(mountID uint32, device uint32, pid uint32, containerID string) (string, error)
	Insert(m model.Mount, pid uint32) error
	DelPid(pid uint32)
	ResolveMountRoot(mountID uint32, device uint32, pid uint32, containerID string) (string, model.MountSource, model.MountOrigin, error)
	ResolveMountPath(mountID uint32, device uint32, pid uint32, containerID string) (string, model.MountSource, model.MountOrigin, error)
	ResolveMount(mountID uint32, device uint32, pid uint32, containerID string) (*model.Mount, model.MountSource, model.MountOrigin, error)
	SendStats() error
	ToJSON() ([]byte, error)
}

ResolverInterface defines the resolver interface

type ResolverOpts

type ResolverOpts struct {
	UseProcFS bool
}

ResolverOpts defines mount resolver options

Jump to

Keyboard shortcuts

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