btrfs: #ifdef for build version
We removed it, because upstream removed it. But now it will be coming back, so work with it either way. Signed-off-by: Vincent Batts <vbatts@redhat.com>
This commit is contained in:
parent
a0cfe83435
commit
b76e300b4c
|
@ -61,6 +61,9 @@ func (d *Driver) String() string {
|
||||||
|
|
||||||
func (d *Driver) Status() [][2]string {
|
func (d *Driver) Status() [][2]string {
|
||||||
status := [][2]string{}
|
status := [][2]string{}
|
||||||
|
if bv := BtrfsBuildVersion(); bv != "-" {
|
||||||
|
status = append(status, [2]string{"Build Version", bv})
|
||||||
|
}
|
||||||
if lv := BtrfsLibVersion(); lv != -1 {
|
if lv := BtrfsLibVersion(); lv != -1 {
|
||||||
status = append(status, [2]string{"Library Version", fmt.Sprintf("%d", lv)})
|
status = append(status, [2]string{"Library Version", fmt.Sprintf("%d", lv)})
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,17 +5,22 @@ package btrfs
|
||||||
/*
|
/*
|
||||||
#include <btrfs/version.h>
|
#include <btrfs/version.h>
|
||||||
|
|
||||||
// because around version 3.16, they did not define lib version yet
|
// around version 3.16, they did not define lib version yet
|
||||||
int my_btrfs_lib_version() {
|
#ifndef BTRFS_LIB_VERSION
|
||||||
#ifdef BTRFS_LIB_VERSION
|
#define BTRFS_LIB_VERSION -1
|
||||||
return BTRFS_LIB_VERSION;
|
#endif
|
||||||
#else
|
|
||||||
return -1;
|
// upstream had removed it, but now it will be coming back
|
||||||
|
#ifndef BTRFS_BUILD_VERSION
|
||||||
|
#define BTRFS_BUILD_VERSION "-"
|
||||||
#endif
|
#endif
|
||||||
}
|
|
||||||
*/
|
*/
|
||||||
import "C"
|
import "C"
|
||||||
|
|
||||||
|
func BtrfsBuildVersion() string {
|
||||||
|
return string(C.BTRFS_BUILD_VERSION)
|
||||||
|
}
|
||||||
|
|
||||||
func BtrfsLibVersion() int {
|
func BtrfsLibVersion() int {
|
||||||
return int(C.BTRFS_LIB_VERSION)
|
return int(C.BTRFS_LIB_VERSION)
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,10 @@ package btrfs
|
||||||
// TODO(vbatts) remove this work-around once supported linux distros are on
|
// TODO(vbatts) remove this work-around once supported linux distros are on
|
||||||
// btrfs utililties of >= 3.16.1
|
// btrfs utililties of >= 3.16.1
|
||||||
|
|
||||||
|
func BtrfsBuildVersion() string {
|
||||||
|
return "-"
|
||||||
|
}
|
||||||
|
|
||||||
func BtrfsLibVersion() int {
|
func BtrfsLibVersion() int {
|
||||||
return -1
|
return -1
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue