 urq = &lun->urq; memset(urq, 0, sizeof(struct ub_request)); 
unsigned int block, nblks; 
static int ub_cmd_build_block(struct ub_dev *sc, struct ub_lun *lun,    struct ub_scsi_cmd *cmd, struct request *rq){	struct ub_request *urq;	int ub_dir;	int n_elem;	urq = &lun->urq;	memset(urq, 0, sizeof(struct ub_request));	if (rq_data_dir(rq) == WRITE)		ub_dir = UB_DIR_WRITE;	else		ub_dir = UB_DIR_READ;	/*	 * get scatterlist from block layer	 */	n_elem = blk_rq_map_sg(lun->disk->queue, rq, &urq->sgv[0]);	if (n_elem <= 0) {		printk(KERN_INFO "%s: failed request map (%d)\n",		    sc->name, n_elem); /* P3 */		return -1;		/* request with no s/g entries? */	}	if (n_elem > UB_MAX_REQ_SG) {	/* Paranoia */		printk(KERN_WARNING "%s: request with %d segments\n",		    sc->name, n_elem);		return -1;	}	urq->nsg = n_elem;	sc->sg_stat[n_elem]++;	/*	 * build the command	 *	 * The call to blk_queue_hardsect_size() guarantees that request	 * is aligned, but it is given in terms of 512 byte units, always.	 */	urq->current_block = rq->sector >> lun->capacity.bshift;	// nblks = rq->nr_sectors >> lun->capacity.bshift;	urq->rq = rq;	urq->current_sg = 0;	urq->dir = ub_dir;	ub_scsi_build_block(lun, cmd, urq);	return 0;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/a1cf96efbabac2f8af6f75286ffcefd40b0a466c/ub.c/buggy/drivers/block/ub.c