Module Name: src Committed By: bouyer Date: Mon Jun 15 21:11:24 UTC 2009
Modified Files: src/sys/arch/xen/xen: xbd_xenbus.c Log Message: Implement DIOCGDISKINFO for xbd disk driver. To generate a diff of this commit: cvs rdiff -u -r1.39 -r1.40 src/sys/arch/xen/xen/xbd_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/xbd_xenbus.c diff -u src/sys/arch/xen/xen/xbd_xenbus.c:1.39 src/sys/arch/xen/xen/xbd_xenbus.c:1.40 --- src/sys/arch/xen/xen/xbd_xenbus.c:1.39 Tue Mar 3 19:04:41 2009 +++ src/sys/arch/xen/xen/xbd_xenbus.c Mon Jun 15 21:11:24 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: xbd_xenbus.c,v 1.39 2009/03/03 19:04:41 bouyer Exp $ */ +/* $NetBSD: xbd_xenbus.c,v 1.40 2009/06/15 21:11:24 bouyer Exp $ */ /* * Copyright (c) 2006 Manuel Bouyer. @@ -31,7 +31,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: xbd_xenbus.c,v 1.39 2009/03/03 19:04:41 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: xbd_xenbus.c,v 1.40 2009/06/15 21:11:24 bouyer Exp $"); #include "opt_xen.h" #include "rnd.h" @@ -399,6 +399,8 @@ { struct xbd_xenbus_softc *sc = device_private((device_t)arg); struct dk_geom *pdg; + prop_dictionary_t disk_info, odisk_info, geom; + char buf[9]; int s; DPRINTF(("%s: new backend state %d\n", @@ -459,6 +461,31 @@ /* Discover wedges on this disk. */ dkwedge_discover(&sc->sc_dksc.sc_dkdev); + disk_info = prop_dictionary_create(); + geom = prop_dictionary_create(); + prop_dictionary_set_uint64(geom, "sectors-per-unit", + sc->sc_dksc.sc_size); + prop_dictionary_set_uint32(geom, "sector-size", + pdg->pdg_secsize); + prop_dictionary_set_uint16(geom, "sectors-per-track", + pdg->pdg_nsectors); + prop_dictionary_set_uint16(geom, "tracks-per-cylinder", + pdg->pdg_ntracks); + prop_dictionary_set_uint64(geom, "cylinders-per-unit", + pdg->pdg_ncylinders); + prop_dictionary_set(disk_info, "geometry", geom); + prop_object_release(geom); + prop_dictionary_set(device_properties(sc->sc_dev), + "disk-info", disk_info); + /* + * Don't release disk_info here; we keep a reference to it. + * disk_detach() will release it when we go away. + */ + odisk_info = sc->sc_dksc.sc_dkdev.dk_info; + sc->sc_dksc.sc_dkdev.dk_info = disk_info; + if (odisk_info) + prop_object_release(odisk_info); + /* the disk should be working now */ config_pending_decr(); break; @@ -677,6 +704,10 @@ dksc = &sc->sc_dksc; dk = &dksc->sc_dkdev; + error = disk_ioctl(&sc->sc_dksc.sc_dkdev, cmd, data, flag, l); + if (error != EPASSTHROUGH) + return (error); + switch (cmd) { case DIOCSSTRATEGY: error = EOPNOTSUPP;