From 18683db8a6d9195cdb17832ee9429d1c53784d32 Mon Sep 17 00:00:00 2001 From: Jarek Kowalski Date: Sun, 25 Sep 2016 10:17:13 -0700 Subject: [PATCH] added --trace-fs to 'kopia mount' --- cmd/kopia/command_mount.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/cmd/kopia/command_mount.go b/cmd/kopia/command_mount.go index f8fb3a79a..158042740 100644 --- a/cmd/kopia/command_mount.go +++ b/cmd/kopia/command_mount.go @@ -5,6 +5,8 @@ import ( "bazil.org/fuse" fusefs "bazil.org/fuse/fs" + "github.com/kopia/kopia/fs" + "github.com/kopia/kopia/fs/loggingfs" "github.com/kopia/kopia/fs/repofs" kopiafuse "github.com/kopia/kopia/fuse" @@ -16,6 +18,7 @@ mountObjectID = mountCommand.Arg("path", "Identifier of the directory to mount.").Required().String() mountPoint = mountCommand.Arg("mountPoint", "Mount point").Required().ExistingDir() + mountTraceFS = mountCommand.Flag("trace-fs", "Trace filesystem operations").Bool() ) type root struct { @@ -42,7 +45,12 @@ func runMountCommand(context *kingpin.ParseContext) error { return err } - rootNode := kopiafuse.NewDirectoryNode(repofs.Directory(conn.Repository, oid)) + entry := repofs.Directory(conn.Repository, oid) + if *mountTraceFS { + entry = loggingfs.Wrap(entry).(fs.Directory) + } + + rootNode := kopiafuse.NewDirectoryNode(entry) fusefs.Serve(fuseConnection, &root{rootNode})