Lines Matching refs:hdr
217 struct sg_io_hdr *hdr, fmode_t mode) in blk_fill_sghdr_rq() argument
221 if (copy_from_user(req->cmd, hdr->cmdp, hdr->cmd_len)) in blk_fill_sghdr_rq()
229 req->cmd_len = hdr->cmd_len; in blk_fill_sghdr_rq()
231 rq->timeout = msecs_to_jiffies(hdr->timeout); in blk_fill_sghdr_rq()
242 static int blk_complete_sghdr_rq(struct request *rq, struct sg_io_hdr *hdr, in blk_complete_sghdr_rq() argument
251 hdr->status = req->result & 0xff; in blk_complete_sghdr_rq()
252 hdr->masked_status = status_byte(req->result); in blk_complete_sghdr_rq()
253 hdr->msg_status = msg_byte(req->result); in blk_complete_sghdr_rq()
254 hdr->host_status = host_byte(req->result); in blk_complete_sghdr_rq()
255 hdr->driver_status = driver_byte(req->result); in blk_complete_sghdr_rq()
256 hdr->info = 0; in blk_complete_sghdr_rq()
257 if (hdr->masked_status || hdr->host_status || hdr->driver_status) in blk_complete_sghdr_rq()
258 hdr->info |= SG_INFO_CHECK; in blk_complete_sghdr_rq()
259 hdr->resid = req->resid_len; in blk_complete_sghdr_rq()
260 hdr->sb_len_wr = 0; in blk_complete_sghdr_rq()
262 if (req->sense_len && hdr->sbp) { in blk_complete_sghdr_rq()
263 int len = min((unsigned int) hdr->mx_sb_len, req->sense_len); in blk_complete_sghdr_rq()
265 if (!copy_to_user(hdr->sbp, req->sense, len)) in blk_complete_sghdr_rq()
266 hdr->sb_len_wr = len; in blk_complete_sghdr_rq()
279 struct sg_io_hdr *hdr, fmode_t mode) in sg_io() argument
289 if (hdr->interface_id != 'S') in sg_io()
292 if (hdr->dxfer_len > (queue_max_hw_sectors(q) << 9)) in sg_io()
295 if (hdr->dxfer_len) in sg_io()
296 switch (hdr->dxfer_direction) { in sg_io()
306 if (hdr->flags & SG_FLAG_Q_AT_HEAD) in sg_io()
315 if (hdr->cmd_len > BLK_MAX_CDB) { in sg_io()
316 req->cmd = kzalloc(hdr->cmd_len, GFP_KERNEL); in sg_io()
321 ret = blk_fill_sghdr_rq(q, rq, hdr, mode); in sg_io()
326 if (hdr->iovec_count) { in sg_io()
331 hdr->dxferp, hdr->iovec_count, in sg_io()
337 iov_iter_truncate(&i, hdr->dxfer_len); in sg_io()
341 } else if (hdr->dxfer_len) in sg_io()
342 ret = blk_rq_map_user(q, rq, NULL, hdr->dxferp, hdr->dxfer_len, in sg_io()
359 hdr->duration = jiffies_to_msecs(jiffies - start_time); in sg_io()
361 ret = blk_complete_sghdr_rq(rq, hdr, bio); in sg_io()
582 struct sg_io_hdr hdr; in scsi_cmd_ioctl() local
585 if (copy_from_user(&hdr, arg, sizeof(hdr))) in scsi_cmd_ioctl()
587 err = sg_io(q, bd_disk, &hdr, mode); in scsi_cmd_ioctl()
591 if (copy_to_user(arg, &hdr, sizeof(hdr))) in scsi_cmd_ioctl()
597 struct sg_io_hdr hdr; in scsi_cmd_ioctl() local
603 memset(&hdr, 0, sizeof(hdr)); in scsi_cmd_ioctl()
604 hdr.interface_id = 'S'; in scsi_cmd_ioctl()
605 hdr.cmd_len = sizeof(cgc.cmd); in scsi_cmd_ioctl()
606 hdr.dxfer_len = cgc.buflen; in scsi_cmd_ioctl()
610 hdr.dxfer_direction = SG_DXFER_UNKNOWN; in scsi_cmd_ioctl()
613 hdr.dxfer_direction = SG_DXFER_TO_DEV; in scsi_cmd_ioctl()
616 hdr.dxfer_direction = SG_DXFER_FROM_DEV; in scsi_cmd_ioctl()
619 hdr.dxfer_direction = SG_DXFER_NONE; in scsi_cmd_ioctl()
627 hdr.dxferp = cgc.buffer; in scsi_cmd_ioctl()
628 hdr.sbp = cgc.sense; in scsi_cmd_ioctl()
629 if (hdr.sbp) in scsi_cmd_ioctl()
630 hdr.mx_sb_len = sizeof(struct request_sense); in scsi_cmd_ioctl()
631 hdr.timeout = jiffies_to_msecs(cgc.timeout); in scsi_cmd_ioctl()
632 hdr.cmdp = ((struct cdrom_generic_command __user*) arg)->cmd; in scsi_cmd_ioctl()
633 hdr.cmd_len = sizeof(cgc.cmd); in scsi_cmd_ioctl()
635 err = sg_io(q, bd_disk, &hdr, mode); in scsi_cmd_ioctl()
639 if (hdr.status) in scsi_cmd_ioctl()
643 cgc.buflen = hdr.resid; in scsi_cmd_ioctl()