| 1 | //go:build darwin && !nofuse |
| 2 | |
| 3 | package mount |
| 4 | |
| 5 | import "github.com/hanwen/go-fuse/v2/fuse" |
| 6 | |
| 7 | // PlatformMountOpts applies macOS-specific FUSE mount options. |
| 8 | func PlatformMountOpts(opts *fuse.MountOptions) { |
| 9 | // volname: Finder shows this instead of the generic "macfuse Volume 0". |
| 10 | if opts.FsName != "" { |
| 11 | opts.Options = append(opts.Options, "volname="+opts.FsName) |
| 12 | } |
| 13 | |
| 14 | // noapplexattr: prevents Finder from probing com.apple.FinderInfo, |
| 15 | // com.apple.ResourceFork, and other Apple-private xattrs on every |
| 16 | // file access. Without this, each stat triggers multiple Getxattr |
| 17 | // calls that all return ENOATTR, adding latency on network-backed |
| 18 | // mounts. |
| 19 | opts.Options = append(opts.Options, "noapplexattr") |
| 20 | |
| 21 | // noappledouble: prevents macOS from creating ._ resource fork |
| 22 | // sidecar files when copying or editing files on the mount. These |
| 23 | // AppleDouble files pollute the DAG with metadata that only macOS |
| 24 | // understands and inflate the CID tree. |
| 25 | opts.Options = append(opts.Options, "noappledouble") |
| 26 | } |