Skip to content

Commit

Permalink
btrfs: information for the information gods
Browse files Browse the repository at this point in the history
Signed-off-by: Vincent Batts <vbatts@redhat.com>
  • Loading branch information
vbatts committed Nov 6, 2014
1 parent 68a25a5 commit 318b11f
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 1 deletion.
5 changes: 4 additions & 1 deletion daemon/graphdriver/btrfs/btrfs.go
Expand Up @@ -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 {
Expand Down
15 changes: 15 additions & 0 deletions daemon/graphdriver/btrfs/version.go
@@ -0,0 +1,15 @@
// +build linux

package btrfs

/*
#include <btrfs/version.h>
*/
import "C"

func BtrfsBuildVersion() string {
return string(C.BTRFS_BUILD_VERSION)

This comment has been minimized.

Copy link
@lsm5

lsm5 Mar 15, 2015

Contributor

ping @vbatts, looks like the latest btrfs/version.h has gotten rid of BTRFS_BUILD_VERSION ... can't find it on rawhide (btrfs-progs-devel-3.19-1.fc23) but can find it on f21 (btrfs-progs-devel-3.18.1-1.fc21)

This comment has been minimized.

Copy link
@vbatts

vbatts via email Mar 15, 2015

Author Contributor

This comment has been minimized.

Copy link
@lsm5

lsm5 Mar 16, 2015

Contributor

this patch brings back BTRFS_BUILD_VERSION http://repo.or.cz/w/btrfs-progs-unstable/devel.git/commit/514c5689bd672b21fa8033a7a48eae56a6e36b7f . I'm guessing it will land in stable soon.

}
func BtrfsLibVersion() int {
return int(C.BTRFS_LIB_VERSION)
}
13 changes: 13 additions & 0 deletions daemon/graphdriver/btrfs/version_test.go
@@ -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")
}
}

0 comments on commit 318b11f

Please sign in to comment.