Commit 17c7e2cd authored by Jakob Unterwurzacher's avatar Jakob Unterwurzacher

loopback: show original directory in "df"

Filesystems usually show the underlying device in the first
column of df. Follow suite and show the original dir, making
"df" and "mount" output more useful.

The actual reason for this change, however, is that it facilitates
running xfstests against go-fuse loopback. The xfstests machinery
checks that the expected device is mounted at the right place.

Commit https://github.com/rfjakob/fuse-xfstests/commit/182841fea487419f493d9b547bf703bee9e39322
adds support for go-fuse loopback to xfstests and depends on this
change.

Before:

  $ df -T
  Filesystem                 Type           1K-blocks       Used Available Use% Mounted on
  loopback                   fuse.loopback  237371192  149885928  75357828  67% /home/jakob/go/src/github.com/hanwen/go-fuse/example/loopback/b

After:

  $ df -T
  Filesystem                 Type           1K-blocks       Used Available Use% Mounted on
  a                          fuse.loopback  237371192  150332024  74911732  67% /home/jakob/go/src/github.com/hanwen/go-fuse/example/loopback/b

Change-Id: I3d5a2e7ab021af4eed657e66654b636e08292219
parent 8c10cb4e
...@@ -89,6 +89,8 @@ func main() { ...@@ -89,6 +89,8 @@ func main() {
} }
opts.Debug = *debug opts.Debug = *debug
opts.AllowOther = *other opts.AllowOther = *other
// First column in "df -T": original dir
opts.MountOptions.Options = append(opts.MountOptions.Options, "fsname="+orig)
// Second column in "df -T" will be shown as "fuse." + Name // Second column in "df -T" will be shown as "fuse." + Name
opts.MountOptions.Name = "loopback" opts.MountOptions.Name = "loopback"
server, err := fs.Mount(flag.Arg(0), loopbackRoot, opts) server, err := fs.Mount(flag.Arg(0), loopbackRoot, opts)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment