summaryrefslogtreecommitdiffstats
path: root/sys/geom/geom_sunlabel.c
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2002-04-09 15:43:32 +0000
committerphk <phk@FreeBSD.org>2002-04-09 15:43:32 +0000
commita90e28ebbb699c856787836be56197be575fad47 (patch)
treeb29d97c613e2113a270ed79ca6d8e042d070ec82 /sys/geom/geom_sunlabel.c
parentc2f17d16c728a0248466b433fc6c8ad52023ac3d (diff)
downloadFreeBSD-src-a90e28ebbb699c856787836be56197be575fad47.zip
FreeBSD-src-a90e28ebbb699c856787836be56197be575fad47.tar.gz
Implement DIOCGFRONTSTUFF ioctl which reports how many bytes from the start
of the device magic stuff might occupy. Sponsored by: DARPA & NAI Labs.
Diffstat (limited to 'sys/geom/geom_sunlabel.c')
-rw-r--r--sys/geom/geom_sunlabel.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/sys/geom/geom_sunlabel.c b/sys/geom/geom_sunlabel.c
index 78d9c87..3363f4e 100644
--- a/sys/geom/geom_sunlabel.c
+++ b/sys/geom/geom_sunlabel.c
@@ -89,11 +89,12 @@ g_sunlabel_taste(struct g_class *mp, struct g_provider *pp, int flags)
struct g_geom *gp;
struct g_consumer *cp;
struct g_provider *pp2;
- int error, i, j, npart;
+ int error, i, npart;
u_char *buf;
struct g_sunlabel_softc *ms;
u_int sectorsize, u, v, csize;
off_t mediasize;
+ struct g_slicer *gsp;
g_trace(G_T_TOPOLOGY, "g_sunlabel_taste(%s,%s)", mp->name, pp->name);
g_topology_assert();
@@ -103,21 +104,21 @@ g_sunlabel_taste(struct g_class *mp, struct g_provider *pp, int flags)
gp = g_slice_new(mp, 8, pp, &cp, &ms, sizeof *ms, g_sunlabel_start);
if (gp == NULL)
return (NULL);
+ gsp = gp->softc;
g_topology_unlock();
gp->dumpconf = g_sunlabel_dumpconf;
npart = 0;
while (1) { /* a trick to allow us to use break */
if (gp->rank != 2 && flags == G_TF_NORMAL)
break;
- j = sizeof sectorsize;
- error = g_io_getattr("GEOM::sectorsize", cp, &j, &sectorsize);
+ error = g_getattr("GEOM::sectorsize", cp, &sectorsize);
if (error) {
sectorsize = 512;
printf("g_sunlabel_taste: error %d Sectors are %d bytes\n",
error, sectorsize);
}
- j = sizeof mediasize;
- error = g_io_getattr("GEOM::mediasize", cp, &j, &mediasize);
+ gsp->frontstuff = 16 * sectorsize;
+ error = g_getattr("GEOM::mediasize", cp, &mediasize);
if (error) {
mediasize = 0;
printf("g_error %d Mediasize is %lld bytes\n",
OpenPOWER on IntegriCloud