Documentation ¶
Overview ¶
Package mountlib provides the mount command.
Index ¶
- Constants
- Variables
- func AddFlags(flagSet *pflag.FlagSet)
- func AddRc(mountUtilName string, mountFunction MountFn)
- func CheckAllowNonEmpty(mountpoint string, opt *Options) error
- func CheckMountEmpty(mountpoint string) error
- func CheckMountReady(mountpoint string) error
- func CheckOverlap(f fs.Fs, mountpoint string) error
- func ClipBlocks(b *uint64)
- func NewMountCommand(commandName string, hidden bool, mount MountFn) *cobra.Command
- func NotifyOnSigHup(sighupChan chan os.Signal)
- func WaitMountReady(mountpoint string, timeout time.Duration, daemon *os.Process) (err error)
- type MountFn
- type MountInfo
- type MountPoint
- type Options
- type UnmountFn
Constants ¶
const (
MaxLeafSize = 1024 // don't pass file names longer than this
)
Global constants
Variables ¶
var CanCheckMountReady = true
CanCheckMountReady is set if CheckMountReady is functional
var DefaultOpt = Options{ MaxReadAhead: 128 * 1024, AttrTimeout: 1 * time.Second, NoAppleDouble: true, NoAppleXattr: false, AsyncRead: true, }
DefaultOpt is the default values for creating the mount
Functions ¶
func CheckAllowNonEmpty ¶
CheckAllowNonEmpty checks --allow-non-empty flag, and if not used verifies that mountpoint is empty.
func CheckMountEmpty ¶
CheckMountEmpty checks if folder is not already a mountpoint. On Linux we use the OS-specific /proc/self/mountinfo API so the check won't access the path. Directories marked as "mounted" by autofs are considered not mounted.
func CheckMountReady ¶
CheckMountReady checks whether mountpoint is mounted by rclone. Only mounts with type "rclone" or "fuse.rclone" count.
func CheckOverlap ¶
CheckOverlap checks that root doesn't overlap with a mountpoint
func NewMountCommand ¶
NewMountCommand makes a mount command with the given name and Mount function
func NotifyOnSigHup ¶
NotifyOnSigHup makes SIGHUP notify given channel on supported systems
Types ¶
type MountFn ¶
type MountFn func(VFS *vfs.VFS, mountpoint string, opt *Options) (<-chan error, func() error, error)
MountFn is called to mount the file system
func ResolveMountMethod ¶
ResolveMountMethod returns mount function by name
type MountInfo ¶
type MountInfo struct { Fs string `json:"Fs"` MountPoint string `json:"MountPoint"` MountedOn time.Time `json:"MountedOn"` }
MountInfo is a transitional structure for json marshaling
type MountPoint ¶
type MountPoint struct { MountPoint string MountedOn time.Time MountOpt Options VFSOpt vfscommon.Options Fs fs.Fs VFS *vfs.VFS MountFn MountFn UnmountFn UnmountFn ErrChan <-chan error }
MountPoint represents a mount with options and runtime state
func NewMountPoint ¶
func NewMountPoint(mount MountFn, mountPoint string, f fs.Fs, mountOpt *Options, vfsOpt *vfscommon.Options) *MountPoint
NewMountPoint makes a new mounting structure
func (*MountPoint) Mount ¶
func (m *MountPoint) Mount() (mountDaemon *os.Process, err error)
Mount the remote at mountpoint
func (*MountPoint) SetDeviceName ¶
func (m *MountPoint) SetDeviceName(dev string)
SetDeviceName with sensible default
func (*MountPoint) SetVolumeName ¶
func (m *MountPoint) SetVolumeName(vol string)
SetVolumeName with sensible default
func (*MountPoint) Unmount ¶
func (m *MountPoint) Unmount() (err error)
Unmount the specified mountpoint
type Options ¶
type Options struct { DebugFUSE bool AllowNonEmpty bool AllowRoot bool AllowOther bool DefaultPermissions bool WritebackCache bool Daemon bool DaemonWait time.Duration // time to wait for ready mount from daemon, maximum on Linux or constant on macOS/BSD MaxReadAhead fs.SizeSuffix ExtraOptions []string ExtraFlags []string AttrTimeout time.Duration // how long the kernel caches attribute for DeviceName string VolumeName string NoAppleDouble bool NoAppleXattr bool DaemonTimeout time.Duration // OSXFUSE only AsyncRead bool NetworkMode bool // Windows only DirectIO bool // use Direct IO for file access CaseInsensitive fs.Tristate }
Options for creating the mount
var Opt Options
Opt contains options set by command line flags
func (*Options) SetVolumeName ¶
SetVolumeName removes special characters from volume name if necessary