diff options
author | Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> | 2011-04-20 11:50:43 -0400 |
---|---|---|
committer | Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> | 2011-04-20 11:58:03 -0400 |
commit | 8b6bf747d70e5bac1a34c8fd773230e1cfdd7546 (patch) | |
tree | 187680a66902c915b92a5cc42892b71aed97895f | |
parent | 42c7841d171a2fe32005738dfebd724a90921496 (diff) |
xen/blkback: Prefix exposed functions with xen_
And also shorten the name if it has blkback to blkbk.
This results in the symbol table (if compiled in the kernel)
to be much shorter, prettier, and also easier to search for.
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
-rw-r--r-- | drivers/block/xen-blkback/blkback.c | 36 | ||||
-rw-r--r-- | drivers/block/xen-blkback/common.h | 18 | ||||
-rw-r--r-- | drivers/block/xen-blkback/xenbus.c | 80 |
3 files changed, 68 insertions, 66 deletions
diff --git a/drivers/block/xen-blkback/blkback.c b/drivers/block/xen-blkback/blkback.c index 806c2c947c6..c4bc85e69d3 100644 --- a/drivers/block/xen-blkback/blkback.c +++ b/drivers/block/xen-blkback/blkback.c @@ -53,13 +53,13 @@ * pulled from a communication ring are quite likely to end up being part of * the same scatter/gather request at the disc. * - * ** TRY INCREASING 'blkif_reqs' IF WRITE SPEEDS SEEM TOO LOW ** + * ** TRY INCREASING 'xen_blkif_reqs' IF WRITE SPEEDS SEEM TOO LOW ** * * This will increase the chances of being able to write whole tracks. * 64 should be enough to keep us competitive with Linux. */ -static int blkif_reqs = 64; -module_param_named(reqs, blkif_reqs, int, 0); +static int xen_blkif_reqs = 64; +module_param_named(reqs, xen_blkif_reqs, int, 0); MODULE_PARM_DESC(reqs, "Number of blkback requests to allocate"); /* Run-time switchable: /sys/module/blkback/parameters/ */ @@ -196,7 +196,7 @@ static void vbd_resize(struct blkif_st *blkif) struct vbd *vbd = &blkif->vbd; struct xenbus_transaction xbt; int err; - struct xenbus_device *dev = blkback_xenbus(blkif->be); + struct xenbus_device *dev = xen_blkbk_xenbus(blkif->be); unsigned long long new_size = vbd_sz(vbd); printk(KERN_INFO "VBD Resize: Domid: %d, Device: (%d, %d)\n", @@ -244,7 +244,7 @@ static void blkif_notify_work(struct blkif_st *blkif) wake_up(&blkif->wq); } -irqreturn_t blkif_be_int(int irq, void *dev_id) +irqreturn_t xen_blkif_be_int(int irq, void *dev_id) { blkif_notify_work(dev_id); return IRQ_HANDLED; @@ -265,12 +265,12 @@ static void print_stats(struct blkif_st *blkif) blkif->st_oo_req = 0; } -int blkif_schedule(void *arg) +int xen_blkif_schedule(void *arg) { struct blkif_st *blkif = arg; struct vbd *vbd = &blkif->vbd; - blkif_get(blkif); + xen_blkif_get(blkif); if (debug_lvl) printk(KERN_DEBUG "%s: started\n", current->comm); @@ -305,7 +305,7 @@ int blkif_schedule(void *arg) printk(KERN_DEBUG "%s: exiting\n", current->comm); blkif->xenblkd = NULL; - blkif_put(blkif); + xen_blkif_put(blkif); return 0; } @@ -417,7 +417,7 @@ static void __end_block_io_op(struct pending_req *pending_req, int error) if ((pending_req->operation == BLKIF_OP_WRITE_BARRIER) && (error == -EOPNOTSUPP)) { DPRINTK("blkback: write barrier op failed, not supported\n"); - blkback_barrier(XBT_NIL, pending_req->blkif->be, 0); + xen_blkbk_barrier(XBT_NIL, pending_req->blkif->be, 0); pending_req->status = BLKIF_RSP_EOPNOTSUPP; } else if (error) { DPRINTK("Buffer not up-to-date at end of operation, " @@ -433,7 +433,7 @@ static void __end_block_io_op(struct pending_req *pending_req, int error) xen_blkbk_unmap(pending_req); make_response(pending_req->blkif, pending_req->id, pending_req->operation, pending_req->status); - blkif_put(pending_req->blkif); + xen_blkif_put(pending_req->blkif); free_req(pending_req); } } @@ -619,7 +619,7 @@ static void dispatch_rw_block_io(struct blkif_st *blkif, goto fail_flush; /* This corresponding blkif_put is done in __end_block_io_op */ - blkif_get(blkif); + xen_blkif_get(blkif); for (i = 0; i < nseg; i++) { while ((bio == NULL) || @@ -751,7 +751,7 @@ static void make_response(struct blkif_st *blkif, u64 id, notify_remote_via_irq(blkif->irq); } -static int __init blkif_init(void) +static int __init xen_blkif_init(void) { int i, mmap_pages; int rc = 0; @@ -765,10 +765,10 @@ static int __init blkif_init(void) return -ENOMEM; } - mmap_pages = blkif_reqs * BLKIF_MAX_SEGMENTS_PER_REQUEST; + mmap_pages = xen_blkif_reqs * BLKIF_MAX_SEGMENTS_PER_REQUEST; blkbk->pending_reqs = kmalloc(sizeof(blkbk->pending_reqs[0]) * - blkif_reqs, GFP_KERNEL); + xen_blkif_reqs, GFP_KERNEL); blkbk->pending_grant_handles = kzalloc(sizeof(blkbk->pending_grant_handles[0]) * mmap_pages, GFP_KERNEL); blkbk->pending_pages = kzalloc(sizeof(blkbk->pending_pages[0]) * @@ -788,7 +788,7 @@ static int __init blkif_init(void) goto out_of_memory; } } - rc = blkif_interface_init(); + rc = xen_blkif_interface_init(); if (rc) goto failed_init; @@ -798,11 +798,11 @@ static int __init blkif_init(void) spin_lock_init(&blkbk->pending_free_lock); init_waitqueue_head(&blkbk->pending_free_wq); - for (i = 0; i < blkif_reqs; i++) + for (i = 0; i < xen_blkif_reqs; i++) list_add_tail(&blkbk->pending_reqs[i].free_list, &blkbk->pending_free); - rc = blkif_xenbus_init(); + rc = xen_blkif_xenbus_init(); if (rc) goto failed_init; @@ -823,6 +823,6 @@ static int __init blkif_init(void) return rc; } -module_init(blkif_init); +module_init(xen_blkif_init); MODULE_LICENSE("Dual BSD/GPL"); diff --git a/drivers/block/xen-blkback/common.h b/drivers/block/xen-blkback/common.h index 4b5acb3e8b2..16af388268e 100644 --- a/drivers/block/xen-blkback/common.h +++ b/drivers/block/xen-blkback/common.h @@ -100,8 +100,8 @@ struct blkif_st { (_v)->bdev->bd_part->nr_sects : \ get_capacity((_v)->bdev->bd_disk)) -#define blkif_get(_b) (atomic_inc(&(_b)->refcnt)) -#define blkif_put(_b) \ +#define xen_blkif_get(_b) (atomic_inc(&(_b)->refcnt)) +#define xen_blkif_put(_b) \ do { \ if (atomic_dec_and_test(&(_b)->refcnt)) \ wake_up(&(_b)->waiting_to_free);\ @@ -113,16 +113,16 @@ struct phys_req { struct block_device *bdev; blkif_sector_t sector_number; }; -int blkif_interface_init(void); +int xen_blkif_interface_init(void); -int blkif_xenbus_init(void); +int xen_blkif_xenbus_init(void); -irqreturn_t blkif_be_int(int irq, void *dev_id); -int blkif_schedule(void *arg); +irqreturn_t xen_blkif_be_int(int irq, void *dev_id); +int xen_blkif_schedule(void *arg); -int blkback_barrier(struct xenbus_transaction xbt, - struct backend_info *be, int state); +int xen_blkbk_barrier(struct xenbus_transaction xbt, + struct backend_info *be, int state); -struct xenbus_device *blkback_xenbus(struct backend_info *be); +struct xenbus_device *xen_blkbk_xenbus(struct backend_info *be); #endif /* __BLKIF__BACKEND__COMMON_H__ */ diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback/xenbus.c index 75bf49bd365..64b0a1c760f 100644 --- a/drivers/block/xen-blkback/xenbus.c +++ b/drivers/block/xen-blkback/xenbus.c @@ -35,13 +35,13 @@ struct backend_info { char *mode; }; -static struct kmem_cache *blkif_cachep; +static struct kmem_cache *xen_blkif_cachep; static void connect(struct backend_info *); static int connect_ring(struct backend_info *); static void backend_changed(struct xenbus_watch *, const char **, unsigned int); -struct xenbus_device *blkback_xenbus(struct backend_info *be) +struct xenbus_device *xen_blkbk_xenbus(struct backend_info *be) { return be->dev; } @@ -67,7 +67,7 @@ static int blkback_name(struct blkif_st *blkif, char *buf) return 0; } -static void update_blkif_status(struct blkif_st *blkif) +static void xen_update_blkif_status(struct blkif_st *blkif) { int err; char name[TASK_COMM_LEN]; @@ -98,7 +98,7 @@ static void update_blkif_status(struct blkif_st *blkif) } invalidate_inode_pages2(blkif->vbd.bdev->bd_inode->i_mapping); - blkif->xenblkd = kthread_run(blkif_schedule, blkif, name); + blkif->xenblkd = kthread_run(xen_blkif_schedule, blkif, name); if (IS_ERR(blkif->xenblkd)) { err = PTR_ERR(blkif->xenblkd); blkif->xenblkd = NULL; @@ -106,11 +106,11 @@ static void update_blkif_status(struct blkif_st *blkif) } } -struct blkif_st *blkif_alloc(domid_t domid) +static struct blkif_st *xen_blkif_alloc(domid_t domid) { struct blkif_st *blkif; - blkif = kmem_cache_alloc(blkif_cachep, GFP_KERNEL); + blkif = kmem_cache_alloc(xen_blkif_cachep, GFP_KERNEL); if (!blkif) return ERR_PTR(-ENOMEM); @@ -157,8 +157,8 @@ static void unmap_frontend_page(struct blkif_st *blkif) BUG(); } -int blkif_map(struct blkif_st *blkif, unsigned long shared_page, - unsigned int evtchn) +static int xen_blkif_map(struct blkif_st *blkif, unsigned long shared_page, + unsigned int evtchn) { int err; @@ -202,8 +202,9 @@ int blkif_map(struct blkif_st *blkif, unsigned long shared_page, BUG(); } - err = bind_interdomain_evtchn_to_irqhandler( - blkif->domid, evtchn, blkif_be_int, 0, "blkif-backend", blkif); + err = bind_interdomain_evtchn_to_irqhandler(blkif->domid, evtchn, + xen_blkif_be_int, 0, + "blkif-backend", blkif); if (err < 0) { unmap_frontend_page(blkif); free_vm_area(blkif->blk_ring_area); @@ -215,7 +216,7 @@ int blkif_map(struct blkif_st *blkif, unsigned long shared_page, return 0; } -void blkif_disconnect(struct blkif_st *blkif) +static void xen_blkif_disconnect(struct blkif_st *blkif) { if (blkif->xenblkd) { kthread_stop(blkif->xenblkd); @@ -238,18 +239,19 @@ void blkif_disconnect(struct blkif_st *blkif) } } -void blkif_free(struct blkif_st *blkif) +void xen_blkif_free(struct blkif_st *blkif) { if (!atomic_dec_and_test(&blkif->refcnt)) BUG(); - kmem_cache_free(blkif_cachep, blkif); + kmem_cache_free(xen_blkif_cachep, blkif); } -int __init blkif_interface_init(void) +int __init xen_blkif_interface_init(void) { - blkif_cachep = kmem_cache_create("blkif_cache", sizeof(struct blkif_st), - 0, 0, NULL); - if (!blkif_cachep) + xen_blkif_cachep = kmem_cache_create("blkif_cache", + sizeof(struct blkif_st), + 0, 0, NULL); + if (!xen_blkif_cachep) return -ENOMEM; return 0; @@ -377,7 +379,7 @@ static int vbd_create(struct blkif_st *blkif, blkif_vdev_t handle, handle, blkif->domid); return 0; } -static int blkback_remove(struct xenbus_device *dev) +static int xen_blkbk_remove(struct xenbus_device *dev) { struct backend_info *be = dev_get_drvdata(&dev->dev); @@ -393,9 +395,9 @@ static int blkback_remove(struct xenbus_device *dev) } if (be->blkif) { - blkif_disconnect(be->blkif); + xen_blkif_disconnect(be->blkif); vbd_free(&be->blkif->vbd); - blkif_free(be->blkif); + xen_blkif_free(be->blkif); be->blkif = NULL; } @@ -404,8 +406,8 @@ static int blkback_remove(struct xenbus_device *dev) return 0; } -int blkback_barrier(struct xenbus_transaction xbt, - struct backend_info *be, int state) +int xen_blkbk_barrier(struct xenbus_transaction xbt, + struct backend_info *be, int state) { struct xenbus_device *dev = be->dev; int err; @@ -423,8 +425,8 @@ int blkback_barrier(struct xenbus_transaction xbt, * structures, and watch the store waiting for the hotplug scripts to tell us * the device's physical major and minor numbers. Switch to InitWait. */ -static int blkback_probe(struct xenbus_device *dev, - const struct xenbus_device_id *id) +static int xen_blkbk_probe(struct xenbus_device *dev, + const struct xenbus_device_id *id) { int err; struct backend_info *be = kzalloc(sizeof(struct backend_info), @@ -437,7 +439,7 @@ static int blkback_probe(struct xenbus_device *dev, be->dev = dev; dev_set_drvdata(&dev->dev, be); - be->blkif = blkif_alloc(dev->otherend_id); + be->blkif = xen_blkif_alloc(dev->otherend_id); if (IS_ERR(be->blkif)) { err = PTR_ERR(be->blkif); be->blkif = NULL; @@ -461,7 +463,7 @@ static int blkback_probe(struct xenbus_device *dev, fail: DPRINTK("failed"); - blkback_remove(dev); + xen_blkbk_remove(dev); return err; } @@ -550,7 +552,7 @@ static void backend_changed(struct xenbus_watch *watch, } /* We're potentially connected now */ - update_blkif_status(be->blkif); + xen_update_blkif_status(be->blkif); } } @@ -586,16 +588,16 @@ static void frontend_changed(struct xenbus_device *dev, /* Enforce precondition before potential leak point. * blkif_disconnect() is idempotent. */ - blkif_disconnect(be->blkif); + xen_blkif_disconnect(be->blkif); err = connect_ring(be); if (err) break; - update_blkif_status(be->blkif); + xen_update_blkif_status(be->blkif); break; case XenbusStateClosing: - blkif_disconnect(be->blkif); + xen_blkif_disconnect(be->blkif); xenbus_switch_state(dev, XenbusStateClosing); break; @@ -640,7 +642,7 @@ again: return; } - err = blkback_barrier(xbt, be, 1); + err = xen_blkbk_barrier(xbt, be, 1); if (err) goto abort; @@ -726,7 +728,7 @@ static int connect_ring(struct backend_info *be) ring_ref, evtchn, be->blkif->blk_protocol, protocol); /* Map the shared frame, irq etc. */ - err = blkif_map(be->blkif, ring_ref, evtchn); + err = xen_blkif_map(be->blkif, ring_ref, evtchn); if (err) { xenbus_dev_fatal(dev, err, "mapping ring-ref %lu port %u", ring_ref, evtchn); @@ -740,23 +742,23 @@ static int connect_ring(struct backend_info *be) /* ** Driver Registration ** */ -static const struct xenbus_device_id blkback_ids[] = { +static const struct xenbus_device_id xen_blkbk_ids[] = { { "vbd" }, { "" } }; -static struct xenbus_driver blkback = { +static struct xenbus_driver xen_blkbk = { .name = "vbd", .owner = THIS_MODULE, - .ids = blkback_ids, - .probe = blkback_probe, - .remove = blkback_remove, + .ids = xen_blkbk_ids, + .probe = xen_blkbk_probe, + .remove = xen_blkbk_remove, .otherend_changed = frontend_changed }; -int blkif_xenbus_init(void) +int xen_blkif_xenbus_init(void) { - return xenbus_register_backend(&blkback); + return xenbus_register_backend(&xen_blkbk); } |