aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/xen-blkback/xenbus.c
diff options
context:
space:
mode:
authorKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>2011-04-20 11:50:43 -0400
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>2011-04-20 11:58:03 -0400
commit8b6bf747d70e5bac1a34c8fd773230e1cfdd7546 (patch)
tree187680a66902c915b92a5cc42892b71aed97895f /drivers/block/xen-blkback/xenbus.c
parent42c7841d171a2fe32005738dfebd724a90921496 (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>
Diffstat (limited to 'drivers/block/xen-blkback/xenbus.c')
-rw-r--r--drivers/block/xen-blkback/xenbus.c80
1 files changed, 41 insertions, 39 deletions
diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback/xenbus.c
index 75bf49bd365c..64b0a1c760fb 100644
--- a/drivers/block/xen-blkback/xenbus.c
+++ b/drivers/block/xen-blkback/xenbus.c
@@ -35,13 +35,13 @@ struct backend_info {
35 char *mode; 35 char *mode;
36}; 36};
37 37
38static struct kmem_cache *blkif_cachep; 38static struct kmem_cache *xen_blkif_cachep;
39static void connect(struct backend_info *); 39static void connect(struct backend_info *);
40static int connect_ring(struct backend_info *); 40static int connect_ring(struct backend_info *);
41static void backend_changed(struct xenbus_watch *, const char **, 41static void backend_changed(struct xenbus_watch *, const char **,
42 unsigned int); 42 unsigned int);
43 43
44struct xenbus_device *blkback_xenbus(struct backend_info *be) 44struct xenbus_device *xen_blkbk_xenbus(struct backend_info *be)
45{ 45{
46 return be->dev; 46 return be->dev;
47} 47}
@@ -67,7 +67,7 @@ static int blkback_name(struct blkif_st *blkif, char *buf)
67 return 0; 67 return 0;
68} 68}
69 69
70static void update_blkif_status(struct blkif_st *blkif) 70static void xen_update_blkif_status(struct blkif_st *blkif)
71{ 71{
72 int err; 72 int err;
73 char name[TASK_COMM_LEN]; 73 char name[TASK_COMM_LEN];
@@ -98,7 +98,7 @@ static void update_blkif_status(struct blkif_st *blkif)
98 } 98 }
99 invalidate_inode_pages2(blkif->vbd.bdev->bd_inode->i_mapping); 99 invalidate_inode_pages2(blkif->vbd.bdev->bd_inode->i_mapping);
100 100
101 blkif->xenblkd = kthread_run(blkif_schedule, blkif, name); 101 blkif->xenblkd = kthread_run(xen_blkif_schedule, blkif, name);
102 if (IS_ERR(blkif->xenblkd)) { 102 if (IS_ERR(blkif->xenblkd)) {
103 err = PTR_ERR(blkif->xenblkd); 103 err = PTR_ERR(blkif->xenblkd);
104 blkif->xenblkd = NULL; 104 blkif->xenblkd = NULL;
@@ -106,11 +106,11 @@ static void update_blkif_status(struct blkif_st *blkif)
106 } 106 }
107} 107}
108 108
109struct blkif_st *blkif_alloc(domid_t domid) 109static struct blkif_st *xen_blkif_alloc(domid_t domid)
110{ 110{
111 struct blkif_st *blkif; 111 struct blkif_st *blkif;
112 112
113 blkif = kmem_cache_alloc(blkif_cachep, GFP_KERNEL); 113 blkif = kmem_cache_alloc(xen_blkif_cachep, GFP_KERNEL);
114 if (!blkif) 114 if (!blkif)
115 return ERR_PTR(-ENOMEM); 115 return ERR_PTR(-ENOMEM);
116 116
@@ -157,8 +157,8 @@ static void unmap_frontend_page(struct blkif_st *blkif)
157 BUG(); 157 BUG();
158} 158}
159 159
160int blkif_map(struct blkif_st *blkif, unsigned long shared_page, 160static int xen_blkif_map(struct blkif_st *blkif, unsigned long shared_page,
161 unsigned int evtchn) 161 unsigned int evtchn)
162{ 162{
163 int err; 163 int err;
164 164
@@ -202,8 +202,9 @@ int blkif_map(struct blkif_st *blkif, unsigned long shared_page,
202 BUG(); 202 BUG();
203 } 203 }
204 204
205 err = bind_interdomain_evtchn_to_irqhandler( 205 err = bind_interdomain_evtchn_to_irqhandler(blkif->domid, evtchn,
206 blkif->domid, evtchn, blkif_be_int, 0, "blkif-backend", blkif); 206 xen_blkif_be_int, 0,
207 "blkif-backend", blkif);
207 if (err < 0) { 208 if (err < 0) {
208 unmap_frontend_page(blkif); 209 unmap_frontend_page(blkif);
209 free_vm_area(blkif->blk_ring_area); 210 free_vm_area(blkif->blk_ring_area);
@@ -215,7 +216,7 @@ int blkif_map(struct blkif_st *blkif, unsigned long shared_page,
215 return 0; 216 return 0;
216} 217}
217 218
218void blkif_disconnect(struct blkif_st *blkif) 219static void xen_blkif_disconnect(struct blkif_st *blkif)
219{ 220{
220 if (blkif->xenblkd) { 221 if (blkif->xenblkd) {
221 kthread_stop(blkif->xenblkd); 222 kthread_stop(blkif->xenblkd);
@@ -238,18 +239,19 @@ void blkif_disconnect(struct blkif_st *blkif)
238 } 239 }
239} 240}
240 241
241void blkif_free(struct blkif_st *blkif) 242void xen_blkif_free(struct blkif_st *blkif)
242{ 243{
243 if (!atomic_dec_and_test(&blkif->refcnt)) 244 if (!atomic_dec_and_test(&blkif->refcnt))
244 BUG(); 245 BUG();
245 kmem_cache_free(blkif_cachep, blkif); 246 kmem_cache_free(xen_blkif_cachep, blkif);
246} 247}
247 248
248int __init blkif_interface_init(void) 249int __init xen_blkif_interface_init(void)
249{ 250{
250 blkif_cachep = kmem_cache_create("blkif_cache", sizeof(struct blkif_st), 251 xen_blkif_cachep = kmem_cache_create("blkif_cache",
251 0, 0, NULL); 252 sizeof(struct blkif_st),
252 if (!blkif_cachep) 253 0, 0, NULL);
254 if (!xen_blkif_cachep)
253 return -ENOMEM; 255 return -ENOMEM;
254 256
255 return 0; 257 return 0;
@@ -377,7 +379,7 @@ static int vbd_create(struct blkif_st *blkif, blkif_vdev_t handle,
377 handle, blkif->domid); 379 handle, blkif->domid);
378 return 0; 380 return 0;
379} 381}
380static int blkback_remove(struct xenbus_device *dev) 382static int xen_blkbk_remove(struct xenbus_device *dev)
381{ 383{
382 struct backend_info *be = dev_get_drvdata(&dev->dev); 384 struct backend_info *be = dev_get_drvdata(&dev->dev);
383 385
@@ -393,9 +395,9 @@ static int blkback_remove(struct xenbus_device *dev)
393 } 395 }
394 396
395 if (be->blkif) { 397 if (be->blkif) {
396 blkif_disconnect(be->blkif); 398 xen_blkif_disconnect(be->blkif);
397 vbd_free(&be->blkif->vbd); 399 vbd_free(&be->blkif->vbd);
398 blkif_free(be->blkif); 400 xen_blkif_free(be->blkif);
399 be->blkif = NULL; 401 be->blkif = NULL;
400 } 402 }
401 403
@@ -404,8 +406,8 @@ static int blkback_remove(struct xenbus_device *dev)
404 return 0; 406 return 0;
405} 407}
406 408
407int blkback_barrier(struct xenbus_transaction xbt, 409int xen_blkbk_barrier(struct xenbus_transaction xbt,
408 struct backend_info *be, int state) 410 struct backend_info *be, int state)
409{ 411{
410 struct xenbus_device *dev = be->dev; 412 struct xenbus_device *dev = be->dev;
411 int err; 413 int err;
@@ -423,8 +425,8 @@ int blkback_barrier(struct xenbus_transaction xbt,
423 * structures, and watch the store waiting for the hotplug scripts to tell us 425 * structures, and watch the store waiting for the hotplug scripts to tell us
424 * the device's physical major and minor numbers. Switch to InitWait. 426 * the device's physical major and minor numbers. Switch to InitWait.
425 */ 427 */
426static int blkback_probe(struct xenbus_device *dev, 428static int xen_blkbk_probe(struct xenbus_device *dev,
427 const struct xenbus_device_id *id) 429 const struct xenbus_device_id *id)
428{ 430{
429 int err; 431 int err;
430 struct backend_info *be = kzalloc(sizeof(struct backend_info), 432 struct backend_info *be = kzalloc(sizeof(struct backend_info),
@@ -437,7 +439,7 @@ static int blkback_probe(struct xenbus_device *dev,
437 be->dev = dev; 439 be->dev = dev;
438 dev_set_drvdata(&dev->dev, be); 440 dev_set_drvdata(&dev->dev, be);
439 441
440 be->blkif = blkif_alloc(dev->otherend_id); 442 be->blkif = xen_blkif_alloc(dev->otherend_id);
441 if (IS_ERR(be->blkif)) { 443 if (IS_ERR(be->blkif)) {
442 err = PTR_ERR(be->blkif); 444 err = PTR_ERR(be->blkif);
443 be->blkif = NULL; 445 be->blkif = NULL;
@@ -461,7 +463,7 @@ static int blkback_probe(struct xenbus_device *dev,
461 463
462fail: 464fail:
463 DPRINTK("failed"); 465 DPRINTK("failed");
464 blkback_remove(dev); 466 xen_blkbk_remove(dev);
465 return err; 467 return err;
466} 468}
467 469
@@ -550,7 +552,7 @@ static void backend_changed(struct xenbus_watch *watch,
550 } 552 }
551 553
552 /* We're potentially connected now */ 554 /* We're potentially connected now */
553 update_blkif_status(be->blkif); 555 xen_update_blkif_status(be->blkif);
554 } 556 }
555} 557}
556 558
@@ -586,16 +588,16 @@ static void frontend_changed(struct xenbus_device *dev,
586 /* Enforce precondition before potential leak point. 588 /* Enforce precondition before potential leak point.
587 * blkif_disconnect() is idempotent. 589 * blkif_disconnect() is idempotent.
588 */ 590 */
589 blkif_disconnect(be->blkif); 591 xen_blkif_disconnect(be->blkif);
590 592
591 err = connect_ring(be); 593 err = connect_ring(be);
592 if (err) 594 if (err)
593 break; 595 break;
594 update_blkif_status(be->blkif); 596 xen_update_blkif_status(be->blkif);
595 break; 597 break;
596 598
597 case XenbusStateClosing: 599 case XenbusStateClosing:
598 blkif_disconnect(be->blkif); 600 xen_blkif_disconnect(be->blkif);
599 xenbus_switch_state(dev, XenbusStateClosing); 601 xenbus_switch_state(dev, XenbusStateClosing);
600 break; 602 break;
601 603
@@ -640,7 +642,7 @@ again:
640 return; 642 return;
641 } 643 }
642 644
643 err = blkback_barrier(xbt, be, 1); 645 err = xen_blkbk_barrier(xbt, be, 1);
644 if (err) 646 if (err)
645 goto abort; 647 goto abort;
646 648
@@ -726,7 +728,7 @@ static int connect_ring(struct backend_info *be)
726 ring_ref, evtchn, be->blkif->blk_protocol, protocol); 728 ring_ref, evtchn, be->blkif->blk_protocol, protocol);
727 729
728 /* Map the shared frame, irq etc. */ 730 /* Map the shared frame, irq etc. */
729 err = blkif_map(be->blkif, ring_ref, evtchn); 731 err = xen_blkif_map(be->blkif, ring_ref, evtchn);
730 if (err) { 732 if (err) {
731 xenbus_dev_fatal(dev, err, "mapping ring-ref %lu port %u", 733 xenbus_dev_fatal(dev, err, "mapping ring-ref %lu port %u",
732 ring_ref, evtchn); 734 ring_ref, evtchn);
@@ -740,23 +742,23 @@ static int connect_ring(struct backend_info *be)
740/* ** Driver Registration ** */ 742/* ** Driver Registration ** */
741 743
742 744
743static const struct xenbus_device_id blkback_ids[] = { 745static const struct xenbus_device_id xen_blkbk_ids[] = {
744 { "vbd" }, 746 { "vbd" },
745 { "" } 747 { "" }
746}; 748};
747 749
748 750
749static struct xenbus_driver blkback = { 751static struct xenbus_driver xen_blkbk = {
750 .name = "vbd", 752 .name = "vbd",
751 .owner = THIS_MODULE, 753 .owner = THIS_MODULE,
752 .ids = blkback_ids, 754 .ids = xen_blkbk_ids,
753 .probe = blkback_probe, 755 .probe = xen_blkbk_probe,
754 .remove = blkback_remove, 756 .remove = xen_blkbk_remove,
755 .otherend_changed = frontend_changed 757 .otherend_changed = frontend_changed
756}; 758};
757 759
758 760
759int blkif_xenbus_init(void) 761int xen_blkif_xenbus_init(void)
760{ 762{
761 return xenbus_register_backend(&blkback); 763 return xenbus_register_backend(&xen_blkbk);
762} 764}