-
Notifications
You must be signed in to change notification settings - Fork 235
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
types: create simpler ScanPriorDrivers for options
Signed-off-by: Aditya R <arajan@redhat.com>
- Loading branch information
Showing
8 changed files
with
111 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package fsutils | ||
|
||
import ( | ||
"path/filepath" | ||
"os" | ||
) | ||
|
||
|
||
var Drivers = []string{ | ||
"overlay", | ||
"aufs", | ||
"btrfs", | ||
"zfs", | ||
"vfs", | ||
} | ||
|
||
// scanPriorDrivers returns an un-ordered scan of directories of prior storage drivers | ||
func ScanPriorDrivers(root string) map[string]bool { | ||
driversMap := make(map[string]bool) | ||
|
||
for _, driver := range Drivers { | ||
p := filepath.Join(root, driver) | ||
if _, err := os.Stat(p); err == nil { | ||
driversMap[driver] = true | ||
} | ||
} | ||
return driversMap | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
//go:build darwin | ||
// +build darwin | ||
|
||
package fsutils | ||
|
||
|
||
var ( | ||
// Slice of drivers that should be used in an order | ||
DriverPriority = []string{ | ||
"zfs", | ||
"vfs", | ||
} | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
//go:build freebsd | ||
// +build freebsd | ||
|
||
package fsutils | ||
|
||
|
||
var ( | ||
// Slice of drivers that should be used in an order | ||
DriverPriority = []string{ | ||
"zfs", | ||
"vfs", | ||
} | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
//go:build linux | ||
// +build linux | ||
|
||
package fsutils | ||
|
||
|
||
var ( | ||
// Slice of drivers that should be used in an order | ||
DriverPriority = []string{ | ||
"overlay", | ||
// We don't support devicemapper without configuration | ||
// "devicemapper", | ||
"aufs", | ||
"btrfs", | ||
"zfs", | ||
"vfs", | ||
} | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
//go:build solaris && cgo | ||
// +build solaris,cgo | ||
|
||
package fsutils | ||
|
||
|
||
var ( | ||
// Slice of drivers that should be used in an order | ||
DriverPriority = []string{ | ||
"zfs", | ||
} | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
//go:build !linux && !windows && !freebsd && !solaris && !darwin | ||
// +build !linux,!windows,!freebsd,!solaris,!darwin | ||
|
||
package fsutils | ||
|
||
var ( | ||
// Slice of drivers that should be used in an order | ||
DriverPriority = []string{ | ||
"unsupported", | ||
} | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
//go:build windows | ||
// +build windows | ||
|
||
package fsutils | ||
|
||
|
||
var ( | ||
// Slice of drivers that should be used in an order | ||
DriverPriority = []string{ | ||
"windowsfilter", | ||
} | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters