| 1 | // FUSE mount capabilities. go-fuse only builds on linux, darwin, and freebsd. |
| 2 | //go:build (linux || darwin || freebsd) && !nofuse |
| 3 | |
| 4 | package mount |
| 5 | |
| 6 | import "github.com/hanwen/go-fuse/v2/fuse" |
| 7 | |
| 8 | // WritableMountCapabilities are FUSE capabilities requested for writable |
| 9 | // mounts (/ipns, /mfs). |
| 10 | // |
| 11 | // CAP_ATOMIC_O_TRUNC tells the kernel to pass O_TRUNC to Open instead of |
| 12 | // sending a separate SETATTR(size=0) before Open. Without this, the kernel |
| 13 | // does SETATTR first, which requires opening a write descriptor inside |
| 14 | // Setattr. MFS only allows one write descriptor at a time, so that |
| 15 | // deadlocks. With this capability, O_TRUNC is handled inside Open where |
| 16 | // we already hold the descriptor. |
| 17 | const WritableMountCapabilities = fuse.CAP_ATOMIC_O_TRUNC |