Skip to contentSkip to conversation

Rename frontend functions to be unique

GIT In review Ian Campbell 2 participants 7 messages Dec 4, 2009

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

All Xen frontend drivers have a couple of identically named functions which makes figuring out which device went wrong from a stacktrace harder than it needs to be. Rename them to something specificto the device type.

The following changes since commit 167bafd71a448f50dba5db362b813029838d04c9:
Jeremy Fitzhardinge (1):
Merge branch 'xen/dom0/apic' into xen/master

are available in the git repository at:

git://xenbits.xensource.com/people/ianc/linux-2.6.git for-jeremy/rollup

or individually from
git://xenbits.xensource.com/people/ianc/linux-2.6.git for-jeremy/netfront
git://xenbits.xensource.com/people/ianc/linux-2.6.git for-jeremy/blkfront
git://xenbits.xensource.com/people/ianc/linux-2.6.git for-jeremy/netchannel2

Ian Campbell (3):
xen: use less generic names in netfront driver.
xen: use less generic names in blkfront driver.
xen: use less generic names in netfront2 driver.

 drivers/block/xen-blkfront.c            |   12 ++++++------
 drivers/net/xen-netchannel2/netfront2.c |    4 ++--
 drivers/net/xen-netfront.c              |   10 +++++-----
 3 files changed, 13 insertions(+), 13 deletions(-)
#1 lore raw

PATCH 1/1 xen: use less generic names in netfront driver.

All Xen frontend drivers have a couple of identically named functions which makes figuring out which device went wrong from a stacktrace harder than it needs to be. Rename them to something specificto the device type.

Cc Jeremy Fitzhardinge <[email protected]>
---
 drivers/net/xen-netfront.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)
drivers/net/xen-netfront.c +5 -5
index 9b1cd57..64cf31e 100644
@@ -1276,7 +1276,7 @@ static void xennet_disconnect_backend(struct netfront_info *info)
 static int netfront_resume(struct xenbus_device *dev)
 {
 	struct netfront_info *info = dev_get_drvdata(&dev->dev);
-
+	return 0;
 	dev_dbg(&dev->dev, "%s\n", dev->nodename);
 
 	xennet_disconnect_backend(info);
@@ -1393,7 +1393,7 @@ static int setup_netfront(struct xenbus_device *dev, struct netfront_info *info)
 }
 
 /* Common code used when first setting up, and when resuming. */
-static int talk_to_backend(struct xenbus_device *dev,
+static int talk_to_netback(struct xenbus_device *dev,
 			   struct netfront_info *info)
 {
 	const char *message;
@@ -1543,7 +1543,7 @@ static int xennet_connect(struct net_device *dev)
 		return -ENODEV;
 	}
 
-	err = talk_to_backend(np->xbdev, np);
+	err = talk_to_netback(np->xbdev, np);
 	if (err)
 		return err;
 
@@ -1597,7 +1597,7 @@ static int xennet_connect(struct net_device *dev)
 /**
  * Callback received when the backend's state changes.
  */
-static void backend_changed(struct xenbus_device *dev,
+static void netback_changed(struct xenbus_device *dev,
 			    enum xenbus_state backend_state)
 {
 	struct netfront_info *np = dev_get_drvdata(&dev->dev);
@@ -1800,7 +1800,7 @@ static struct xenbus_driver netfront_driver = {
 	.probe = netfront_probe,
 	.remove = __devexit_p(xennet_remove),
 	.resume = netfront_resume,
-	.otherend_changed = backend_changed,
+	.otherend_changed = netback_changed,
 };
 
 static int __init netif_init(void)
Signature · 1 line
1.5.6.5
#2 lore raw

Re: [PATCH] xen: use less generic names in netfront driver.

Quoted 10 lines · Ian Campbell
drivers/net/xen-netfront.c +1 -1
@@ -1276,7 +1276,7 @@ static void xennet_disconnect_backend(struct
 netfront_info *info)
 static int netfront_resume(struct xenbus_device *dev)
 {
        struct netfront_info *info = dev_get_drvdata(&dev->dev);
-
+       return 0;
        dev_dbg(&dev->dev, "%s\n", dev->nodename);
 
        xennet_disconnect_backend(info); 

Doh, this hunk was obviously accidental. I've updated the git branch.

Ian.

#3 lore raw

Re: [PATCH] xen: use less generic names in netfront driver.

Quoted 11 lines · Ian Campbell
Quoted 9 lines · Ian Campbell
drivers/net/xen-netfront.c +1 -1
@@ -1276,7 +1276,7 @@ static void xennet_disconnect_backend(struct
 netfront_info *info)
  static int netfront_resume(struct xenbus_device *dev)
  {
         struct netfront_info *info = dev_get_drvdata(&dev->dev);
-
+       return 0;
         dev_dbg(&dev->dev, "%s\n", dev->nodename);
 
Quoted 3 lines
Quoted 2 lines
         xennet_disconnect_backend(info);

Doh, this hunk was obviously accidental. I've updated the git branch.

Thanks, I'd picked up the updated one anyway.

J

#4 lore raw

PATCH 1/1 xen: use less generic names in blkfront driver.

In reply to Ian Campbell

All Xen frontend drivers have a couple of identically named functions which makes figuring out which device went wrong from a stacktrace harder than it needs to be. Rename them to something specificto the device type.

Cc Jeremy Fitzhardinge <[email protected]>
---
 drivers/block/xen-blkfront.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)
drivers/block/xen-blkfront.c +6 -6
index 9aff0f5..837b992 100644
@@ -650,7 +650,7 @@ fail:
 
 
 /* Common code used when first setting up, and when resuming. */
-static int talk_to_backend(struct xenbus_device *dev,
+static int talk_to_blkback(struct xenbus_device *dev,
 			   struct blkfront_info *info)
 {
 	const char *message = NULL;
@@ -755,7 +755,7 @@ static int blkfront_probe(struct xenbus_device *dev,
 	info->handle = simple_strtoul(strrchr(dev->nodename, '/')+1, NULL, 0);
 	dev_set_drvdata(&dev->dev, info);
 
-	err = talk_to_backend(dev, info);
+	err = talk_to_blkback(dev, info);
 	if (err) {
 		kfree(info);
 		dev_set_drvdata(&dev->dev, NULL);
@@ -850,7 +850,7 @@ static int blkfront_resume(struct xenbus_device *dev)
 
 	blkif_free(info, info->connected == BLKIF_STATE_CONNECTED);
 
-	err = talk_to_backend(dev, info);
+	err = talk_to_blkback(dev, info);
 	if (info->connected == BLKIF_STATE_SUSPENDED && !err)
 		err = blkif_recover(info);
 
@@ -954,13 +954,13 @@ static void blkfront_closing(struct xenbus_device *dev)
 /**
  * Callback received when the backend's state changes.
  */
-static void backend_changed(struct xenbus_device *dev,
+static void blkback_changed(struct xenbus_device *dev,
 			    enum xenbus_state backend_state)
 {
 	struct blkfront_info *info = dev_get_drvdata(&dev->dev);
 	struct block_device *bd;
 
-	dev_dbg(&dev->dev, "blkfront:backend_changed.\n");
+	dev_dbg(&dev->dev, "blkfront:blkback_changed to state %d.\n", backend_state);
 
 	switch (backend_state) {
 	case XenbusStateInitialising:
@@ -1063,7 +1063,7 @@ static struct xenbus_driver blkfront = {
 	.probe = blkfront_probe,
 	.remove = blkfront_remove,
 	.resume = blkfront_resume,
-	.otherend_changed = backend_changed,
+	.otherend_changed = blkback_changed,
 	.is_ready = blkfront_is_ready,
 };
 
Signature · 1 line
1.5.6.5
#5 lore raw

PATCH 1/1 xen: use less generic names in netfront2 driver.

In reply to Ian Campbell

All Xen frontend drivers have a couple of identically named functions which makes figuring out which device went wrong from a stacktrace harder than it needs to be. Rename them to something specificto the device type.

Cc Jeremy Fitzhardinge <[email protected]>
---
 drivers/net/xen-netchannel2/netfront2.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/xen-netchannel2/netfront2.c +2 -2
index f360b43..d5e12c0 100644
@@ -342,7 +342,7 @@ static int allocate_rings(struct netfront2 *nf, domid_t otherend)
 	return 0;
 }
 
-static void backend_changed(struct xenbus_device *xd,
+static void netback2_changed(struct xenbus_device *xd,
 			    enum xenbus_state backend_state)
 {
 	struct netfront2 *nf = xenbus_device_to_nf2(xd);
@@ -498,7 +498,7 @@ static struct xenbus_driver netfront2 = {
 	.ids = netfront_ids,
 	.probe = netfront_probe,
 	.remove = __devexit_p(netfront_remove),
-	.otherend_changed = backend_changed,
+	.otherend_changed = netback2_changed,
 	.resume = netfront_resume,
 	.suspend = netfront_suspend,
 };
Signature · 1 line
1.5.6.5
#6 lore raw
In reply to Ian Campbell
Quoted 5 lines · Ian Campbell

or individually from
git://xenbits.xensource.com/people/ianc/linux-2.6.git for-jeremy/netfront
git://xenbits.xensource.com/people/ianc/linux-2.6.git for-jeremy/blkfront
git://xenbits.xensource.com/people/ianc/linux-2.6.git for-jeremy/netchannel2

BTW, I have a single xen/frontend branch for netfront and blkfront, on the assumption that changes to them are going to be minor bugfix type stuff. I cherry-picked your patches over to it.

J