X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=block%2Fbsg.c;h=8e181ab3afb9a515f38195b450145002a2be044d;hb=a70a93229943c177f0062490b4f8e44be4cef685;hp=d60eee54940554f9c168c22c7a722900be84595b;hpb=6a302358d87fedaf7bda12b8e909265ebf1ce674;p=powerpc.git diff --git a/block/bsg.c b/block/bsg.c index d60eee5494..8e181ab3af 100644 --- a/block/bsg.c +++ b/block/bsg.c @@ -1,5 +1,5 @@ /* - * bsg.c - block layer implementation of the sg v3 interface + * bsg.c - block layer implementation of the sg v4 interface * * Copyright (C) 2004 Jens Axboe SUSE Labs * Copyright (C) 2004 Peter M. Jones @@ -421,7 +421,6 @@ static int blk_complete_sgv4_hdr_rq(struct request *rq, struct sg_io_v4 *hdr, hdr->info = 0; if (hdr->device_status || hdr->transport_status || hdr->driver_status) hdr->info |= SG_INFO_CHECK; - hdr->din_resid = rq->data_len; hdr->response_len = 0; if (rq->sense_len && hdr->response) { @@ -437,9 +436,14 @@ static int blk_complete_sgv4_hdr_rq(struct request *rq, struct sg_io_v4 *hdr, } if (rq->next_rq) { + hdr->dout_resid = rq->data_len; + hdr->din_resid = rq->next_rq->data_len; blk_rq_unmap_user(bidi_bio); blk_put_request(rq->next_rq); - } + } else if (rq_data_dir(rq) == READ) + hdr->din_resid = rq->data_len; + else + hdr->dout_resid = rq->data_len; blk_rq_unmap_user(bio); blk_put_request(rq); @@ -904,7 +908,7 @@ static long bsg_ioctl(struct file *file, unsigned int cmd, unsigned long arg) } } -static struct file_operations bsg_fops = { +static const struct file_operations bsg_fops = { .read = bsg_read, .write = bsg_write, .poll = bsg_poll, @@ -1006,10 +1010,7 @@ unlock: } EXPORT_SYMBOL_GPL(bsg_register_queue); -static struct cdev bsg_cdev = { - .kobj = {.name = "bsg", }, - .owner = THIS_MODULE, -}; +static struct cdev bsg_cdev; static int __init bsg_init(void) {