{"modulePath":"github.com/dockerstack/kubernetes","version":"v0.20.1-0.20150627061651-1c0b765df6da","isLatest":true,"isStandardLibrary":false,"goos":"linux","goarch":"amd64","docs":"# package mount\n\nPackage mount defines an interface to mounting filesystems.\n\nTODO(thockin): This whole pkg is pretty linux-centric.  As soon as we have an alternate platform, we will need to abstract further.\n\n## Constants\n\n```go\nconst FakeActionMount = \"mount\"\n```\nValues for FakeAction.Action\n\n```go\nconst FakeActionUnmount = \"unmount\"\n```\n\n## Functions\n\n```go\nfunc GetDeviceNameFromMount(mounter Interface, mountPath string) (string, int, error)\n```\nGetDeviceNameFromMount: given a mnt point, find the device from /proc/mounts returns the device name, reference count, and error code\n\n```go\nfunc GetMountRefs(mounter Interface, mountPath string) ([]string, error)\n```\nGetMountRefs finds all other references to the device referenced by mountPath; returns a list of paths.\n\n## Types\n\n```go\ntype FakeAction struct {\n\tAction string // \"mount\" or \"unmount\"\n\tTarget string // applies to both mount and unmount actions\n\tSource string // applies only to \"mount\" actions\n\tFSType string // applies only to \"mount\" actions\n}\n```\nFakeAction objects are logged every time a fake mount or unmount is called.\n\n```go\ntype FakeMounter struct {\n\tMountPoints []MountPoint\n\tLog         []FakeAction\n}\n```\nFakeMounter implements mount.Interface for tests.\n\n```go\nfunc (f *FakeMounter) IsMountPoint(file string) (bool, error)\n```\n\n```go\nfunc (f *FakeMounter) List() ([]MountPoint, error)\n```\n\n```go\nfunc (f *FakeMounter) Mount(source string, target string, fstype string, options []string) error\n```\n\n```go\nfunc (f *FakeMounter) ResetLog()\n```\n\n```go\nfunc (f *FakeMounter) Unmount(target string) error\n```\n\n```go\ntype Interface interface {\n\t// Mount mounts source to target as fstype with given options.\n\tMount(source string, target string, fstype string, options []string) error\n\t// Unmount unmounts given target.\n\tUnmount(target string) error\n\t// List returns a list of all mounted filesystems.  This can be large.\n\t// On some platforms, reading mounts is not guaranteed consistent (i.e.\n\t// it could change between chunked reads). This is guaranteed to be\n\t// consistent.\n\tList() ([]MountPoint, error)\n\t// IsMountPoint determines if a directory is a mountpoint.\n\tIsMountPoint(file string) (bool, error)\n}\n```\n\n```go\nfunc New() Interface\n```\nNew returns a mount.Interface for the current system.\n\n```go\ntype MountPoint struct {\n\tDevice string\n\tPath   string\n\tType   string\n\tOpts   []string\n\tFreq   int\n\tPass   int\n}\n```\nThis represents a single line in /proc/mounts or /etc/fstab.\n\n```go\ntype Mounter struct{}\n```\nMounter provides the default implementation of mount.Interface for the linux platform.  This implementation assumes that the kubelet is running in the host's root mount namespace.\n\n```go\nfunc (mounter *Mounter) IsMountPoint(file string) (bool, error)\n```\nIsMountPoint determines if a directory is a mountpoint, by comparing the device for the directory with the device for it's parent.  If they are the same, it's not a mountpoint, if they're different, it is.\n\n```go\nfunc (*Mounter) List() ([]MountPoint, error)\n```\nList returns a list of all mounted filesystems.\n\n```go\nfunc (mounter *Mounter) Mount(source string, target string, fstype string, options []string) error\n```\nMount mounts source to target as fstype with given options. 'source' and 'fstype' must be an emtpy string in case it's not required, e.g. for remount, or for auto filesystem type, where kernel handles fs type for you. The mount 'options' is a list of options, currently come from mount(8), e.g. \"ro\", \"remount\", \"bind\", etc. If no more option is required, call Mount with an empty string list or nil.\n\n```go\nfunc (mounter *Mounter) Unmount(target string) error\n```\nUnmount unmounts the target.\n\n```go\ntype NsenterMounter struct{}\n```\nNsenterMounter is part of experimental support for running the kubelet in a container.  Currently, all docker containers receive their own mount namespaces.  NsenterMounter works by executing nsenter to run commands in the host's mount namespace.\n\nNsenterMounter requires:\n\n 1. Docker \u003e= 1.6 due to the dependency on the slave propagation mode of the bind-mount of the kubelet root directory in the container. Docker 1.5 used a private propagation mode for bind-mounts, so mounts performed in the host's mount namespace do not propagate out to the bind-mount in this docker version.\n 2. The host's root filesystem must be available at /rootfs\n 3. The nsenter binary must be at /nsenter in the container's filesystem.\n 4. The Kubelet process must have CAP\\_SYS\\_ADMIN (required by nsenter); at the present, this effectively means that the kubelet is running in a privileged container.\n\nFor more information about mount propagation modes, see:\n\n\thttps://www.kernel.org/doc/Documentation/filesystems/sharedsubtree.txt\n\n```go\nfunc (*NsenterMounter) IsMountPoint(file string) (bool, error)\n```\nIsMountPoint determines whether a path is a mountpoint by calling findmnt in the host's root mount namespace.\n\n```go\nfunc (*NsenterMounter) List() ([]MountPoint, error)\n```\nList returns a list of all mounted filesystems in the host's mount namespace.\n\n```go\nfunc (*NsenterMounter) Mount(source string, target string, fstype string, options []string) error\n```\nMount runs mount(8) in the host's root mount namespace.  Aside from this aspect, Mount has the same semantics as the mounter returned by mount.New()\n\n```go\nfunc (*NsenterMounter) Unmount(target string) error\n```\nUnmount runs umount(8) in the host's mount namespace.\n\n","path":"github.com/dockerstack/kubernetes/pkg/util/mount","name":"mount","synopsis":"Package mount defines an interface to mounting filesystems.","isRedistributable":true}
