From ac2d876c258207df0f1dae38ea64fc55aca71069 Mon Sep 17 00:00:00 2001 From: christos Date: Mon, 14 Nov 2011 21:34:50 +0000 Subject: [PATCH] Use getdiskinfo() to print the name of the device; the previous code constructed the wrong name if it was a wedge. --- sys/arch/xen/xen/xbdback_xenbus.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/sys/arch/xen/xen/xbdback_xenbus.c b/sys/arch/xen/xen/xbdback_xenbus.c index 1c0ee065fb6e..aa6512b9bbaa 100644 --- a/sys/arch/xen/xen/xbdback_xenbus.c +++ b/sys/arch/xen/xen/xbdback_xenbus.c @@ -1,4 +1,4 @@ -/* $NetBSD: xbdback_xenbus.c,v 1.50 2011/11/14 16:04:29 hannken Exp $ */ +/* $NetBSD: xbdback_xenbus.c,v 1.51 2011/11/14 21:34:50 christos Exp $ */ /* * Copyright (c) 2006 Manuel Bouyer. @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: xbdback_xenbus.c,v 1.50 2011/11/14 16:04:29 hannken Exp $"); +__KERNEL_RCSID(0, "$NetBSD: xbdback_xenbus.c,v 1.51 2011/11/14 21:34:50 christos Exp $"); #include #include @@ -38,7 +38,6 @@ __KERNEL_RCSID(0, "$NetBSD: xbdback_xenbus.c,v 1.50 2011/11/14 16:04:29 hannken #include #include #include -#include #include #include #include @@ -477,11 +476,14 @@ xbdback_xenbus_destroy(void *arg) } /* close device */ if (xbdi->xbdi_size) { - printf("xbd backend: detach device %s%"PRId32"%c for domain %d\n", - devsw_blk2name(major(xbdi->xbdi_dev)), - DISKUNIT(xbdi->xbdi_dev), - (char)DISKPART(xbdi->xbdi_dev) + 'a', - xbdi->xbdi_domid); + const char *name; + struct dkwedge_info wi; + if (getdiskinfo(xbdi->xbdi_vp, &wi) == 0) + name = wi.dkw_devname; + else + name = "*unknown*"; + printf("xbd backend: detach device %s for domain %d\n", + name, xbdi->xbdi_domid); vn_close(xbdi->xbdi_vp, FREAD, NOCRED); } SLIST_REMOVE(&xbdback_instances, xbdi, xbdback_instance, next);