Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 10e8855b authored by FUJITA Tomonori's avatar FUJITA Tomonori Committed by Jens Axboe
Browse files

bsg: add SG_IO to SG v4



This adds SG_IO support to SG v4.

Signed-off-by: default avatarFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Signed-off-by: default avatarJens Axboe <jens.axboe@oracle.com>
parent 70e36ece
Loading
Loading
Loading
Loading
+21 −2
Original line number Original line Diff line number Diff line
@@ -945,8 +945,27 @@ bsg_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
		void __user *uarg = (void __user *) arg;
		void __user *uarg = (void __user *) arg;
		return scsi_cmd_ioctl(file, bd->disk, cmd, uarg);
		return scsi_cmd_ioctl(file, bd->disk, cmd, uarg);
	}
	}
	case SG_IO:
	case SG_IO: {
		return -EINVAL;
		struct request *rq;
		struct bio *bio;
		struct sg_io_v4 hdr;

		if (copy_from_user(&hdr, uarg, sizeof(hdr)))
			return -EFAULT;

		rq = bsg_map_hdr(bd, &hdr);
		if (IS_ERR(rq))
			return PTR_ERR(rq);

		bio = rq->bio;
		blk_execute_rq(bd->queue, bd->disk, rq, 0);
		blk_complete_sgv4_hdr_rq(rq, &hdr, bio);

		if (copy_to_user(uarg, &hdr, sizeof(hdr)))
			return -EFAULT;
		else
			return 0;
	}
	/*
	/*
	 * block device ioctls
	 * block device ioctls
	 */
	 */