| 1 | // FUSE filesystem for the /mfs mount. |
| 2 | // |
| 3 | //go:build (linux || darwin || freebsd) && !nofuse |
| 4 | |
| 5 | package mfs |
| 6 | |
| 7 | import ( |
| 8 | "github.com/ipfs/kubo/config" |
| 9 | "github.com/ipfs/kubo/core" |
| 10 | fusemnt "github.com/ipfs/kubo/fuse/mount" |
| 11 | "github.com/ipfs/kubo/fuse/writable" |
| 12 | ) |
| 13 | |
| 14 | // NewFileSystem creates a new MFS FUSE root node. |
| 15 | func NewFileSystem(ipfs *core.IpfsNode, mounts config.Mounts, imp config.Import) *writable.Dir { |
| 16 | return writable.NewDir(ipfs.FilesRoot.GetDirectory(), &writable.Config{ |
| 17 | StoreMtime: mounts.StoreMtime.WithDefault(config.DefaultStoreMtime), |
| 18 | StoreMode: mounts.StoreMode.WithDefault(config.DefaultStoreMode), |
| 19 | DAG: ipfs.DAG, |
| 20 | RepoPath: ipfs.Repo.Path(), |
| 21 | Blksize: fusemnt.BlksizeFromChunker(imp.UnixFSChunker.WithDefault(config.DefaultUnixFSChunker)), |
| 22 | }) |
| 23 | } |