Module Name: src Committed By: christos Date: Sun Nov 13 23:02:06 UTC 2011
Modified Files: src/sys/arch/xen/xen: xbdback_xenbus.c Log Message: use getdiskinfo() To generate a diff of this commit: cvs rdiff -u -r1.48 -r1.49 src/sys/arch/xen/xen/xbdback_xenbus.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/xen/xen/xbdback_xenbus.c diff -u src/sys/arch/xen/xen/xbdback_xenbus.c:1.48 src/sys/arch/xen/xen/xbdback_xenbus.c:1.49 --- src/sys/arch/xen/xen/xbdback_xenbus.c:1.48 Tue Oct 25 13:25:47 2011 +++ src/sys/arch/xen/xen/xbdback_xenbus.c Sun Nov 13 18:02:06 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: xbdback_xenbus.c,v 1.48 2011/10/25 17:25:47 bouyer Exp $ */ +/* $NetBSD: xbdback_xenbus.c,v 1.49 2011/11/13 23:02:06 christos Exp $ */ /* * Copyright (c) 2006 Manuel Bouyer. @@ -26,7 +26,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: xbdback_xenbus.c,v 1.48 2011/10/25 17:25:47 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: xbdback_xenbus.c,v 1.49 2011/11/13 23:02:06 christos Exp $"); #include <sys/types.h> #include <sys/param.h> @@ -37,7 +37,7 @@ __KERNEL_RCSID(0, "$NetBSD: xbdback_xenb #include <sys/atomic.h> #include <sys/conf.h> #include <sys/disk.h> -#include <sys/disklabel.h> +#include <sys/device.h> #include <sys/fcntl.h> #include <sys/vnode.h> #include <sys/kauth.h> @@ -760,27 +760,12 @@ xbdback_backend_changed(struct xenbus_wa /* dk device; get wedge data */ struct dkwedge_info wi; - if ((err = VOP_IOCTL(xbdi->xbdi_vp, DIOCGWEDGEINFO, &wi, - FREAD, NOCRED)) == 0) { + if ((err = getdiskinfo(xbdi->xbdi_vp, &wi)) == 0) { xbdi->xbdi_size = wi.dkw_size; printf("xbd backend: attach device %s (size %" PRIu64 ") " "for domain %d\n", wi.dkw_devname, xbdi->xbdi_size, xbdi->xbdi_domid); - } else { - /* disk device, get partition data */ - struct partinfo dpart; - if ((err = VOP_IOCTL(xbdi->xbdi_vp, DIOCGPART, &dpart, - FREAD, 0)) == 0) { - xbdi->xbdi_size = dpart.part->p_size; - printf("xbd backend: attach device %s%"PRId32 - "%c (size %" PRIu64 ") for domain %d\n", - devname, DISKUNIT(xbdi->xbdi_dev), - (char)DISKPART(xbdi->xbdi_dev) + 'a', xbdi->xbdi_size, - xbdi->xbdi_domid); - } - } - - if (err != 0) { + } else { /* If both Ioctls failed set device size to 0 and return */ printf("xbdback %s: can't DIOCGWEDGEINFO device " "0x%"PRIx64": %d\n", xbusd->xbusd_path,