Tue Jun 7 16:41:14 2011 UTC ()
Be more consistent for event handler naming with block backend: it is
xbdback(4) rather than xbd(4), and use i for identifier separation
(like xvif(4)).

The name is not used outside from event counters (vmstat -i), so
should be transparent to Xen block scripts.


(jym)
diff -r1.38 -r1.39 src/sys/arch/xen/xen/xbdback_xenbus.c

cvs diff -r1.38 -r1.39 src/sys/arch/xen/xen/xbdback_xenbus.c (expand / switch to unified diff)

--- src/sys/arch/xen/xen/xbdback_xenbus.c 2011/05/26 22:16:42 1.38
+++ src/sys/arch/xen/xen/xbdback_xenbus.c 2011/06/07 16:41:14 1.39
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: xbdback_xenbus.c,v 1.38 2011/05/26 22:16:42 jym Exp $ */ 1/* $NetBSD: xbdback_xenbus.c,v 1.39 2011/06/07 16:41:14 jym Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2006 Manuel Bouyer. 4 * Copyright (c) 2006 Manuel Bouyer.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright 11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the 12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution. 13 * documentation and/or other materials provided with the distribution.
14 * 14 *
@@ -16,27 +16,27 @@ @@ -16,27 +16,27 @@
16 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 16 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 17 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 18 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 * 25 *
26 */ 26 */
27 27
28#include <sys/cdefs.h> 28#include <sys/cdefs.h>
29__KERNEL_RCSID(0, "$NetBSD: xbdback_xenbus.c,v 1.38 2011/05/26 22:16:42 jym Exp $"); 29__KERNEL_RCSID(0, "$NetBSD: xbdback_xenbus.c,v 1.39 2011/06/07 16:41:14 jym Exp $");
30 30
31#include <sys/types.h> 31#include <sys/types.h>
32#include <sys/param.h> 32#include <sys/param.h>
33#include <sys/systm.h> 33#include <sys/systm.h>
34#include <sys/malloc.h> 34#include <sys/malloc.h>
35#include <sys/queue.h> 35#include <sys/queue.h>
36#include <sys/kernel.h> 36#include <sys/kernel.h>
37#include <sys/atomic.h> 37#include <sys/atomic.h>
38#include <sys/conf.h> 38#include <sys/conf.h>
39#include <sys/disk.h> 39#include <sys/disk.h>
40#include <sys/disklabel.h> 40#include <sys/disklabel.h>
41#include <sys/fcntl.h> 41#include <sys/fcntl.h>
42#include <sys/vnode.h> 42#include <sys/vnode.h>
@@ -578,33 +578,33 @@ xbdback_connect(struct xbdback_instance  @@ -578,33 +578,33 @@ xbdback_connect(struct xbdback_instance
578 evop.u.bind_interdomain.remote_dom = xbdi->xbdi_domid; 578 evop.u.bind_interdomain.remote_dom = xbdi->xbdi_domid;
579 evop.u.bind_interdomain.remote_port = revtchn; 579 evop.u.bind_interdomain.remote_port = revtchn;
580 err = HYPERVISOR_event_channel_op(&evop); 580 err = HYPERVISOR_event_channel_op(&evop);
581 if (err) { 581 if (err) {
582 aprint_error("blkback %s: " 582 aprint_error("blkback %s: "
583 "can't get event channel: %d\n", 583 "can't get event channel: %d\n",
584 xbusd->xbusd_otherend, err); 584 xbusd->xbusd_otherend, err);
585 xenbus_dev_fatal(xbusd, err, 585 xenbus_dev_fatal(xbusd, err,
586 "can't bind event channel", xbusd->xbusd_otherend); 586 "can't bind event channel", xbusd->xbusd_otherend);
587 goto err2; 587 goto err2;
588 } 588 }
589 xbdi->xbdi_evtchn = evop.u.bind_interdomain.local_port; 589 xbdi->xbdi_evtchn = evop.u.bind_interdomain.local_port;
590 590
591 snprintf(evname, sizeof(evname), "xbd%d.%d", 591 snprintf(evname, sizeof(evname), "xbdback%di%d",
592 xbdi->xbdi_domid, xbdi->xbdi_handle); 592 xbdi->xbdi_domid, xbdi->xbdi_handle);
593 event_set_handler(xbdi->xbdi_evtchn, xbdback_evthandler, 593 event_set_handler(xbdi->xbdi_evtchn, xbdback_evthandler,
594 xbdi, IPL_BIO, evname); 594 xbdi, IPL_BIO, evname);
595 aprint_verbose("xbd backend 0x%x for domain %d " 595 aprint_verbose("xbd backend domain %d handle %#x (%d) "
596 "using event channel %d, protocol %s\n", xbdi->xbdi_handle, 596 "using event channel %d, protocol %s\n", xbdi->xbdi_domid,
597 xbdi->xbdi_domid, xbdi->xbdi_evtchn, proto); 597 xbdi->xbdi_handle, xbdi->xbdi_handle, xbdi->xbdi_evtchn, proto);
598 hypervisor_enable_event(xbdi->xbdi_evtchn); 598 hypervisor_enable_event(xbdi->xbdi_evtchn);
599 hypervisor_notify_via_evtchn(xbdi->xbdi_evtchn); 599 hypervisor_notify_via_evtchn(xbdi->xbdi_evtchn);
600 xbdi->xbdi_status = CONNECTED; 600 xbdi->xbdi_status = CONNECTED;
601 return 0; 601 return 0;
602 602
603err2: 603err2:
604 /* unmap ring */ 604 /* unmap ring */
605 ungrop.host_addr = xbdi->xbdi_ring_va; 605 ungrop.host_addr = xbdi->xbdi_ring_va;
606 ungrop.handle = xbdi->xbdi_ring_handle; 606 ungrop.handle = xbdi->xbdi_ring_handle;
607 ungrop.dev_bus_addr = 0; 607 ungrop.dev_bus_addr = 0;
608 err = HYPERVISOR_grant_table_op(GNTTABOP_unmap_grant_ref, 608 err = HYPERVISOR_grant_table_op(GNTTABOP_unmap_grant_ref,
609 &ungrop, 1); 609 &ungrop, 1);
610 if (err) 610 if (err)