FreeBSD/sys/geom/eli/g_eli_privacy.c
/*
 * The function is called after we read and decrypt data.
 *
 * g_eli_start -> g_eli_crypto_read -> g_io_request -> g_eli_read_done -> g_eli_crypto_run -> G_ELI_CRYPTO_READ_DONE -> g_io_deliver
 */
The function is called after we read and decrypt data.
The function is called after we read and decrypt data .
static int
g_eli_crypto_read_done(struct cryptop *crp)
{
	struct g_eli_softc *sc;
	struct bio *bp;
	if (crp->crp_etype == EAGAIN) {
		if (g_eli_crypto_rerun(crp) == 0)
			return (0);
	}
	bp = (struct bio *)crp->crp_opaque;
	bp->bio_inbed++;
	if (crp->crp_etype == 0) {
		G_ELI_DEBUG(3, "Crypto READ request done (%d/%d).",
		    bp->bio_inbed, bp->bio_children);
		bp->bio_completed += crp->crp_olen;
	} else {
		G_ELI_DEBUG(1, "Crypto READ request failed (%d/%d) error=%d.",
		    bp->bio_inbed, bp->bio_children, crp->crp_etype);
		if (bp->bio_error == 0)
			bp->bio_error = crp->crp_etype;
	}
	sc = bp->bio_to->geom->softc;
	g_eli_key_drop(sc, crp->crp_desc->crd_key);
	if (bp->bio_inbed < bp->bio_children)
		return (0);
	free(bp->bio_driver2, M_ELI);
	bp->bio_driver2 = NULL;
	if (bp->bio_error != 0) {
		G_ELI_LOGREQ(0, bp, "Crypto READ request failed (error=%d).",
		    bp->bio_error);
		bp->bio_completed = 0;
	}
	g_io_deliver(bp, bp->bio_error);
	atomic_subtract_int(&sc->sc_inflight, 1);
	return (0);
}
static int g_eli_crypto_read_done ( struct cryptop * crp ) { struct g_eli_softc * sc ; struct bio * bp ; if ( crp -> crp_etype == EAGAIN ) { if ( g_eli_crypto_rerun ( crp ) == 0 ) return ( 0 ) ; } bp = ( struct bio * ) crp -> crp_opaque ; bp -> bio_inbed ++ ; if ( crp -> crp_etype == 0 ) { G_ELI_DEBUG ( 3 , " " , bp -> bio_inbed , bp -> bio_children ) ; bp -> bio_completed += crp -> crp_olen ; } else { G_ELI_DEBUG ( 1 , " " , bp -> bio_inbed , bp -> bio_children , crp -> crp_etype ) ; if ( bp -> bio_error == 0 ) bp -> bio_error = crp -> crp_etype ; } sc = bp -> bio_to -> geom -> softc ; g_eli_key_drop ( sc , crp -> crp_desc -> crd_key ) ; if ( bp -> bio_inbed < bp -> bio_children ) return ( 0 ) ; free ( bp -> bio_driver2 , M_ELI ) ; bp -> bio_driver2 = NULL ; if ( bp -> bio_error != 0 ) { G_ELI_LOGREQ ( 0 , bp , " " , bp -> bio_error ) ; bp -> bio_completed = 0 ; } g_io_deliver ( bp , bp -> bio_error ) ; atomic_subtract_int ( & sc -> sc_inflight , 1 ) ; return ( 0 ) ; }
The function is called after we read and decrypt data.
The function is called after we read and decrypt data .
/*
	 * Do we have all sectors already?
	 */ /*
	 * Read is finished, send it up.
	 */