View | Details | Raw Unified | Return to bug 196343
Collapse All | Expand All

(-)a/block/bsg.c (-3 / +6 lines)
Lines 85-90 struct bsg_command { Link Here
85
	struct bio *bidi_bio;
85
	struct bio *bidi_bio;
86
	int err;
86
	int err;
87
	struct sg_io_v4 hdr;
87
	struct sg_io_v4 hdr;
88
	char sense[SCSI_SENSE_BUFFERSIZE];
88
};
89
};
89
90
90
static void bsg_free_command(struct bsg_command *bc)
91
static void bsg_free_command(struct bsg_command *bc)
Lines 206-212 bsg_validate_sgv4_hdr(struct sg_io_v4 *hdr, int *op) Link Here
206
 * map sg_io_v4 to a request.
207
 * map sg_io_v4 to a request.
207
 */
208
 */
208
static struct request *
209
static struct request *
209
bsg_map_hdr(struct bsg_device *bd, struct sg_io_v4 *hdr, fmode_t has_write_perm)
210
bsg_map_hdr(struct bsg_device *bd, struct sg_io_v4 *hdr, fmode_t has_write_perm, char *sense)
210
{
211
{
211
	struct request_queue *q = bd->queue;
212
	struct request_queue *q = bd->queue;
212
	struct request *rq, *next_rq = NULL;
213
	struct request *rq, *next_rq = NULL;
Lines 279-284 bsg_map_hdr(struct bsg_device *bd, struct sg_io_v4 *hdr, fmode_t has_write_perm) Link Here
279
			goto out;
280
			goto out;
280
	}
281
	}
281
282
283
	scsi_req(rq)->sense = sense;
282
	return rq;
284
	return rq;
283
out:
285
out:
284
	scsi_req_free_cmd(scsi_req(rq));
286
	scsi_req_free_cmd(scsi_req(rq));
Lines 620-626 static int __bsg_write(struct bsg_device *bd, const char __user *buf, Link Here
620
		/*
622
		/*
621
		 * get a request, fill in the blanks, and add to request queue
623
		 * get a request, fill in the blanks, and add to request queue
622
		 */
624
		 */
623
		rq = bsg_map_hdr(bd, &bc->hdr, has_write_perm);
625
		rq = bsg_map_hdr(bd, &bc->hdr, has_write_perm, bc->sense);
624
		if (IS_ERR(rq)) {
626
		if (IS_ERR(rq)) {
625
			ret = PTR_ERR(rq);
627
			ret = PTR_ERR(rq);
626
			rq = NULL;
628
			rq = NULL;
Lines 906-916 static long bsg_ioctl(struct file *file, unsigned int cmd, unsigned long arg) Link Here
906
		struct bio *bio, *bidi_bio = NULL;
908
		struct bio *bio, *bidi_bio = NULL;
907
		struct sg_io_v4 hdr;
909
		struct sg_io_v4 hdr;
908
		int at_head;
910
		int at_head;
911
		char sense[SCSI_SENSE_BUFFERSIZE];
909
912
910
		if (copy_from_user(&hdr, uarg, sizeof(hdr)))
913
		if (copy_from_user(&hdr, uarg, sizeof(hdr)))
911
			return -EFAULT;
914
			return -EFAULT;
912
915
913
		rq = bsg_map_hdr(bd, &hdr, file->f_mode & FMODE_WRITE);
916
		rq = bsg_map_hdr(bd, &hdr, file->f_mode & FMODE_WRITE, sense);
914
		if (IS_ERR(rq))
917
		if (IS_ERR(rq))
915
			return PTR_ERR(rq);
918
			return PTR_ERR(rq);
916
919

Return to bug 196343