On Wed, Dec 20 2006, FUJITA Tomonori wrote:
> This patch replaces SG v3 in bsg with SG v4 (except for SG_IO).
>
> Signed-off-by: FUJITA Tomonori <[EMAIL PROTECTED]>
> ---
> block/bsg.c | 198
> ++++++++++++++++++++++++++++++++++++-----------------------
> 1 files changed, 121 insertions(+), 77 deletions(-)
>
> diff --git a/block/bsg.c b/block/bsg.c
> index 53a09a5..6d139d2 100644
> --- a/block/bsg.c
> +++ b/block/bsg.c
> @@ -103,8 +103,8 @@ struct bsg_command {
> struct request *rq;
> struct bio *bio;
> int err;
> - struct sg_io_hdr hdr;
> - struct sg_io_hdr __user *uhdr;
> + struct sg_io_v4 hdr;
> + struct sg_io_v4 __user *uhdr;
> char sense[SCSI_SENSE_BUFFERSIZE];
> };
>
> @@ -235,57 +235,82 @@ static struct bsg_command *bsg_get_comma
> return bc;
> }
>
> +static int blk_fill_sgv4_hdr_rq(request_queue_t *q, struct request *rq,
> + struct sg_io_v4 *hdr, int has_write_perm)
> +{
> + memset(rq->cmd, 0, BLK_MAX_CDB); /* ATAPI hates garbage after CDB */
> +
> + if (copy_from_user(rq->cmd, (void *)(unsigned long)hdr->request,
> + hdr->request_len))
> + return -EFAULT;
Strange casting, that should be cleaned up. Also reminds me that the
sg_io_v4 header needs proper __user annotation.
--
Jens Axboe
-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at http://vger.kernel.org/majordomo-info.html