1
0
mirror of https://github.com/docker/cli.git synced 2026-01-15 07:40:57 +03:00

Merge pull request #11753 from vbatts/vbatts-btrfs_ifdef_build_version

btrfs: #ifdef for build version
Upstream-commit: e6e2893fa3557684b70e0d79ba2699f499c964ea
Component: engine
This commit is contained in:
Jessie Frazelle
2015-03-25 11:25:49 -07:00
3 changed files with 19 additions and 7 deletions

View File

@@ -61,6 +61,9 @@ func (d *Driver) String() string {
func (d *Driver) Status() [][2]string {
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)})
}

View File

@@ -5,17 +5,22 @@ 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;
// around version 3.16, they did not define lib version yet
#ifndef BTRFS_LIB_VERSION
#define BTRFS_LIB_VERSION -1
#endif
// upstream had removed it, but now it will be coming back
#ifndef BTRFS_BUILD_VERSION
#define BTRFS_BUILD_VERSION "-"
#endif
}
*/
import "C"
func BtrfsBuildVersion() string {
return string(C.BTRFS_BUILD_VERSION)
}
func BtrfsLibVersion() int {
return int(C.BTRFS_LIB_VERSION)
}

View File

@@ -5,6 +5,10 @@ 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
}