mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-14 21:53:52 +00:00
Add a mounter that uses google's safe_format_and_mount.
This commit is contained in:
@@ -34,23 +34,23 @@ import (
|
||||
const FlagBind = syscall.MS_BIND
|
||||
const FlagReadOnly = syscall.MS_RDONLY
|
||||
|
||||
type mounter struct{}
|
||||
type Mounter struct{}
|
||||
|
||||
// Wraps syscall.Mount()
|
||||
func (mounter *mounter) Mount(source string, target string, fstype string, flags uintptr, data string) error {
|
||||
func (mounter *Mounter) Mount(source string, target string, fstype string, flags uintptr, data string) error {
|
||||
glog.V(5).Infof("Mounting %s %s %s %d %s", source, target, fstype, flags, data)
|
||||
return syscall.Mount(source, target, fstype, flags, data)
|
||||
}
|
||||
|
||||
// Wraps syscall.Unmount()
|
||||
func (mounter *mounter) Unmount(target string, flags int) error {
|
||||
func (mounter *Mounter) Unmount(target string, flags int) error {
|
||||
return syscall.Unmount(target, flags)
|
||||
}
|
||||
|
||||
// How many times to retry for a consistent read of /proc/mounts.
|
||||
const maxListTries = 3
|
||||
|
||||
func (mounter *mounter) List() ([]MountPoint, error) {
|
||||
func (*Mounter) List() ([]MountPoint, error) {
|
||||
hash1, err := readProcMounts(nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@@ -37,7 +37,7 @@ type Interface interface {
|
||||
|
||||
// New returns a mount.Interface for the current system.
|
||||
func New() Interface {
|
||||
return &mounter{}
|
||||
return &Mounter{}
|
||||
}
|
||||
|
||||
// This represents a single line in /proc/mounts or /etc/fstab.
|
||||
|
Reference in New Issue
Block a user