Virt-bmap constructs a mapping of disk block -> file for a disk image.
-It requires libguestfs >= 1.29.10, nbdkit >= 1.1, Boost, and pod2man.
+It requires libguestfs >= 1.29.11, nbdkit >= 1.1, Boost, and pod2man.
`configure' will check the requirements.
Discussion, patches, etc. on the virt-tools mailing list:
resources when it runs.])])
dnl Check new enough libguestfs.
-PKG_CHECK_MODULES([GUESTFS], [libguestfs >= 1.28])
+PKG_CHECK_MODULES([GUESTFS], [libguestfs >= 1.29.11])
dnl We need some new APIs which were added specifically for virt-bmap:
AC_CHECK_LIB([guestfs], [guestfs_blockdev_setra], [], [
- AC_MSG_ERROR([you need libguestfs >= 1.29.10 which has `guestfs_blockdev_setra'])
-])
-AC_CHECK_LIB([guestfs], [guestfs_bmap], [], [
- AC_MSG_ERROR([you need libguestfs >= 1.29.10 which has `guestfs_bmap'])
+ AC_MSG_ERROR([you need libguestfs >= 1.29.11 which has new APIs for virt-bmap])
])
dnl Check nbdkit is installed.
{
CLEANUP_FREE_STRING_LIST char **parts = NULL;
size_t i;
- int r;
+ const char *argv[2];
+ char *r;
/* Get partitions. */
parts = guestfs_list_partitions (g);
for (i = 0; parts[i] != NULL; ++i) {
CLEANUP_FREE char *object = NULL;
-
printf ("virt-bmap: examining %s ...\n", parts[i]);
count_partitions++;
if (asprintf (&object, "p %s", parts[i]) == -1)
return -1;
- if (guestfs_bmap_device (g, parts[i]) == -1)
+ argv[0] = parts[i];
+ argv[1] = NULL;
+ r = guestfs_debug (g, "bmap_device", (char **) argv);
+ if (r == NULL)
return -1;
+ free (r);
mark_start (object);
- r = guestfs_bmap (g);
+ argv[0] = NULL;
+ r = guestfs_debug (g, "bmap", (char **) argv);
mark_end ();
- if (r == -1) return -1;
+ if (r == NULL)
+ return -1;
+ free (r);
}
return 0;
{
CLEANUP_FREE_STRING_LIST char **lvs = NULL;
size_t i;
- int r;
+ const char *argv[2];
+ char *r;
/* Get LVs. */
lvs = guestfs_lvs (g);
if (asprintf (&object, "l %s", lvs[i]) == -1)
return -1;
- if (guestfs_bmap_device (g, lvs[i]) == -1)
+ argv[0] = lvs[i];
+ argv[1] = NULL;
+ r = guestfs_debug (g, "bmap_device", (char **) argv);
+ if (r == NULL)
return -1;
+ free (r);
mark_start (object);
- r = guestfs_bmap (g);
+ argv[0] = NULL;
+ r = guestfs_debug (g, "bmap", (char **) argv);
mark_end ();
- if (r == -1) return -1;
+ if (r == NULL)
+ return -1;
+ free (r);
}
return 0;
guestfs_h *g = context->g;
char type = '?';
CLEANUP_FREE char *path = NULL, *object = NULL;
- int r;
+ const char *argv[2];
+ char *r;
context->files_processed++;
if ((context->files_processed & 255) == 0) {
if (type == 'f') { /* regular file */
count_regular++;
bmap_file:
- if (guestfs_bmap_file (g, path) == -1)
+ argv[0] = path;
+ argv[1] = NULL;
+ r = guestfs_debug (g, "bmap_file", (char **) argv);
+ if (r == NULL)
return -1;
+ free (r);
mark_start (object);
- r = guestfs_bmap (g);
+ argv[0] = NULL;
+ r = guestfs_debug (g, "bmap", (char **) argv);
mark_end ();
- if (r == -1) return -1;
+ if (r == NULL)
+ return -1;
+ free (r);
}
else if (type == 'd') { /* directory */
count_directory++;