static struct cbuf *
ld_ataraid_make_cbuf(struct ld_ataraid_softc *sc, struct buf *bp,
    u_int comp, daddr_t bn, void *addr, long bcount)
{
	struct cbuf *cbp;

	cbp = CBUF_GET();
	if (cbp == NULL)
		return (NULL);
	buf_init(&cbp->cb_buf);
	cbp->cb_buf.b_flags = bp->b_flags;
	cbp->cb_buf.b_oflags = bp->b_oflags;
	cbp->cb_buf.b_cflags = bp->b_cflags;
	cbp->cb_buf.b_iodone = sc->sc_iodone;
	cbp->cb_buf.b_proc = bp->b_proc;
	cbp->cb_buf.b_vp = sc->sc_vnodes[comp];
	cbp->cb_buf.b_objlock = &sc->sc_vnodes[comp]->v_interlock;
	cbp->cb_buf.b_blkno = bn + sc->sc_aai->aai_offset;
	cbp->cb_buf.b_data = addr;
	cbp->cb_buf.b_bcount = bcount;

	/* Context for iodone */
	cbp->cb_obp = bp;
	cbp->cb_sc = sc;
	cbp->cb_comp = comp;
	cbp->cb_other = NULL;
	cbp->cb_flags = 0;

	return (cbp);
}
Exemple #2
0
bool poll_event(android_event_t* event) {
    if(CBUF_IS_EMPTY(event_buf)) return false;
    android_event_t ev = CBUF_GET(event_buf, android_event_t);
    memcpy(event, &ev, sizeof(android_event_t));
    return true;
}
Exemple #3
0
void user_input_destroy(void) {
    while(!CBUF_IS_EMPTY(event_buf)) {
        CBUF_GET(event_buf, android_event_t);
    }
}