Date: Thu, 16 Jun 2016 02:52:59 +0000 From: Taylor R Campbell <campbell+netbsd-tech-k...@mumble.net>
By a quick skim of cgddump and dk_dump, it looks likely that the missing part is a definition for cgddkdriver.d_dumpblocks. Here's a candidate definition that you might try, attached. (Not tested, not even compile-tested, caveat lector, &c.) Slightly simpler version attached -- device_private is not device_lookup; device_private never fails. (If the device_lookup in cgddump failed, we wouldn't have gotten to cgd_dumpblocks anyway.)
static int cgd_dumpblocks(device_t dev, void *va, daddr_t blkno, int nblk) { struct cgd_softc *sc = device_private(dev); struct dk_softc *dksc = &sc->sc_dksc; struct disk_geom *dg = &dksc->sc_dkdev.dk_geom; struct disklabel *lp = dksc->sc_dkdev.dk_label; size_t nbytes; void *buf; int error; /* * Compute the number of bytes in this request, which dk_dump * has `helpfully' converted to a number of blocks for us. */ nbytes = nblk*lp->d_secsize; /* Try to acquire a buffer to store the ciphertext. */ buf = cgd_getdata(dksc, nbytes); if (buf == NULL) /* Out of memory: give up. */ return ENOMEM; /* Encrypt the caller's data into the temporary buffer. */ cgd_cipher(sc, buf, va, nbytes, blkno, dg->dg_secsize, CGD_CIPHER_ENCRYPT); /* Pass it on to the underlying disk device. */ error = bdev_dump(sc->sc_tdev, blkno, buf, nbytes); /* Release the buffer. */ cgd_putdata(dksc, buf); /* Return any error from the underlying disk device. */ return error; }