btrfs: information for the information gods

Signed-off-by: Vincent Batts <vbatts@redhat.com>
This commit is contained in:
Vincent Batts 2014-11-06 15:04:10 -05:00
parent 68a25a5b74
commit 318b11f62f
3 changed files with 32 additions and 1 deletions

View file

@ -60,7 +60,10 @@ func (d *Driver) String() string {
}
func (d *Driver) Status() [][2]string {
return nil
return [][2]string{
{"Build Version", BtrfsBuildVersion()},
{"Library Version", fmt.Sprintf("%d", BtrfsLibVersion())},
}
}
func (d *Driver) Cleanup() error {

View file

@ -0,0 +1,15 @@
// +build linux
package btrfs
/*
#include <btrfs/version.h>
*/
import "C"
func BtrfsBuildVersion() string {
return string(C.BTRFS_BUILD_VERSION)
}
func BtrfsLibVersion() int {
return int(C.BTRFS_LIB_VERSION)
}

View file

@ -0,0 +1,13 @@
// +build linux
package btrfs
import (
"testing"
)
func TestBuildVersion(t *testing.T) {
if len(BtrfsBuildVersion()) == 0 {
t.Errorf("expected output from btrfs build version, but got empty string")
}
}