From a697d274556b40affa2c9c37791c7ef064441557 Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Tue, 25 Jun 2024 10:19:25 +0100 Subject: [PATCH] serve nfs: store billy FS in the Handler --- cmd/serve/nfs/handler.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/cmd/serve/nfs/handler.go b/cmd/serve/nfs/handler.go index c89b0c7cb..bd5cf04a8 100644 --- a/cmd/serve/nfs/handler.go +++ b/cmd/serve/nfs/handler.go @@ -18,8 +18,9 @@ import ( // NewHandler creates a handler for the provided filesystem func NewHandler(vfs *vfs.VFS, opt *Options) nfs.Handler { handler := &Handler{ - vfs: vfs, - opt: opt, + vfs: vfs, + opt: opt, + billyFS: &FS{vfs: vfs}, } handler.opt.HandleLimit = handler.opt.Limit() handler.cache = cacheHelper(handler, handler.HandleLimit()) @@ -28,17 +29,16 @@ func NewHandler(vfs *vfs.VFS, opt *Options) nfs.Handler { // Handler returns a NFS backing that exposes a given file system in response to all mount requests. type Handler struct { - vfs *vfs.VFS - opt *Options - cache nfs.Handler + vfs *vfs.VFS + opt *Options + billyFS *FS + cache nfs.Handler } // Mount backs Mount RPC Requests, allowing for access control policies. func (h *Handler) Mount(ctx context.Context, conn net.Conn, req nfs.MountRequest) (status nfs.MountStatus, hndl billy.Filesystem, auths []nfs.AuthFlavor) { - status = nfs.MountStatusOk - hndl = &FS{vfs: h.vfs} auths = []nfs.AuthFlavor{nfs.AuthFlavorNull} - return + return nfs.MountStatusOk, h.billyFS, auths } // Change provides an interface for updating file attributes.