summaryrefslogtreecommitdiffstats
path: root/sys/geom/geom_bsd.c
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2002-03-16 09:24:19 +0000
committerphk <phk@FreeBSD.org>2002-03-16 09:24:19 +0000
commit688687434f7b4bf689cb76a2bfdbcbc2b34bf03d (patch)
treedc23039ef707ddc22810bca9a45c7b8e4a21d815 /sys/geom/geom_bsd.c
parent160859d70870af6d64ca201c85b7a15c6a0a0e46 (diff)
downloadFreeBSD-src-688687434f7b4bf689cb76a2bfdbcbc2b34bf03d.zip
FreeBSD-src-688687434f7b4bf689cb76a2bfdbcbc2b34bf03d.tar.gz
Add a generic and general ioctl pass-through mechanism.
It should now be posible to issue ioctls to SCSI CD drives.
Diffstat (limited to 'sys/geom/geom_bsd.c')
-rw-r--r--sys/geom/geom_bsd.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/sys/geom/geom_bsd.c b/sys/geom/geom_bsd.c
index 47e601d..2688be1 100644
--- a/sys/geom/geom_bsd.c
+++ b/sys/geom/geom_bsd.c
@@ -89,20 +89,42 @@ g_bsd_start(struct bio *bp)
struct g_bsd_softc *ms;
struct g_slicer *gsp;
struct partinfo pi;
+ struct g_ioctl *gio;
gp = bp->bio_to->geom;
gsp = gp->softc;
ms = gsp->softc;
+#if 0
if (g_haveattr(bp, "IOCTL::DIOCGDINFO",
&ms->inram,
sizeof ms->inram))
return (1);
- if (!strcmp(bp->bio_attribute, "IOCTL::DIOCGPART")) {
+ else if (!strcmp(bp->bio_attribute, "IOCTL::DIOCGPART")) {
pi.disklab = &ms->inram;
pi.part = &ms->inram.d_partitions[bp->bio_to->index];
if (g_haveattr(bp, "IOCTL::DIOCGPART", &pi, sizeof pi))
return (1);
}
+#endif
+ if (strcmp(bp->bio_attribute, "GEOM::ioctl"))
+ return(0);
+ else if (bp->bio_length != sizeof *gio)
+ return(0);
+ gio = (struct g_ioctl *)bp->bio_data;
+ if (gio->cmd == DIOCGDINFO) {
+ bcopy(&ms->inram, gio->data, sizeof ms->inram);
+ bp->bio_error = 0;
+ g_io_deliver(bp);
+ return (1);
+ }
+ if (gio->cmd == DIOCGPART) {
+ pi.disklab = &ms->inram;
+ pi.part = &ms->inram.d_partitions[bp->bio_to->index];
+ bcopy(&pi, gio->data, sizeof pi);
+ bp->bio_error = 0;
+ g_io_deliver(bp);
+ return (1);
+ }
return (0);
}
OpenPOWER on IntegriCloud