From 86891054ef2a5d1b0b59c7c140aae284e7c5bd87 Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Mon, 11 Nov 2024 22:27:42 +0100 Subject: Report inode number for the root node Now that https://github.com/hanwen/go-fuse/issues/399 has landed we can report an inode number for the root node. Fixes https://github.com/rfjakob/gocryptfs/issues/580 --- mount.go | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'mount.go') diff --git a/mount.go b/mount.go index 61079a9..0eaa3dd 100644 --- a/mount.go +++ b/mount.go @@ -351,6 +351,10 @@ func initFuseFrontend(args *argContainer) (rootNode fs.InodeEmbedder, wipeKeys f return rootNode, func() { cCore.Wipe() } } +type RootInoer interface { + RootIno() uint64 +} + // initGoFuse calls into go-fuse to mount `rootNode` on `args.mountpoint`. // The mountpoint is ready to use when the functions returns. // On error, it calls os.Exit and does not return. @@ -375,6 +379,9 @@ func initGoFuse(rootNode fs.InodeEmbedder, args *argContainer) *fuse.Server { } } fuseOpts.NullPermissions = true + // The inode number for the root node must be manually set on mount + // https://github.com/hanwen/go-fuse/issues/399 + fuseOpts.RootStableAttr = &fs.StableAttr{Ino: rootNode.(RootInoer).RootIno()} // Enable go-fuse warnings fuseOpts.Logger = log.New(os.Stderr, "go-fuse: ", log.Lmicroseconds) fuseOpts.MountOptions = fuse.MountOptions{ -- cgit v1.2.3