2017-03-09 18:49:14 +00:00
|
|
|
package allocdir
|
|
|
|
|
|
|
|
import (
|
|
|
|
"os"
|
|
|
|
"syscall"
|
|
|
|
)
|
|
|
|
|
|
|
|
// linkDir hardlinks src to dst. The src and dst must be on the same filesystem.
|
|
|
|
func linkDir(src, dst string) error {
|
|
|
|
return syscall.Link(src, dst)
|
|
|
|
}
|
|
|
|
|
|
|
|
// unlinkDir removes a directory link.
|
|
|
|
func unlinkDir(dir string) error {
|
|
|
|
return syscall.Unlink(dir)
|
|
|
|
}
|
|
|
|
|
|
|
|
// createSecretDir creates the secrets dir folder at the given path
|
|
|
|
func createSecretDir(dir string) error {
|
2017-03-11 21:56:19 +00:00
|
|
|
// TODO solaris has support for tmpfs so use that
|
2017-03-09 18:49:14 +00:00
|
|
|
return os.MkdirAll(dir, 0777)
|
|
|
|
}
|
|
|
|
|
|
|
|
// removeSecretDir removes the secrets dir folder
|
|
|
|
func removeSecretDir(dir string) error {
|
|
|
|
return os.RemoveAll(dir)
|
|
|
|
}
|