graphdriver/btrfs: drop version information

This is actually quite meaningless as we are reporting the libbtrfs
version, but we do not use libbtrfs. We only use the kernel interface to
btrfs instead.

While we could report the version of the kernel headers in play, they're
rather all-or-nothing: they provide the structures and defines we need,
or they don't. As such, drop all version information as the host kernel
version is the only thing that matters.

Signed-off-by: Bjorn Neergaard <bneergaard@mirantis.com>
(cherry picked from commit 1449c82484)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Bjorn Neergaard 2023-01-06 09:47:37 -07:00 committed by Sebastiaan van Stijn
parent 01883e1177
commit 42e7a15a63
No known key found for this signature in database
GPG key ID: 76698F39D527CE8C
3 changed files with 3 additions and 51 deletions

View file

@ -150,18 +150,11 @@ func (d *Driver) String() string {
return "btrfs"
}
// Status returns current driver information in a two dimensional string array.
// Output contains "Build Version" and "Library Version" of the btrfs libraries used.
// Version information can be used to check compatibility with your kernel.
// Status returns the status of the driver.
func (d *Driver) Status() [][2]string {
status := [][2]string{}
if bv := btrfsBuildVersion(); bv != "-" {
status = append(status, [2]string{"Build Version", bv})
return [][2]string{
{"Btrfs", ""},
}
if lv := btrfsLibVersion(); lv != -1 {
status = append(status, [2]string{"Library Version", strconv.Itoa(lv)})
}
return status
}
// GetMetadata returns empty metadata for this driver.

View file

@ -1,27 +0,0 @@
//go:build linux
// +build linux
package btrfs // import "github.com/docker/docker/daemon/graphdriver/btrfs"
/*
#include <btrfs/version.h>
// 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

@ -1,14 +0,0 @@
//go:build linux
// +build linux
package btrfs // import "github.com/docker/docker/daemon/graphdriver/btrfs"
import (
"testing"
)
func TestLibVersion(t *testing.T) {
if btrfsLibVersion() <= 0 {
t.Error("expected output from btrfs lib version > 0")
}
}