1 )nbd: fix checkpatch trailing space warning. 2) nbd: fix checkpatch warning use linux/uaccess.h
3) nbd : fix checkpatch pointer declaration warning 4) nbd: fix checkpatch warning no newline after decleration. 5) nbd: fix checkpatch warning no newline after decleration. 6) nbd : fix checkpatch line over 80 char warning 7) nbd: fix checkpatch trailing whitespace warning. 8) nbd: fix checkpatch trailing whitespace warning. 9) nbd : fix checkpatch structure declaration braces on next line warning. 10) nbd : fix checkpatch trailing whitespace warning 11) nbd : fix checkpatch printk warning 12) nbd: fix checkpatch no extra line after decleration warning 13) nbd: fix checkpatch printk warning to pr_info 14) nbd: fix checkpatch no new line after decleration warning 15) nbd: fix checkpatch printk warning to pr_info Signed-off-by: Pranay Kr. Srivastava <pran...@gmail.com> --- drivers/block/nbd.c | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c index da2b0a4..d1d898d 100644 --- a/drivers/block/nbd.c +++ b/drivers/block/nbd.c @@ -3,7 +3,7 @@ * * Note that you can not swap over this thing, yet. Seems to work but * deadlocks sometimes - you can not swap over TCP in general. - * + * * Copyright 1997-2000, 2008 Pavel Machek <pa...@ucw.cz> * Parts copyright 2001 Steven Whitehouse <st...@chygwyn.com> * @@ -35,7 +35,7 @@ #include <linux/types.h> #include <linux/debugfs.h> -#include <asm/uaccess.h> +#include <linux/uaccess.h> #include <asm/types.h> #include <linux/nbd.h> @@ -43,7 +43,7 @@ struct nbd_device { u32 flags; - struct socket * sock; /* If == NULL, device is not ready, yet */ + struct socket *sock; /* If == NULL, device is not ready, yet */ int magic; spinlock_t queue_lock; @@ -272,6 +272,7 @@ static inline int sock_send_bvec(struct nbd_device *nbd, struct bio_vec *bvec, { int result; void *kaddr = kmap(bvec->bv_page); + result = sock_xmit(nbd, 1, kaddr + bvec->bv_offset, bvec->bv_len, flags); kunmap(bvec->bv_page); @@ -369,6 +370,7 @@ static inline int sock_recv_bvec(struct nbd_device *nbd, struct bio_vec *bvec) { int result; void *kaddr = kmap(bvec->bv_page); + result = sock_xmit(nbd, 0, kaddr + bvec->bv_offset, bvec->bv_len, MSG_WAITALL); kunmap(bvec->bv_page); @@ -611,8 +613,8 @@ static int nbd_thread_send(void *data) } /* - * We always wait for result of write, for now. It would be nice to make it optional - * in future + * We always wait for result of write, for now. It would be nice to make it + * optional in future * if ((rq_data_dir(req) == WRITE) && (nbd->flags & NBD_WRITE_NOCHK)) * { printk( "Warning: Ignoring result!\n"); nbd_end_request( req ); } */ @@ -621,7 +623,7 @@ static void nbd_request_handler(struct request_queue *q) __releases(q->queue_lock) __acquires(q->queue_lock) { struct request *req; - + while ((req = blk_fetch_request(q)) != NULL) { struct nbd_device *nbd; @@ -737,7 +739,7 @@ static int __nbd_ioctl(struct block_device *bdev, struct nbd_device *nbd, nbd_send_req(nbd, &sreq); return 0; } - + case NBD_CLEAR_SOCK: sock_shutdown(nbd); nbd_clear_que(nbd); @@ -864,8 +866,7 @@ static int nbd_ioctl(struct block_device *bdev, fmode_t mode, return error; } -static const struct block_device_operations nbd_fops = -{ +static const struct block_device_operations nbd_fops = { .owner = THIS_MODULE, .ioctl = nbd_ioctl, .compat_ioctl = nbd_ioctl, @@ -1008,7 +1009,7 @@ static void nbd_dbg_close(void) #endif /* - * And here should be modules and kernel interface + * And here should be modules and kernel interface * (Just smiley confuses emacs :-) */ @@ -1021,7 +1022,7 @@ static int __init nbd_init(void) BUILD_BUG_ON(sizeof(struct nbd_request) != 28); if (max_part < 0) { - printk(KERN_ERR "nbd: max_part must be >= 0\n"); + pr_err("nbd: max_part must be >= 0\n"); return -EINVAL; } @@ -1052,6 +1053,7 @@ static int __init nbd_init(void) for (i = 0; i < nbds_max; i++) { struct gendisk *disk = alloc_disk(1 << part_shift); + if (!disk) goto out; nbd_dev[i].disk = disk; @@ -1082,12 +1084,13 @@ static int __init nbd_init(void) goto out; } - printk(KERN_INFO "nbd: registered device at major %d\n", NBD_MAJOR); + pr_info("nbd: registered device at major %d\n", NBD_MAJOR); nbd_dbg_init(); for (i = 0; i < nbds_max; i++) { struct gendisk *disk = nbd_dev[i].disk; + nbd_dev[i].magic = NBD_MAGIC; INIT_LIST_HEAD(&nbd_dev[i].waiting_queue); spin_lock_init(&nbd_dev[i].queue_lock); @@ -1135,7 +1138,7 @@ static void __exit nbd_cleanup(void) } unregister_blkdev(NBD_MAJOR, "nbd"); kfree(nbd_dev); - printk(KERN_INFO "nbd: unregistered device at major %d\n", NBD_MAJOR); + pr_info("nbd: unregistered device at major %d\n", NBD_MAJOR); } module_init(nbd_init); -- 2.6.2