Lines Matching refs:bp
129 struct bio *bp; in g_eli_auth_read_done() local
135 bp = (struct bio *)crp->crp_opaque; in g_eli_auth_read_done()
136 bp->bio_inbed++; in g_eli_auth_read_done()
137 sc = bp->bio_to->geom->softc; in g_eli_auth_read_done()
139 bp->bio_completed += crp->crp_payload_length; in g_eli_auth_read_done()
141 bp->bio_inbed, bp->bio_children, crp->crp_payload_length, (intmax_t)bp->bio_completed); in g_eli_auth_read_done()
147 decr_secsize = bp->bio_to->sectorsize; in g_eli_auth_read_done()
152 nsec = bp->bio_length / decr_secsize; in g_eli_auth_read_done()
157 (char *)bp->bio_driver2) / encr_secsize; in g_eli_auth_read_done()
159 errorp = (int *)((char *)bp->bio_driver2 + encr_secsize * nsec + in g_eli_auth_read_done()
164 bp->bio_inbed, bp->bio_children, crp->crp_etype); in g_eli_auth_read_done()
165 if (bp->bio_error == 0 || bp->bio_error == EINTEGRITY) in g_eli_auth_read_done()
166 bp->bio_error = crp->crp_etype == EBADMSG ? in g_eli_auth_read_done()
175 if (bp->bio_inbed < bp->bio_children) in g_eli_auth_read_done()
178 if (bp->bio_error == 0) { in g_eli_auth_read_done()
183 decr_secsize = bp->bio_to->sectorsize; in g_eli_auth_read_done()
189 nsec = bp->bio_length / decr_secsize; in g_eli_auth_read_done()
195 srcdata = bp->bio_driver2; in g_eli_auth_read_done()
196 dstdata = bp->bio_data; in g_eli_auth_read_done()
206 } else if (bp->bio_error == EINTEGRITY) { in g_eli_auth_read_done()
212 decr_secsize = bp->bio_to->sectorsize; in g_eli_auth_read_done()
218 nsec = bp->bio_length / decr_secsize; in g_eli_auth_read_done()
224 errorp = (int *)((char *)bp->bio_driver2 + encr_secsize * nsec); in g_eli_auth_read_done()
227 dstoff = bp->bio_offset; in g_eli_auth_read_done()
265 g_eli_free_data(bp); in g_eli_auth_read_done()
266 if (bp->bio_error != 0) { in g_eli_auth_read_done()
267 if (bp->bio_error != EINTEGRITY) { in g_eli_auth_read_done()
268 G_ELI_LOGREQ(0, bp, in g_eli_auth_read_done()
270 bp->bio_error); in g_eli_auth_read_done()
272 bp->bio_completed = 0; in g_eli_auth_read_done()
277 g_io_deliver(bp, bp->bio_error); in g_eli_auth_read_done()
292 struct bio *bp, *cbp, *cbp2; in g_eli_auth_write_done() local
299 bp = (struct bio *)crp->crp_opaque; in g_eli_auth_write_done()
300 bp->bio_inbed++; in g_eli_auth_write_done()
303 bp->bio_inbed, bp->bio_children); in g_eli_auth_write_done()
306 bp->bio_inbed, bp->bio_children, crp->crp_etype); in g_eli_auth_write_done()
307 if (bp->bio_error == 0) in g_eli_auth_write_done()
308 bp->bio_error = crp->crp_etype; in g_eli_auth_write_done()
310 sc = bp->bio_to->geom->softc; in g_eli_auth_write_done()
317 if (bp->bio_inbed < bp->bio_children) in g_eli_auth_write_done()
319 if (bp->bio_error != 0) { in g_eli_auth_write_done()
320 G_ELI_LOGREQ(0, bp, "Crypto WRITE request failed (error=%d).", in g_eli_auth_write_done()
321 bp->bio_error); in g_eli_auth_write_done()
322 g_eli_free_data(bp); in g_eli_auth_write_done()
323 cbp = bp->bio_driver1; in g_eli_auth_write_done()
324 bp->bio_driver1 = NULL; in g_eli_auth_write_done()
326 g_io_deliver(bp, bp->bio_error); in g_eli_auth_write_done()
331 cbp = bp->bio_driver1; in g_eli_auth_write_done()
332 bp->bio_driver1 = NULL; in g_eli_auth_write_done()
337 nsec = bp->bio_length / bp->bio_to->sectorsize; in g_eli_auth_write_done()
342 cbp->bio_offset = (bp->bio_offset / bp->bio_to->sectorsize) * sc->sc_bytes_per_sector; in g_eli_auth_write_done()
343 cbp->bio_data = bp->bio_driver2; in g_eli_auth_write_done()
351 cbp2 = g_duplicate_bio(bp); in g_eli_auth_write_done()
363 bp->bio_inbed = 0; in g_eli_auth_write_done()
364 bp->bio_children = (cbp2 != NULL ? 2 : 1); in g_eli_auth_write_done()
374 g_eli_auth_read(struct g_eli_softc *sc, struct bio *bp) in g_eli_auth_read() argument
381 G_ELI_SETWORKER(bp->bio_pflags, 0); in g_eli_auth_read()
384 cbp = bp->bio_driver1; in g_eli_auth_read()
385 bp->bio_driver1 = NULL; in g_eli_auth_read()
390 nsec = bp->bio_length / bp->bio_to->sectorsize; in g_eli_auth_read()
398 cbp->bio_offset = (bp->bio_offset / bp->bio_to->sectorsize) * sc->sc_bytes_per_sector; in g_eli_auth_read()
399 if (!g_eli_alloc_data(bp, size)) { in g_eli_auth_read()
400 G_ELI_LOGREQ(0, bp, "Crypto auth read request failed (ENOMEM)"); in g_eli_auth_read()
402 bp->bio_error = ENOMEM; in g_eli_auth_read()
403 g_io_deliver(bp, bp->bio_error); in g_eli_auth_read()
407 cbp->bio_data = bp->bio_driver2; in g_eli_auth_read()
410 memset((char *)bp->bio_driver2 + cbp->bio_length, 0, in g_eli_auth_read()
419 cbp2 = g_duplicate_bio(bp); in g_eli_auth_read()
448 g_eli_auth_run(struct g_eli_worker *wr, struct bio *bp) in g_eli_auth_run() argument
459 G_ELI_LOGREQ(3, bp, "%s", __func__); in g_eli_auth_run()
461 G_ELI_SETWORKER(bp->bio_pflags, wr->w_number); in g_eli_auth_run()
464 decr_secsize = bp->bio_to->sectorsize; in g_eli_auth_run()
470 nsec = bp->bio_length / decr_secsize; in g_eli_auth_run()
476 dstoff = (bp->bio_offset / bp->bio_to->sectorsize) * sc->sc_bytes_per_sector; in g_eli_auth_run()
478 plaindata = bp->bio_data; in g_eli_auth_run()
479 if (bp->bio_cmd == BIO_READ) { in g_eli_auth_run()
480 data = bp->bio_driver2; in g_eli_auth_run()
489 if (!g_eli_alloc_data(bp, size)) { in g_eli_auth_run()
490 G_ELI_LOGREQ(0, bp, "Crypto request failed (ENOMEM)"); in g_eli_auth_run()
491 if (bp->bio_driver1 != NULL) { in g_eli_auth_run()
492 g_destroy_bio(bp->bio_driver1); in g_eli_auth_run()
493 bp->bio_driver1 = NULL; in g_eli_auth_run()
495 bp->bio_error = ENOMEM; in g_eli_auth_run()
496 g_io_deliver(bp, bp->bio_error); in g_eli_auth_run()
501 data = bp->bio_driver2; in g_eli_auth_run()
504 bp->bio_inbed = 0; in g_eli_auth_run()
505 bp->bio_children = nsec; in g_eli_auth_run()
525 if (bp->bio_cmd == BIO_WRITE) in g_eli_auth_run()
536 if (bp->bio_cmd == BIO_WRITE) in g_eli_auth_run()
541 if (bp->bio_cmd == BIO_WRITE) { in g_eli_auth_run()
547 crp->crp_opaque = (void *)bp; in g_eli_auth_run()
550 if (bp->bio_cmd == BIO_WRITE) { in g_eli_auth_run()