-
Notifications
You must be signed in to change notification settings - Fork 50
/
vfs.go
44 lines (35 loc) · 995 Bytes
/
vfs.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package vfs
import (
"path"
"github.com/akutz/gofig"
"github.com/emccode/libstorage/api/types"
)
const (
// Name is the name of the driver.
Name = "vfs"
)
func init() {
registerConfig()
}
func registerConfig() {
defaultRootDir := types.Lib.Join("vfs")
r := gofig.NewRegistration("VFS")
r.Key(gofig.String, "", defaultRootDir, "", "vfs.root")
gofig.Register(r)
}
// RootDir returns the path to the VFS root directory.
func RootDir(config gofig.Config) string {
return config.GetString("vfs.root")
}
// DeviceFilePath returns the path to the VFS devices file.
func DeviceFilePath(config gofig.Config) string {
return path.Join(RootDir(config), "dev")
}
// VolumesDirPath returns the path to the VFS volumes directory.
func VolumesDirPath(config gofig.Config) string {
return path.Join(RootDir(config), "vol")
}
// SnapshotsDirPath returns the path to the VFS volumes directory.
func SnapshotsDirPath(config gofig.Config) string {
return path.Join(RootDir(config), "snap")
}