Mount shared alloc dir, modified API and tests

This commit is contained in:
Alex Dadgar
2015-09-22 21:56:29 -07:00
parent aba801d68e
commit 9caa7ac077
12 changed files with 244 additions and 238 deletions

View File

@@ -0,0 +1,18 @@
package allocdir
import (
"os"
"path/filepath"
"syscall"
)
// Bind mounts the shared directory into the task directory. Must be root to
// run.
func (d *AllocDir) mountSharedDir(taskDir string) error {
taskLoc := filepath.Join(taskDir, SharedAllocName)
if err := os.Mkdir(taskLoc, 0777); err != nil {
return err
}
return syscall.Mount(d.SharedDir, taskLoc, "", syscall.MS_BIND, "")
}