2015-09-23 04:56:29 +00:00
|
|
|
package allocdir
|
|
|
|
|
|
|
|
import (
|
|
|
|
"os"
|
|
|
|
"syscall"
|
|
|
|
)
|
|
|
|
|
|
|
|
// Bind mounts the shared directory into the task directory. Must be root to
|
|
|
|
// run.
|
|
|
|
func (d *AllocDir) mountSharedDir(taskDir string) error {
|
2015-11-10 22:12:30 +00:00
|
|
|
if err := os.MkdirAll(taskDir, 0777); err != nil {
|
2015-09-23 04:56:29 +00:00
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2015-09-25 23:49:14 +00:00
|
|
|
return syscall.Mount(d.SharedDir, taskDir, "", syscall.MS_BIND, "")
|
|
|
|
}
|
|
|
|
|
|
|
|
func (d *AllocDir) unmountSharedDir(dir string) error {
|
|
|
|
return syscall.Unmount(dir, 0)
|
2015-09-23 04:56:29 +00:00
|
|
|
}
|