Module Name: src
Committed By: snj
Date: Mon Sep 28 00:42:34 UTC 2009
Modified Files:
src/sys/arch/xen/xen [netbsd-5]: xbd_xenbus.c
Log Message:
Pull up following revision(s) (requested by bouyer in ticket #1025):
sys/arch/xen/xen/xbd_xenbus.c: revision 1.40
Implement DIOCGDISKINFO for xbd disk driver.
To generate a diff of this commit:
cvs rdiff -u -r1.34.2.1 -r1.34.2.2 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.34.2.1 src/sys/arch/xen/xen/xbd_xenbus.c:1.34.2.2
--- src/sys/arch/xen/xen/xbd_xenbus.c:1.34.2.1 Sun Mar 8 03:12:50 2009
+++ src/sys/arch/xen/xen/xbd_xenbus.c Mon Sep 28 00:42:34 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: xbd_xenbus.c,v 1.34.2.1 2009/03/08 03:12:50 snj Exp $ */
+/* $NetBSD: xbd_xenbus.c,v 1.34.2.2 2009/09/28 00:42:34 snj Exp $ */
/*
* Copyright (c) 2006 Manuel Bouyer.
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xbd_xenbus.c,v 1.34.2.1 2009/03/08 03:12:50 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xbd_xenbus.c,v 1.34.2.2 2009/09/28 00:42:34 snj Exp $");
#include "opt_xen.h"
#include "rnd.h"
@@ -395,6 +395,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", device_xname(sc->sc_dev), new_state));
@@ -454,6 +456,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;
@@ -669,6 +696,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;