From 1755ffd1f3e1cf31ff2ce1b934f8e61c8d26a517 Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Thu, 3 May 2018 09:15:32 +0100 Subject: [PATCH] mount: make Get/List/Set/Remove xattr return ENOSYS #2287 By default bazil fuse will return ENOTSUPP for these. However if we return ENOSYS then OSXFUSE (at least) will never call them again saving round trips though fuse. --- cmd/mount/file.go | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/cmd/mount/file.go b/cmd/mount/file.go index 29fbbed02..d03d52d0b 100644 --- a/cmd/mount/file.go +++ b/cmd/mount/file.go @@ -92,3 +92,37 @@ func (f *File) Fsync(ctx context.Context, req *fuse.FsyncRequest) (err error) { defer log.Trace(f, "")("err=%v", &err) return nil } + +// Getxattr gets an extended attribute by the given name from the +// node. +// +// If there is no xattr by that name, returns fuse.ErrNoXattr. +func (f *File) Getxattr(ctx context.Context, req *fuse.GetxattrRequest, resp *fuse.GetxattrResponse) error { + return fuse.ENOSYS // we never implement this +} + +var _ fusefs.NodeGetxattrer = (*File)(nil) + +// Listxattr lists the extended attributes recorded for the node. +func (f *File) Listxattr(ctx context.Context, req *fuse.ListxattrRequest, resp *fuse.ListxattrResponse) error { + return fuse.ENOSYS // we never implement this +} + +var _ fusefs.NodeListxattrer = (*File)(nil) + +// Setxattr sets an extended attribute with the given name and +// value for the node. +func (f *File) Setxattr(ctx context.Context, req *fuse.SetxattrRequest) error { + return fuse.ENOSYS // we never implement this +} + +var _ fusefs.NodeSetxattrer = (*File)(nil) + +// Removexattr removes an extended attribute for the name. +// +// If there is no xattr by that name, returns fuse.ErrNoXattr. +func (f *File) Removexattr(ctx context.Context, req *fuse.RemovexattrRequest) error { + return fuse.ENOSYS // we never implement this +} + +var _ fusefs.NodeRemovexattrer = (*File)(nil)