mount

package
v0.0.0-...-585c797 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2015 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// 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 operation or a mount type not suppored.
	ErrUnsupported = errors.New("Not supported")
)

Functions

This section is empty.

Types

type DeviceMap

type DeviceMap map[string]*Info

DeviceMap map device name to Info

type DeviceMounter

type DeviceMounter struct {
	Mounter
}

DeviceMounter implements Ops and keeps track of active mounts for volume drivers.

func NewDeviceMounter

func NewDeviceMounter(devPrefix string) (*DeviceMounter, error)

NewDeviceMounter

func (*DeviceMounter) Load

func (m *DeviceMounter) Load(devPrefix string) error

Load mount table

type Info

type Info struct {
	Device     string
	Minor      int
	Mountpoint []PathInfo
	Fs         string
}

Info per device

type Manager

type Manager interface {
	// String representation of the mount table
	String() string
	// Load mount table for all devices that match this identifier
	Load(source string) error
	// Inspect mount table for specified source. ErrEnoent may be returned.
	Inspect(source string) []PathInfo
	// HasMounts determines returns the number of mounts for the source.
	HasMounts(source string) int
	// Exists returns true if the device is mounted at specified path.
	// returned if the device does not exists.
	Exists(source, path string) (bool, error)
	// Mount device at mountpoint or increment refcnt if device is already mounted
	// at specified mountpoint.
	Mount(minor int, device, path, fs string, flags uintptr, data string) error
	// Unmount device at mountpoint or decrement refcnt. If device has no
	// mountpoints left after this operation, it is removed from the matrix.
	// ErrEnoent is returned if the device or mountpoint for the device is not found.
	Unmount(source, path string) error
}

Mangager defines the interface for keep track of volume driver mounts.

func New

func New(mounterType MountType, identifier string) (Manager, error)

func NewNFSMounter

func NewNFSMounter(server string) (Manager, error)

NewNFSMounter instance

type MountType

type MountType int
const (
	DeviceMount MountType = 1 << iota
	NFSMount
)

type Mounter

type Mounter struct {
	sync.Mutex
	// contains filtered or unexported fields
}

Mounter implements Ops and keeps track of active mounts for volume drivers.

func (*Mounter) Exists

func (m *Mounter) Exists(devPath string, path string) (bool, error)

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) HasMounts

func (m *Mounter) HasMounts(devPath string) int

HasMounts determines returns the number of mounts for the device.

func (*Mounter) Inspect

func (m *Mounter) Inspect(devPath string) []PathInfo

Inspect mount table for device

func (*Mounter) Mount

func (m *Mounter) Mount(minor int, device, path, fs string, flags uintptr, data string) error

Mount new mountpoint for specified device.

func (*Mounter) String

func (m *Mounter) String() string

String representation of Mounter

func (*Mounter) Unmount

func (m *Mounter) Unmount(device, path string) error

Unmount device at mountpoint or decrement refcnt. If device has no mountpoints left after this operation, it is removed from the matrix. ErrEnoent is returned if the device or mountpoint for the device is not found.

type NFSMounter

type NFSMounter struct {
	Mounter
	// contains filtered or unexported fields
}

NFSMounter implements Manager and keeps track of active mounts for volume drivers.

func (*NFSMounter) Load

func (m *NFSMounter) Load(source string) error

Load mount table

type PathInfo

type PathInfo struct {
	Path string
	// contains filtered or unexported fields
}

PathInfo is a reference counted path

Jump to

Keyboard shortcuts

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