Lines Matching refs:hdr
228 struct sg_io_hdr *hdr, fmode_t mode)
230 if (copy_from_user(rq->cmd, hdr->cmdp, hdr->cmd_len))
238 rq->cmd_len = hdr->cmd_len;
240 rq->timeout = msecs_to_jiffies(hdr->timeout);
251 static int blk_complete_sghdr_rq(struct request *rq, struct sg_io_hdr *hdr,
259 hdr->status = rq->errors & 0xff;
260 hdr->masked_status = status_byte(rq->errors);
261 hdr->msg_status = msg_byte(rq->errors);
262 hdr->host_status = host_byte(rq->errors);
263 hdr->driver_status = driver_byte(rq->errors);
264 hdr->info = 0;
265 if (hdr->masked_status || hdr->host_status || hdr->driver_status)
266 hdr->info |= SG_INFO_CHECK;
267 hdr->resid = rq->resid_len;
268 hdr->sb_len_wr = 0;
270 if (rq->sense_len && hdr->sbp) {
271 int len = min((unsigned int) hdr->mx_sb_len, rq->sense_len);
273 if (!copy_to_user(hdr->sbp, rq->sense, len))
274 hdr->sb_len_wr = len;
287 struct sg_io_hdr *hdr, fmode_t mode)
297 if (hdr->interface_id != 'S')
300 if (hdr->dxfer_len > (queue_max_hw_sectors(q) << 9))
303 if (hdr->dxfer_len)
304 switch (hdr->dxfer_direction) {
314 if (hdr->flags & SG_FLAG_Q_AT_HEAD)
323 if (hdr->cmd_len > BLK_MAX_CDB) {
324 rq->cmd = kzalloc(hdr->cmd_len, GFP_KERNEL);
330 if (blk_fill_sghdr_rq(q, rq, hdr, mode))
334 if (hdr->iovec_count) {
338 ret = rw_copy_check_uvector(-1, hdr->dxferp, hdr->iovec_count,
349 if (hdr->dxfer_len < iov_data_len) {
350 hdr->iovec_count = iov_shorten(iov,
351 hdr->iovec_count,
352 hdr->dxfer_len);
353 iov_data_len = hdr->dxfer_len;
357 hdr->iovec_count,
360 } else if (hdr->dxfer_len)
361 ret = blk_rq_map_user(q, rq, NULL, hdr->dxferp, hdr->dxfer_len,
381 hdr->duration = jiffies_to_msecs(jiffies - start_time);
383 ret = blk_complete_sghdr_rq(rq, hdr, bio);
607 struct sg_io_hdr hdr;
610 if (copy_from_user(&hdr, arg, sizeof(hdr)))
612 err = sg_io(q, bd_disk, &hdr, mode);
616 if (copy_to_user(arg, &hdr, sizeof(hdr)))
622 struct sg_io_hdr hdr;
628 memset(&hdr, 0, sizeof(hdr));
629 hdr.interface_id = 'S';
630 hdr.cmd_len = sizeof(cgc.cmd);
631 hdr.dxfer_len = cgc.buflen;
635 hdr.dxfer_direction = SG_DXFER_UNKNOWN;
638 hdr.dxfer_direction = SG_DXFER_TO_DEV;
641 hdr.dxfer_direction = SG_DXFER_FROM_DEV;
644 hdr.dxfer_direction = SG_DXFER_NONE;
652 hdr.dxferp = cgc.buffer;
653 hdr.sbp = cgc.sense;
654 if (hdr.sbp)
655 hdr.mx_sb_len = sizeof(struct request_sense);
656 hdr.timeout = jiffies_to_msecs(cgc.timeout);
657 hdr.cmdp = ((struct cdrom_generic_command __user*) arg)->cmd;
658 hdr.cmd_len = sizeof(cgc.cmd);
660 err = sg_io(q, bd_disk, &hdr, mode);
664 if (hdr.status)
668 cgc.buflen = hdr.resid;