diff options
author | Poul-Henning Kamp <phk@FreeBSD.org> | 2002-10-20 20:28:24 +0000 |
---|---|---|
committer | Poul-Henning Kamp <phk@FreeBSD.org> | 2002-10-20 20:28:24 +0000 |
commit | 3f12caa1802e84dc2234069edb93f1040ca01027 (patch) | |
tree | 4be4d44cd73707526477ac8dedf166de6841e46d /sys/geom/geom_sunlabel.c | |
parent | 943305f753597261cb01a76f4876ce5325968867 (diff) | |
download | src-3f12caa1802e84dc2234069edb93f1040ca01027.tar.gz src-3f12caa1802e84dc2234069edb93f1040ca01027.zip |
Now that the sectorsize and mediasize are properties of the provider,
don't take the detour over the I/O path to discover them using getattr(),
we can just pick them out directly.
Do note though, that for now they are only valid after the first open
of the underlying disk device due compatibility with the old disk_create()
API. This will change in the future so they will always be valid.
Sponsored by: DARPA & NAI Labs.
Notes
Notes:
svn path=/head/; revision=105551
Diffstat (limited to 'sys/geom/geom_sunlabel.c')
-rw-r--r-- | sys/geom/geom_sunlabel.c | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/sys/geom/geom_sunlabel.c b/sys/geom/geom_sunlabel.c index 78d496a9bac0..5c9d6ad123cf 100644 --- a/sys/geom/geom_sunlabel.c +++ b/sys/geom/geom_sunlabel.c @@ -110,19 +110,11 @@ g_sunlabel_taste(struct g_class *mp, struct g_provider *pp, int flags) while (1) { /* a trick to allow us to use break */ if (gp->rank != 2 && flags == G_TF_NORMAL) break; - error = g_getattr("GEOM::sectorsize", cp, §orsize); - if (error) { - sectorsize = 512; - printf("g_sunlabel_taste: error %d Sectors are %d bytes\n", - error, sectorsize); - } + sectorsize = cp->provider->sectorsize; + if (sectorsize < 512) + break; gsp->frontstuff = 16 * sectorsize; - error = g_getattr("GEOM::mediasize", cp, &mediasize); - if (error) { - mediasize = 0; - printf("g_error %d Mediasize is %lld bytes\n", - error, (long long)mediasize); - } + mediasize = cp->provider->mediasize; buf = g_read_data(cp, 0, sectorsize, &error); if (buf == NULL || error != 0) break; |