@@ -970,6 +970,8 @@ static int check_pfn_create(struct ndctl_region *region,
static int check_btt_size(struct ndctl_btt *btt)
{
+ struct ndctl_ctx *ctx = ndctl_btt_get_ctx(btt);
+ struct ndctl_test *test = ndctl_get_private_data(ctx);
struct ndctl_namespace *ndns = ndctl_btt_get_namespace(btt);
unsigned long long ns_size = ndctl_namespace_get_size(ndns);
unsigned long sect_size = ndctl_btt_get_sector_size(btt);
@@ -1018,6 +1020,10 @@ static int check_btt_size(struct ndctl_btt *btt)
return -ENXIO;
}
+ /* prior to 4.8 btt devices did not have a size attribute */
+ if (!ndctl_test_attempt(test, KERNEL_VERSION(4, 8, 0)))
+ return 0;
+
expect = expect_table[size_select][sect_select];
actual = ndctl_btt_get_size(btt);
if (expect != actual) {
This support went into the kernel with commit abe8b4e3cef8 "nvdimm, btt: add a size attribute for BTTs" Signed-off-by: Dan Williams <dan.j.williams@intel.com> --- test/libndctl.c | 6 ++++++ 1 file changed, 6 insertions(+)