FreeBSD/sys/geom/vinum/geom_vinum_plex.c
/*
 * Create an initialization BIO and send it off to the consumer. Assume that
 * we're given initialization data as parameter.
 */
Create an initialization BIO and send it off to the consumer. Assume that
we're given initialization data as parameter.
Create an initialization BIO and send it off to the consumer . Assume that we ' re given initialization data as parameter .
void
gv_init_request(struct gv_sd *s, off_t start, caddr_t data, off_t length)
{
	struct gv_drive *d;
	struct g_consumer *cp;
	struct bio *bp, *cbp;
	KASSERT(s != NULL, ("gv_init_request: NULL s"));
	d = s->drive_sc;
	KASSERT(d != NULL, ("gv_init_request: NULL d"));
	cp = d->consumer;
	KASSERT(cp != NULL, ("gv_init_request: NULL cp"));
	bp = g_new_bio();
	if (bp == NULL) {
		G_VINUM_DEBUG(0, "subdisk '%s' init: write failed at offset %jd"
		    " (drive offset %jd); out of memory", s->name,
		    (intmax_t)s->initialized, (intmax_t)start);
		return; 
	}
	bp->bio_cmd = BIO_WRITE;
	bp->bio_data = data;
	bp->bio_done = gv_done;
	bp->bio_error = 0;
	bp->bio_length = length;
	bp->bio_pflags |= GV_BIO_INIT;
	bp->bio_offset = start;
	bp->bio_caller1 = s;
	cbp = g_clone_bio(bp);
	if (cbp == NULL) {
		G_VINUM_DEBUG(0, "subdisk '%s' init: write failed at offset %jd"
		    " (drive offset %jd); out of memory", s->name,
		    (intmax_t)s->initialized, (intmax_t)start);
		return; 
	}
	cbp->bio_done = gv_done;
	cbp->bio_caller1 = s;
	g_io_request(cbp, cp);
}
void gv_init_request ( struct gv_sd * s , off_t start , caddr_t data , off_t length ) { struct gv_drive * d ; struct g_consumer * cp ; struct bio * bp , * cbp ; KASSERT ( s != NULL , ( " " ) ) ; d = s -> drive_sc ; KASSERT ( d != NULL , ( " " ) ) ; cp = d -> consumer ; KASSERT ( cp != NULL , ( " " ) ) ; bp = g_new_bio ( ) ; if ( bp == NULL ) { G_VINUM_DEBUG ( 0 , " " " " , s -> name , ( intmax_t ) s -> initialized , ( intmax_t ) start ) ; return ; } bp -> bio_cmd = BIO_WRITE ; bp -> bio_data = data ; bp -> bio_done = gv_done ; bp -> bio_error = 0 ; bp -> bio_length = length ; bp -> bio_pflags |= GV_BIO_INIT ; bp -> bio_offset = start ; bp -> bio_caller1 = s ; cbp = g_clone_bio ( bp ) ; if ( cbp == NULL ) { G_VINUM_DEBUG ( 0 , " " " " , s -> name , ( intmax_t ) s -> initialized , ( intmax_t ) start ) ; return ; } cbp -> bio_done = gv_done ; cbp -> bio_caller1 = s ; g_io_request ( cbp , cp ) ; }
Create an initialization BIO and send it off to the consumer.
Create an initialization BIO and send it off to the consumer .
/* XXX: Error codes. */ /* Then ofcourse, we have to clone it. */ /* XXX: Error codes. */ /* Send it off to the consumer. */