1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

btrfs: build tag to enable showing version info

be default it is on, with build tags to disable the version info

Signed-off-by: Vincent Batts <vbatts@redhat.com>
This commit is contained in:
Vincent Batts 2014-11-06 15:56:13 -05:00 committed by Vincent Batts
parent 318b11f62f
commit 25154682a5
4 changed files with 36 additions and 4 deletions

View file

@ -60,10 +60,14 @@ func (d *Driver) String() string {
}
func (d *Driver) Status() [][2]string {
return [][2]string{
{"Build Version", BtrfsBuildVersion()},
{"Library Version", fmt.Sprintf("%d", BtrfsLibVersion())},
status := [][2]string{}
if bv := BtrfsBuildVersion(); bv != "-" {
status = append(status, [2]string{"Build Version", bv})
}
if lv := BtrfsLibVersion(); lv != -1 {
status = append(status, [2]string{"Library Version", fmt.Sprintf("%d", lv)})
}
return status
}
func (d *Driver) Cleanup() error {

View file

@ -1,9 +1,18 @@
// +build linux
// +build linux,!btrfs_noversion
package btrfs
/*
#include <btrfs/version.h>
// because around version 3.16, they did not define lib version yet
int my_btrfs_lib_version() {
#ifdef BTRFS_LIB_VERSION
return BTRFS_LIB_VERSION;
#else
return -1;
#endif
}
*/
import "C"

View file

@ -0,0 +1,13 @@
// +build linux,btrfs_noversion
package btrfs
// TODO(vbatts) remove this work-around once supported linux distros are on
// btrfs utililties of >= 3.16.1
func BtrfsBuildVersion() string {
return "-"
}
func BtrfsLibVersion() int {
return -1
}

View file

@ -162,6 +162,12 @@ SELinux, you will need to use the `selinux` build tag:
export DOCKER_BUILDTAGS='selinux'
```
If your version of btrfs-progs is < 3.16.1 (also called btrfs-tools), then you
will need the following tag to not check for btrfs version headers:
```bash
export DOCKER_BUILDTAGS='btrfs_noversion'
```
There are build tags for disabling graphdrivers as well. By default, support
for all graphdrivers are built in.