Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/xen/xenbus (purely cosmetic changes)



details:   https://anonhg.NetBSD.org/src/rev/d1307681b2b9
branches:  trunk
changeset: 763697:d1307681b2b9
user:      jym <jym%NetBSD.org@localhost>
date:      Wed Mar 30 22:34:03 2011 +0000

description:
(purely cosmetic changes)

- Use free_otherend_details() instead of calling free() on xbusd_otherend.
- rename talk_to_otherend() to watch_otherend(). We register a watch for
changes in the otherend device "state"; we are not really talking to it.
- add missing prototypes.

diffstat:

 sys/arch/xen/xenbus/xenbus_probe.c |  26 ++++++++++++++++----------
 1 files changed, 16 insertions(+), 10 deletions(-)

diffs (88 lines):

diff -r a0ebf42fe0c9 -r d1307681b2b9 sys/arch/xen/xenbus/xenbus_probe.c
--- a/sys/arch/xen/xenbus/xenbus_probe.c        Wed Mar 30 22:26:26 2011 +0000
+++ b/sys/arch/xen/xenbus/xenbus_probe.c        Wed Mar 30 22:34:03 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: xenbus_probe.c,v 1.28 2010/07/06 15:00:10 cherry Exp $ */
+/* $NetBSD: xenbus_probe.c,v 1.29 2011/03/30 22:34:03 jym Exp $ */
 /******************************************************************************
  * Talks to Xen Store to figure out what devices we have.
  *
@@ -29,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xenbus_probe.c,v 1.28 2010/07/06 15:00:10 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xenbus_probe.c,v 1.29 2011/03/30 22:34:03 jym Exp $");
 
 #if 0
 #define DPRINTK(fmt, args...) \
@@ -69,6 +69,16 @@
 static void xenbus_attach(device_t, device_t, void *);
 static int  xenbus_print(void *, const char *);
 
+/* routines gathering device information from XenStore */
+static int  read_otherend_details(struct xenbus_device *,
+               const char *, const char *);
+static int  read_backend_details (struct xenbus_device *);
+static int  read_frontend_details(struct xenbus_device *);
+static void free_otherend_details(struct xenbus_device *);
+
+static int  watch_otherend     (struct xenbus_device *);
+static void free_otherend_watch(struct xenbus_device *);
+
 static void xenbus_probe_init(void *);
 
 static struct xenbus_device *xenbus_lookup_device_path(const char *);
@@ -158,8 +168,7 @@
                printf("missing other end from %s\n", xendev->xbusd_path);
                xenbus_dev_fatal(xendev, -ENOENT, "missing other end from %s",
                                 xendev->xbusd_path);
-               free(xendev->xbusd_otherend, M_DEVBUF);
-               xendev->xbusd_otherend = NULL;
+               free_otherend_details(xendev);
                return ENOENT;
        }
 
@@ -179,15 +188,12 @@
        return read_otherend_details(xendev, "frontend-id", "frontend");
 }
 
-#if unused
 static void
 free_otherend_details(struct xenbus_device *dev)
 {
        free(dev->xbusd_otherend, M_DEVBUF);
        dev->xbusd_otherend = NULL;
 }
-#endif
-
 
 static void
 free_otherend_watch(struct xenbus_device *dev)
@@ -248,7 +254,7 @@
 }
 
 static int
-talk_to_otherend(struct xenbus_device *dev)
+watch_otherend(struct xenbus_device *dev)
 {
        free_otherend_watch(dev);
 
@@ -360,7 +366,7 @@
                }
                SLIST_INSERT_HEAD(&xenbus_device_list,
                    xbusd, xbusd_entries);
-               talk_to_otherend(xbusd);
+               watch_otherend(xbusd);
        }
        free(dir, M_DEVBUF);
        return err;
@@ -467,7 +473,7 @@
        KASSERT(xenbus_lookup_device_path(xbusd->xbusd_path) == xbusd);
        SLIST_REMOVE(&xenbus_device_list, xbusd, xenbus_device, xbusd_entries);
        free_otherend_watch(xbusd);
-       free(xbusd->xbusd_otherend, M_DEVBUF);
+       free_otherend_details(xbusd);
        xenbus_switch_state(xbusd, NULL, XenbusStateClosed);
        free(xbusd, M_DEVBUF);
        return 0;



Home | Main Index | Thread Index | Old Index