forked from TrueCloudLab/rclone
mount: add VFS and Mount options to mount/listmounts
This commit is contained in:
parent
3c1c6d2f01
commit
6ff5787b40
1 changed files with 8 additions and 3 deletions
|
@ -11,6 +11,7 @@ import (
|
||||||
"github.com/rclone/rclone/fs"
|
"github.com/rclone/rclone/fs"
|
||||||
"github.com/rclone/rclone/fs/rc"
|
"github.com/rclone/rclone/fs/rc"
|
||||||
"github.com/rclone/rclone/vfs"
|
"github.com/rclone/rclone/vfs"
|
||||||
|
"github.com/rclone/rclone/vfs/vfscommon"
|
||||||
"github.com/rclone/rclone/vfs/vfsflags"
|
"github.com/rclone/rclone/vfs/vfsflags"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -20,6 +21,8 @@ type MountInfo struct {
|
||||||
MountPoint string `json:"MountPoint"`
|
MountPoint string `json:"MountPoint"`
|
||||||
MountedOn time.Time `json:"MountedOn"`
|
MountedOn time.Time `json:"MountedOn"`
|
||||||
Fs string `json:"Fs"`
|
Fs string `json:"Fs"`
|
||||||
|
MountOpt *Options
|
||||||
|
VFSOpt *vfscommon.Options
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -85,8 +88,8 @@ func mountRc(_ context.Context, in rc.Params) (out rc.Params, err error) {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
opt := Opt
|
mountOpt := Opt
|
||||||
err = in.GetStructMissingOK("mountOpt", &opt)
|
err = in.GetStructMissingOK("mountOpt", &mountOpt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -114,7 +117,7 @@ func mountRc(_ context.Context, in rc.Params) (out rc.Params, err error) {
|
||||||
|
|
||||||
if mountFns[mountType] != nil {
|
if mountFns[mountType] != nil {
|
||||||
VFS := vfs.New(fdst, &vfsOpt)
|
VFS := vfs.New(fdst, &vfsOpt)
|
||||||
_, unmountFn, err := mountFns[mountType](VFS, mountPoint, &opt)
|
_, unmountFn, err := mountFns[mountType](VFS, mountPoint, &mountOpt)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("mount FAILED: %v", err)
|
log.Printf("mount FAILED: %v", err)
|
||||||
|
@ -126,6 +129,8 @@ func mountRc(_ context.Context, in rc.Params) (out rc.Params, err error) {
|
||||||
MountedOn: time.Now(),
|
MountedOn: time.Now(),
|
||||||
Fs: fdst.Name(),
|
Fs: fdst.Name(),
|
||||||
MountPoint: mountPoint,
|
MountPoint: mountPoint,
|
||||||
|
VFSOpt: &vfsOpt,
|
||||||
|
MountOpt: &mountOpt,
|
||||||
}
|
}
|
||||||
|
|
||||||
fs.Debugf(nil, "Mount for %s created at %s using %s", fdst.String(), mountPoint, mountType)
|
fs.Debugf(nil, "Mount for %s created at %s using %s", fdst.String(), mountPoint, mountType)
|
||||||
|
|
Loading…
Reference in a new issue