mountlib

package
v1.59.0 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2022 License: MIT Imports: 27 Imported by: 21

Documentation

Index

Constants

View Source
const (
	MaxLeafSize = 1024 // don't pass file names longer than this
)

Global constants

Variables

View Source
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 AddFlags added in v1.53.0

func AddFlags(flagSet *pflag.FlagSet)

AddFlags adds the non filing system specific flags to the command

func AddRc added in v1.52.0

func AddRc(mountUtilName string, mountFunction MountFn)

AddRc adds mount and unmount functionality to rc

func CheckMountEmpty added in v1.56.0

func CheckMountEmpty(mountpoint string) error

CheckMountEmpty checks if folder is not already a mountpoint. On Linux we use the OS-specific /proc/mount API so the check won't access the path. Directories marked as "mounted" by autofs are considered not mounted.

func CheckMountReady added in v1.57.0

func CheckMountReady(mountpoint string) error

CheckMountReady checks whether mountpoint is mounted by rclone. Only mounts with type "rclone" or "fuse.rclone" count.

func ClipBlocks

func ClipBlocks(b *uint64)

ClipBlocks clips the blocks pointed to the OS max

func NewMountCommand

func NewMountCommand(commandName string, hidden bool, mount MountFn) *cobra.Command

NewMountCommand makes a mount command with the given name and Mount function

func NotifyOnSigHup added in v1.56.0

func NotifyOnSigHup(sighupChan chan os.Signal)

NotifyOnSigHup makes SIGHUP notify given channel on supported systems

func WaitMountReady added in v1.57.0

func WaitMountReady(mountpoint string, timeout time.Duration) (err error)

WaitMountReady waits until mountpoint is mounted by rclone.

Types

type MountFn added in v1.52.0

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 added in v1.56.0

func ResolveMountMethod(mountType string) (string, MountFn)

ResolveMountMethod returns mount function by name

type MountInfo added in v1.53.0

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 added in v1.56.0

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 added in v1.58.1

func NewMountPoint(mount MountFn, mountPoint string, f fs.Fs, mountOpt *Options, vfsOpt *vfscommon.Options) *MountPoint

NewMountPoint makes a new mounting structure

func (*MountPoint) CheckAllowings added in v1.56.0

func (m *MountPoint) CheckAllowings() error

CheckAllowings informs about ignored flags on Windows. If not on Windows and not --allow-non-empty flag is used, verify that mountpoint is empty.

func (*MountPoint) CheckOverlap added in v1.56.0

func (m *MountPoint) CheckOverlap() error

CheckOverlap checks that root doesn't overlap with mountpoint

func (*MountPoint) Mount added in v1.56.0

func (m *MountPoint) Mount() (daemon *os.Process, err error)

Mount the remote at mountpoint

func (*MountPoint) SetDeviceName added in v1.58.0

func (m *MountPoint) SetDeviceName(dev string)

SetDeviceName with sensible default

func (*MountPoint) SetVolumeName added in v1.56.0

func (m *MountPoint) SetVolumeName(vol string)

SetVolumeName with sensible default

func (*MountPoint) Unmount added in v1.56.0

func (m *MountPoint) Unmount() (err error)

Unmount the specified mountpoint

func (*MountPoint) Wait added in v1.56.0

func (m *MountPoint) Wait() error

Wait for mount end

type Options added in v1.53.0

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
}

Options for creating the mount

var Opt Options

Opt contains options set by command line flags

func (*Options) SetVolumeName added in v1.56.0

func (o *Options) SetVolumeName(vol string)

SetVolumeName removes special characters from volume name if necessary

type UnmountFn added in v1.52.0

type UnmountFn func() error

UnmountFn is called to unmount the file system

Jump to

Keyboard shortcuts

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