Lines Matching refs:hdr
228 struct sg_io_hdr *hdr, fmode_t mode) in blk_fill_sghdr_rq() argument
230 if (copy_from_user(rq->cmd, hdr->cmdp, hdr->cmd_len)) in blk_fill_sghdr_rq()
238 rq->cmd_len = hdr->cmd_len; in blk_fill_sghdr_rq()
240 rq->timeout = msecs_to_jiffies(hdr->timeout); in blk_fill_sghdr_rq()
251 static int blk_complete_sghdr_rq(struct request *rq, struct sg_io_hdr *hdr, in blk_complete_sghdr_rq() argument
259 hdr->status = rq->errors & 0xff; in blk_complete_sghdr_rq()
260 hdr->masked_status = status_byte(rq->errors); in blk_complete_sghdr_rq()
261 hdr->msg_status = msg_byte(rq->errors); in blk_complete_sghdr_rq()
262 hdr->host_status = host_byte(rq->errors); in blk_complete_sghdr_rq()
263 hdr->driver_status = driver_byte(rq->errors); in blk_complete_sghdr_rq()
264 hdr->info = 0; in blk_complete_sghdr_rq()
265 if (hdr->masked_status || hdr->host_status || hdr->driver_status) in blk_complete_sghdr_rq()
266 hdr->info |= SG_INFO_CHECK; in blk_complete_sghdr_rq()
267 hdr->resid = rq->resid_len; in blk_complete_sghdr_rq()
268 hdr->sb_len_wr = 0; in blk_complete_sghdr_rq()
270 if (rq->sense_len && hdr->sbp) { in blk_complete_sghdr_rq()
271 int len = min((unsigned int) hdr->mx_sb_len, rq->sense_len); in blk_complete_sghdr_rq()
273 if (!copy_to_user(hdr->sbp, rq->sense, len)) in blk_complete_sghdr_rq()
274 hdr->sb_len_wr = len; in blk_complete_sghdr_rq()
287 struct sg_io_hdr *hdr, fmode_t mode) in sg_io() argument
297 if (hdr->interface_id != 'S') in sg_io()
300 if (hdr->dxfer_len > (queue_max_hw_sectors(q) << 9)) in sg_io()
303 if (hdr->dxfer_len) in sg_io()
304 switch (hdr->dxfer_direction) { in sg_io()
314 if (hdr->flags & SG_FLAG_Q_AT_HEAD) in sg_io()
323 if (hdr->cmd_len > BLK_MAX_CDB) { in sg_io()
324 rq->cmd = kzalloc(hdr->cmd_len, GFP_KERNEL); in sg_io()
329 ret = blk_fill_sghdr_rq(q, rq, hdr, mode); in sg_io()
334 if (hdr->iovec_count) { in sg_io()
339 hdr->dxferp, hdr->iovec_count, in sg_io()
345 iov_iter_truncate(&i, hdr->dxfer_len); in sg_io()
349 } else if (hdr->dxfer_len) in sg_io()
350 ret = blk_rq_map_user(q, rq, NULL, hdr->dxferp, hdr->dxfer_len, in sg_io()
370 hdr->duration = jiffies_to_msecs(jiffies - start_time); in sg_io()
372 ret = blk_complete_sghdr_rq(rq, hdr, bio); in sg_io()
596 struct sg_io_hdr hdr; in scsi_cmd_ioctl() local
599 if (copy_from_user(&hdr, arg, sizeof(hdr))) in scsi_cmd_ioctl()
601 err = sg_io(q, bd_disk, &hdr, mode); in scsi_cmd_ioctl()
605 if (copy_to_user(arg, &hdr, sizeof(hdr))) in scsi_cmd_ioctl()
611 struct sg_io_hdr hdr; in scsi_cmd_ioctl() local
617 memset(&hdr, 0, sizeof(hdr)); in scsi_cmd_ioctl()
618 hdr.interface_id = 'S'; in scsi_cmd_ioctl()
619 hdr.cmd_len = sizeof(cgc.cmd); in scsi_cmd_ioctl()
620 hdr.dxfer_len = cgc.buflen; in scsi_cmd_ioctl()
624 hdr.dxfer_direction = SG_DXFER_UNKNOWN; in scsi_cmd_ioctl()
627 hdr.dxfer_direction = SG_DXFER_TO_DEV; in scsi_cmd_ioctl()
630 hdr.dxfer_direction = SG_DXFER_FROM_DEV; in scsi_cmd_ioctl()
633 hdr.dxfer_direction = SG_DXFER_NONE; in scsi_cmd_ioctl()
641 hdr.dxferp = cgc.buffer; in scsi_cmd_ioctl()
642 hdr.sbp = cgc.sense; in scsi_cmd_ioctl()
643 if (hdr.sbp) in scsi_cmd_ioctl()
644 hdr.mx_sb_len = sizeof(struct request_sense); in scsi_cmd_ioctl()
645 hdr.timeout = jiffies_to_msecs(cgc.timeout); in scsi_cmd_ioctl()
646 hdr.cmdp = ((struct cdrom_generic_command __user*) arg)->cmd; in scsi_cmd_ioctl()
647 hdr.cmd_len = sizeof(cgc.cmd); in scsi_cmd_ioctl()
649 err = sg_io(q, bd_disk, &hdr, mode); in scsi_cmd_ioctl()
653 if (hdr.status) in scsi_cmd_ioctl()
657 cgc.buflen = hdr.resid; in scsi_cmd_ioctl()