ipc: remove the ipc_get() routine
[safe/jmp/linux-2.6] / block / bsg.c
index 12c287b..8e181ab 100644 (file)
@@ -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 <axboe@suse.de> SUSE Labs
  * Copyright (C) 2004 Peter M. Jones <pjones@redhat.com>
@@ -31,7 +31,7 @@
 #define BSG_VERSION    "0.4"
 
 struct bsg_device {
-       request_queue_t *queue;
+       struct request_queue *queue;
        spinlock_t lock;
        struct list_head busy_list;
        struct list_head done_list;
@@ -172,7 +172,7 @@ unlock:
        return ret;
 }
 
-static int blk_fill_sgv4_hdr_rq(request_queue_t *q, struct request *rq,
+static int blk_fill_sgv4_hdr_rq(struct request_queue *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 */
@@ -206,7 +206,7 @@ static int blk_fill_sgv4_hdr_rq(request_queue_t *q, struct request *rq,
  * Check if sg_io_v4 from user is allowed and valid
  */
 static int
-bsg_validate_sgv4_hdr(request_queue_t *q, struct sg_io_v4 *hdr, int *rw)
+bsg_validate_sgv4_hdr(struct request_queue *q, struct sg_io_v4 *hdr, int *rw)
 {
        int ret = 0;
 
@@ -242,7 +242,7 @@ bsg_validate_sgv4_hdr(request_queue_t *q, struct sg_io_v4 *hdr, int *rw)
 static struct request *
 bsg_map_hdr(struct bsg_device *bd, struct sg_io_v4 *hdr)
 {
-       request_queue_t *q = bd->queue;
+       struct request_queue *q = bd->queue;
        struct request *rq, *next_rq = NULL;
        int ret, rw;
        unsigned int dxfer_len;
@@ -337,7 +337,7 @@ static void bsg_rq_end_io(struct request *rq, int uptodate)
  * do final setup of a 'bc' and submit the matching 'rq' to the block
  * layer for io
  */
-static void bsg_add_command(struct bsg_device *bd, request_queue_t *q,
+static void bsg_add_command(struct bsg_device *bd, struct request_queue *q,
                            struct bsg_command *bc, struct request *rq)
 {
        rq->sense = bc->sense;
@@ -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);
@@ -603,7 +607,7 @@ static int __bsg_write(struct bsg_device *bd, const char __user *buf,
        bc = NULL;
        ret = 0;
        while (nr_commands) {
-               request_queue_t *q = bd->queue;
+               struct request_queue *q = bd->queue;
 
                bc = bsg_alloc_command(bd);
                if (IS_ERR(bc)) {
@@ -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)
 {