Documentation ¶
Index ¶
- Constants
- Variables
- func GetMounts() ([]*mount.Info, error)
- func NewBindMounter(rootSubstrings []string, mountImpl MountImpl, allowedDirs []string, ...) (*bindMounter, error)
- func NewDeletedMounter(rootSubstring string, mountImpl MountImpl) (*deletedMounter, error)
- func NewDeviceMounter(devPrefixes []string, mountImpl MountImpl, allowedDirs []string, ...) (*deviceMounter, error)
- func NewRawBindMounter(rootSubstrings []string, mountImpl MountImpl, allowedDirs []string, ...) (*rawMounter, error)
- type CustomLoad
- type CustomMounter
- type CustomMounterHandler
- type CustomReload
- type DefaultMounter
- type DeviceMap
- type Info
- type Manager
- type MountImpl
- type MountType
- type Mounter
- func (m *Mounter) EmptyTrashDir() error
- func (m *Mounter) Exists(sourcePath string, path string) (bool, error)
- func (m *Mounter) GetRootPath(mountPath string) (string, error)
- func (m *Mounter) GetSourcePath(mountPath string) (string, error)
- func (m *Mounter) GetSourcePaths() []string
- func (m *Mounter) HasMounts(sourcePath string) int
- func (m *Mounter) HasTarget(targetPath string) (string, bool)
- func (m *Mounter) Inspect(sourcePath string) []*PathInfo
- func (m *Mounter) Mount(minor int, devPath, path, fs string, flags uintptr, data string, timeout int, ...) error
- func (m *Mounter) Mounts(sourcePath string) []string
- func (m *Mounter) RemoveMountPath(mountPath string, opts map[string]string) error
- func (m *Mounter) String() string
- func (m *Mounter) Unmount(devPath string, path string, flags int, timeout int, opts map[string]string) error
- type PathInfo
- type PathMap
Constants ¶
const (
// AllDevices designates all devices that show up as source.
AllDevices = "AllDevices"
)
const (
// NFSAllServers is a catch all for all servers.
NFSAllServers = "NFSAllServers"
)
Variables ¶
var ( // ErrExist is returned if path is already mounted to a different device. ErrExist = errors.New("Mountpath already exists") // ErrEnoent is returned for a non existent mount point ErrEnoent = errors.New("Mountpath is not mounted") // ErrEinval is returned is fields for an entry do no match // existing fields ErrEinval = errors.New("Invalid arguments for mount entry") // ErrUnsupported is returned for an unsupported operation or a mount type. ErrUnsupported = errors.New("Not supported") // ErrMountpathNotAllowed is returned when the requested mountpath is not // a part of the provided allowed mount paths ErrMountpathNotAllowed = errors.New("Mountpath is not allowed") )
var ErrLimitReached = errors.New("the read limit is reached")
ErrLimitReached means that the read limit is reached.
Functions ¶
func GetMounts ¶
GetMounts is a wrapper over mount.GetMounts(). It is mainly used to add a switch to enable device mounter tests.
func NewBindMounter ¶
func NewBindMounter( rootSubstrings []string, mountImpl MountImpl, allowedDirs []string, trashLocation string, ) (*bindMounter, error)
NewBindMounter returns a new bindMounter
func NewDeletedMounter ¶
NewDeletedMounter returns a new deletedMounter
Types ¶
type CustomLoad ¶
CustomLoad defines the mounter.Load callback function for customer mounters
type CustomMounter ¶
type CustomMounter func() (CustomLoad, CustomReload)
CustomMounter defines the CustomMount function that retursn the load and reload callbacks
type CustomMounterHandler ¶
type CustomMounterHandler struct { Mounter // contains filtered or unexported fields }
CustomMounterHandler implements the Mounter interface
func NewCustomMounter ¶
func NewCustomMounter( devPrefixes []string, mountImpl MountImpl, customMounter CustomMounter, allowedDirs []string, ) (*CustomMounterHandler, error)
NewCustomMounter returns a new CustomMounter
func (*CustomMounterHandler) Load ¶
func (c *CustomMounterHandler) Load(devPrefixes []string) error
Load mount table
func (*CustomMounterHandler) Reload ¶
func (c *CustomMounterHandler) Reload(device string) error
Reload mount table for a device
type CustomReload ¶
CustomReload defines the mounter.Reload callback function for customer mounters
type DefaultMounter ¶
type DefaultMounter struct { }
DefaultMounter defaults to syscall implementation.
type Manager ¶
type Manager interface { // String representation of the mount table String() string // Reload mount table for specified device. Reload(source string) error // Load mount table for all devices that match the list of identifiers Load(source []string) error // Inspect mount table for specified source. ErrEnoent may be returned. Inspect(source string) []*PathInfo // Mounts returns paths for specified source. Mounts(source string) []string // HasMounts determines returns the number of mounts for the source. HasMounts(source string) int // HasTarget determines returns the number of mounts for the target. HasTarget(target string) (string, bool) // Exists returns true if the device is mounted at specified path. // returned if the device does not exists. Exists(source, path string) (bool, error) // GetRootPath scans mounts for a specified mountPath and returns the // rootPath if found or returns an ErrEnoent GetRootPath(mountPath string) (string, error) // GetSourcePath scans mount for a specified mountPath and returns the // sourcePath if found or returns an ErrEnoent GetSourcePath(mountPath string) (string, error) // GetSourcePaths returns all source paths from the mount table GetSourcePaths() []string // Mount device at mountpoint Mount( minor int, device string, path string, fs string, flags uintptr, data string, timeout int, opts map[string]string) error // Unmount device at mountpoint and remove from the matrix. // ErrEnoent is returned if the device or mountpoint for the device // is not found. Unmount(source, path string, flags int, timeout int, opts map[string]string) error // RemoveMountPath removes the given path RemoveMountPath(path string, opts map[string]string) error // EmptyTrashDir removes all directories from the mounter trash directory EmptyTrashDir() error }
Manager defines the interface for keep track of volume driver mounts.
type MountImpl ¶
type MountImpl interface { Mount(source, target, fstype string, flags uintptr, data string, timeout int) error Unmount(target string, flags int, timeout int) error }
MountImpl backend implementation for Mount/Unmount calls
type MountType ¶
type MountType int
MountType indicates different mount types supported
const ( // DeviceMount indicates a device mount type DeviceMount MountType = 1 << iota // NFSMount indicates a NFS mount point NFSMount // CustomMount indicates a custom mount type with its // own defined way of handling mount table CustomMount // BindMount indicates a bind mount point BindMount // RawMount indicates a raw mount point RawMount )
type Mounter ¶
Mounter implements Ops and keeps track of active mounts for volume drivers.
func (*Mounter) EmptyTrashDir ¶
func (*Mounter) Exists ¶
Exists scans mountpaths for specified device and returns true if path is one of the mountpaths. ErrEnoent may be retuned if the device is not found
func (*Mounter) GetRootPath ¶
GetRootPath scans mounts for a specified mountPath and return the rootPath if found or returns an ErrEnoent
func (*Mounter) GetSourcePath ¶
GetSourcePath scans mount for a specified mountPath and returns the sourcePath if found or returnes an ErrEnoent
func (*Mounter) GetSourcePaths ¶
GetSourcePaths returns all source paths from the mount table
func (*Mounter) Mount ¶
func (m *Mounter) Mount( minor int, devPath, path, fs string, flags uintptr, data string, timeout int, opts map[string]string, ) error
Mount new mountpoint for specified device.
func (*Mounter) RemoveMountPath ¶
RemoveMountPath makes the path writeable and removes it after a fixed delay