Lines Matching refs:hdr

231 			     struct sg_io_hdr *hdr, fmode_t mode)  in blk_fill_sghdr_rq()  argument
235 if (copy_from_user(req->cmd, hdr->cmdp, hdr->cmd_len)) in blk_fill_sghdr_rq()
243 req->cmd_len = hdr->cmd_len; in blk_fill_sghdr_rq()
245 rq->timeout = msecs_to_jiffies(hdr->timeout); in blk_fill_sghdr_rq()
256 static int blk_complete_sghdr_rq(struct request *rq, struct sg_io_hdr *hdr, in blk_complete_sghdr_rq() argument
265 hdr->status = req->result & 0xff; in blk_complete_sghdr_rq()
266 hdr->masked_status = status_byte(req->result); in blk_complete_sghdr_rq()
267 hdr->msg_status = msg_byte(req->result); in blk_complete_sghdr_rq()
268 hdr->host_status = host_byte(req->result); in blk_complete_sghdr_rq()
269 hdr->driver_status = driver_byte(req->result); in blk_complete_sghdr_rq()
270 hdr->info = 0; in blk_complete_sghdr_rq()
271 if (hdr->masked_status || hdr->host_status || hdr->driver_status) in blk_complete_sghdr_rq()
272 hdr->info |= SG_INFO_CHECK; in blk_complete_sghdr_rq()
273 hdr->resid = req->resid_len; in blk_complete_sghdr_rq()
274 hdr->sb_len_wr = 0; in blk_complete_sghdr_rq()
276 if (req->sense_len && hdr->sbp) { in blk_complete_sghdr_rq()
277 int len = min((unsigned int) hdr->mx_sb_len, req->sense_len); in blk_complete_sghdr_rq()
279 if (!copy_to_user(hdr->sbp, req->sense, len)) in blk_complete_sghdr_rq()
280 hdr->sb_len_wr = len; in blk_complete_sghdr_rq()
293 struct sg_io_hdr *hdr, fmode_t mode) in sg_io() argument
303 if (hdr->interface_id != 'S') in sg_io()
306 if (hdr->dxfer_len > (queue_max_hw_sectors(q) << 9)) in sg_io()
309 if (hdr->dxfer_len) in sg_io()
310 switch (hdr->dxfer_direction) { in sg_io()
320 if (hdr->flags & SG_FLAG_Q_AT_HEAD) in sg_io()
329 if (hdr->cmd_len > BLK_MAX_CDB) { in sg_io()
330 req->cmd = kzalloc(hdr->cmd_len, GFP_KERNEL); in sg_io()
335 ret = blk_fill_sghdr_rq(q, rq, hdr, mode); in sg_io()
340 if (hdr->iovec_count) { in sg_io()
345 hdr->dxferp, hdr->iovec_count, in sg_io()
351 iov_iter_truncate(&i, hdr->dxfer_len); in sg_io()
355 } else if (hdr->dxfer_len) in sg_io()
356 ret = blk_rq_map_user(q, rq, NULL, hdr->dxferp, hdr->dxfer_len, in sg_io()
373 hdr->duration = jiffies_to_msecs(jiffies - start_time); in sg_io()
375 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()