archiecobbs / s3backer

FUSE/NBD single file backing store via Amazon S3
Other
538 stars 77 forks source link

block_size callback prevents building on nbdkit older than 1.30.0 #226

Closed rbfnet closed 5 months ago

rbfnet commented 5 months ago

The addition of the NBD block_size callback to 2.1.3 prevents it from building against nbdkit libraries older than 1.30.0 (when that callback was added). Among other distributions, this blocks building on ubuntu focal and jammy, both of which are LTS and remain under support. (Relatively easy workaround is to remove the block_size callback change before building; harder workaround is to ugprade the nbdkit libraries to get it to build.)

Depending on the desired target audience, might be worthwhile to ifdef the blocksize callbacks based on nbdkit version number, The nbdkit headers provide version number macros:

#define NBDKIT_VERSION_MAJOR 1
#define NBDKIT_VERSION_MINOR 24
#define NBDKIT_VERSION_MICRO 1

On mine, I added (in nbdkit.c):

#define NBDKIT_VERSION_FULL ((NBDKIT_VERSION_MAJOR << 16) + (NBDKIT_VERSION_MINOR << 8) + NBDKIT_VERSION_MICRO)
#if NBDKIT_VERSION_FULL >= 0x013000
#define NBDKIT_BLOCKSIZE 1
#endif

and then wrapped the block_size callback structure initialization and callback function with: #ifdef NDBKIT_BLOCKSIZE

archiecobbs commented 5 months ago

Thanks - should be fixed in 1de6473.