Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ type Handler interface {

Mount(context.Context, net.Conn, MountRequest) (MountStatus, billy.Filesystem, []AuthFlavor)

Unmount(_ context.Context, _ net.Conn, dirpath []byte) error

// Change can return 'nil' if filesystem is read-only
Change(billy.Filesystem) billy.Change

Expand Down
7 changes: 6 additions & 1 deletion helpers/nullauthhandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ func (h *NullAuthHandler) Mount(ctx context.Context, conn net.Conn, req nfs.Moun
return
}

// Unmount indicates the client connection has terminated.
func (h *NullAuthHandler) Unmount(ctx context.Context, conn net.Conn, dirpath []byte) error {
return nil
}

// Change provides an interface for updating file attributes.
func (h *NullAuthHandler) Change(fs billy.Filesystem) billy.Change {
if c, ok := h.fs.(billy.Change); ok {
Expand All @@ -49,7 +54,7 @@ func (h *NullAuthHandler) FromHandle([]byte) (billy.Filesystem, []string, error)
return nil, []string{}, nil
}

// HandleLImit handled by cachingHandler
// HandleLimit is handled by cachingHandler
func (h *NullAuthHandler) HandleLimit() int {
return -1
}
6 changes: 5 additions & 1 deletion mount.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,14 @@ func onMount(ctx context.Context, w *response, userHandle Handler) error {
}

func onUMount(ctx context.Context, w *response, userHandle Handler) error {
_, err := xdr.ReadOpaque(w.req.Body)
dirpath, err := xdr.ReadOpaque(w.req.Body)
if err != nil {
return err
}

if err := userHandle.Unmount(ctx, w.conn, dirpath); err != nil {
return err
}

return w.writeHeader(ResponseCodeSuccess)
}