[Libguestfs] [PATCH commit] options: Compile blocksize code conditionally.

Richard W.M. Jones rjones at redhat.com
Mon Feb 24 20:52:57 UTC 2020


Since the blocksize option was added since the minimum version of
libguestfs for virt-v2v, we need to make it conditional so that
virt-v2v can still be compiled with the older libguestfs.

This commit does the minimum fix to make it build.  It doesn't
conditionalize the --blocksize option altogether.  However I believe,
at least for virt-v2v, that is OK since the --blocksize option is not
used there.

Thanks: Pino Toscano
Fixes: commit c33e0036c70ce68d40df92e4a6c0423e136e005c
---
 options/options.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/options/options.c b/options/options.c
index 63221ea..abdcbae 100644
--- a/options/options.c
+++ b/options/options.c
@@ -140,10 +140,12 @@ add_drives_handle (guestfs_h *g, struct drv *drv, size_t drive_index)
         ad_optargs.bitmask |= GUESTFS_ADD_DRIVE_OPTS_DISCARD_BITMASK;
         ad_optargs.discard = drv->a.discard;
       }
+#ifdef GUESTFS_ADD_DRIVE_OPTS_BLOCKSIZE_BITMASK
       if (drv->a.blocksize) {
         ad_optargs.bitmask |= GUESTFS_ADD_DRIVE_OPTS_BLOCKSIZE_BITMASK;
         ad_optargs.blocksize = drv->a.blocksize;
       }
+#endif
 
       r = guestfs_add_drive_opts_argv (g, drv->a.filename, &ad_optargs);
       if (r == -1)
@@ -177,10 +179,12 @@ add_drives_handle (guestfs_h *g, struct drv *drv, size_t drive_index)
         ad_optargs.bitmask |= GUESTFS_ADD_DRIVE_OPTS_SECRET_BITMASK;
         ad_optargs.secret = drv->uri.password;
       }
+#ifdef GUESTFS_ADD_DRIVE_OPTS_BLOCKSIZE_BITMASK
       if (drv->uri.blocksize) {
         ad_optargs.bitmask |= GUESTFS_ADD_DRIVE_OPTS_BLOCKSIZE_BITMASK;
         ad_optargs.blocksize = drv->uri.blocksize;
       }
+#endif
 
       r = guestfs_add_drive_opts_argv (g, drv->uri.path, &ad_optargs);
       if (r == -1)
-- 
2.24.1




More information about the Libguestfs mailing list