30 lines
675 B
Go
30 lines
675 B
Go
//go:build windows || darwin || freebsd || netbsd || openbsd
|
|
|
|
package overlayfs
|
|
|
|
// Use fuse to emulate overlayfs
|
|
import (
|
|
"os"
|
|
|
|
"sirherobrine23.com.br/Sirherobrine23/cgofuse/fs"
|
|
)
|
|
|
|
type internalType = fs.FileSystemMount[*os.File, fs.FileSystem[*os.File]]
|
|
|
|
// Unmount overlayfs fuse
|
|
func (overlay *Overlayfs) Unmount() (err error) {
|
|
if overlay.ProcessInternal != nil {
|
|
return overlay.ProcessInternal.Unmount()
|
|
}
|
|
return
|
|
}
|
|
|
|
// Attempt mount overlayfs with fuse
|
|
func (overlay *Overlayfs) Mount() (err error) {
|
|
if overlay.ProcessInternal != nil {
|
|
return ErrMounted
|
|
}
|
|
overlay.ProcessInternal = fs.New(overlay.Target, overlay)
|
|
return overlay.ProcessInternal.Mount()
|
|
}
|