mirror of
https://github.com/kemko/nomad.git
synced 2026-01-05 18:05:42 +03:00
Fixes #2552 Not needed when hardlinking. Only adds Linux support but other OS's may be easy.
32 lines
666 B
Go
32 lines
666 B
Go
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 {
|
|
return os.MkdirAll(dir, 0777)
|
|
}
|
|
|
|
// removeSecretDir removes the secrets dir folder
|
|
func removeSecretDir(dir string) error {
|
|
return os.RemoveAll(dir)
|
|
}
|
|
|
|
// getOwner isn't implemented for Darwin
|
|
func getOwner(os.FileInfo) (int, int) {
|
|
return -1, -1
|
|
}
|