From 126f00882b34e69b229f3b1df61206e24fff8e16 Mon Sep 17 00:00:00 2001 From: Filipe Azevedo Date: Wed, 17 Aug 2022 00:33:58 +0200 Subject: [PATCH] vfs: Add VFS --links command line switch This will be used to enable links support for the various mount engines in a follow up commit. --- vfs/vfs.go | 5 +++++ vfs/vfscommon/options.go | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/vfs/vfs.go b/vfs/vfs.go index 245aaa03f..2e60c8fb6 100644 --- a/vfs/vfs.go +++ b/vfs/vfs.go @@ -242,6 +242,11 @@ func New(f fs.Fs, opt *vfscommon.Options) *VFS { fs.Logf(f, "--vfs-cache-mode writes or full is recommended for this remote as it can't stream") } + // Warn if we handle symlinks + if vfs.Opt.Links { + fs.Logf(f, "Symlinks support enabled") + } + // Pin the Fs into the cache so that when we use cache.NewFs // with the same remote string we get this one. The Pin is // removed when the vfs is finalized diff --git a/vfs/vfscommon/options.go b/vfs/vfscommon/options.go index 591ce5044..f6061c88e 100644 --- a/vfs/vfscommon/options.go +++ b/vfs/vfscommon/options.go @@ -44,6 +44,12 @@ var OptionsInfo = fs.Options{{ Default: false, Help: "Only allow read-only access", Groups: "VFS", +}, { + Name: "links", + Default: false, + Help: "Translate symlinks to/from regular files with a '" + fs.LinkSuffix + "' extension", + Groups: "VFS", + ShortOpt: "l", }, { Name: "vfs_cache_mode", Default: CacheModeOff, @@ -165,6 +171,7 @@ type Options struct { NoSeek bool `config:"no_seek"` // don't allow seeking if set NoChecksum bool `config:"no_checksum"` // don't check checksums if set ReadOnly bool `config:"read_only"` // if set VFS is read only + Links bool `config:"links"` // if set interpret link files NoModTime bool `config:"no_modtime"` // don't read mod times for files DirCacheTime fs.Duration `config:"dir_cache_time"` // how long to consider directory listing cache valid Refresh bool `config:"vfs_refresh"` // refreshes the directory listing recursively on start