diff options
author | phk <phk@FreeBSD.org> | 2002-10-20 19:18:07 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2002-10-20 19:18:07 +0000 |
commit | 5df21f9258160fffb5804123fe9aaa50bad6be01 (patch) | |
tree | e5862f7e08664b410047651c04c18a85f96a64f8 /sys/geom | |
parent | 6539d532098bbfd2bef664a338eed9447e734f60 (diff) | |
download | FreeBSD-src-5df21f9258160fffb5804123fe9aaa50bad6be01.zip FreeBSD-src-5df21f9258160fffb5804123fe9aaa50bad6be01.tar.gz |
Make the sectorsize a property of providers so we can include it in the XML
output.
Sponsored by: DARPA & NAI Labs
Diffstat (limited to 'sys/geom')
-rw-r--r-- | sys/geom/bde/g_bde.c | 1 | ||||
-rw-r--r-- | sys/geom/geom.h | 1 | ||||
-rw-r--r-- | sys/geom/geom_bsd.c | 2 | ||||
-rw-r--r-- | sys/geom/geom_disk.c | 1 | ||||
-rw-r--r-- | sys/geom/geom_dump.c | 1 | ||||
-rw-r--r-- | sys/geom/geom_gpt.c | 1 | ||||
-rw-r--r-- | sys/geom/geom_mbr.c | 6 | ||||
-rw-r--r-- | sys/geom/geom_pc98.c | 1 | ||||
-rw-r--r-- | sys/geom/geom_slice.c | 11 | ||||
-rw-r--r-- | sys/geom/geom_slice.h | 5 | ||||
-rw-r--r-- | sys/geom/geom_sunlabel.c | 1 |
11 files changed, 24 insertions, 7 deletions
diff --git a/sys/geom/bde/g_bde.c b/sys/geom/bde/g_bde.c index 47a3645..614139c 100644 --- a/sys/geom/bde/g_bde.c +++ b/sys/geom/bde/g_bde.c @@ -254,6 +254,7 @@ g_bde_create(struct g_createargs *ga) g_topology_lock(); pp = g_new_providerf(gp, gp->name); pp->mediasize = sc->mediasize; + pp->sectorsize = sc->sectorsize; g_error_provider(pp, 0); g_topology_unlock(); break; diff --git a/sys/geom/geom.h b/sys/geom/geom.h index 4eebbdf..d12b901 100644 --- a/sys/geom/geom.h +++ b/sys/geom/geom.h @@ -169,6 +169,7 @@ struct g_provider { TAILQ_ENTRY(g_provider) orphan; int index; off_t mediasize; + u_int sectorsize; }; /* diff --git a/sys/geom/geom_bsd.c b/sys/geom/geom_bsd.c index 7818bbc..f8688e1 100644 --- a/sys/geom/geom_bsd.c +++ b/sys/geom/geom_bsd.c @@ -369,6 +369,7 @@ g_bsd_modify(struct g_geom *gp, struct disklabel *dl) error = g_slice_config(gp, i, G_SLICE_CONFIG_CHECK, (off_t)ppp->p_offset * dl->d_secsize, (off_t)ppp->p_size * dl->d_secsize, + dl->d_secsize, "%s%c", gp->name, 'a' + i); if (error) { g_topology_unlock(); @@ -382,6 +383,7 @@ g_bsd_modify(struct g_geom *gp, struct disklabel *dl) g_slice_config(gp, i, G_SLICE_CONFIG_SET, (off_t)ppp->p_offset * dl->d_secsize, (off_t)ppp->p_size * dl->d_secsize, + dl->d_secsize, "%s%c", gp->name, 'a' + i); } return (0); diff --git a/sys/geom/geom_disk.c b/sys/geom/geom_disk.c index 37cf533..5e2f939 100644 --- a/sys/geom/geom_disk.c +++ b/sys/geom/geom_disk.c @@ -99,6 +99,7 @@ g_disk_access(struct g_provider *pp, int r, int w, int e) error = 0; } pp->mediasize = dp->d_mediasize; + pp->sectorsize = dp->d_sectorsize; return (error); } diff --git a/sys/geom/geom_dump.c b/sys/geom/geom_dump.c index b8c9c8b..3827229 100644 --- a/sys/geom/geom_dump.c +++ b/sys/geom/geom_dump.c @@ -146,6 +146,7 @@ g_conf_provider(struct sbuf *sb, struct g_provider *pp) sbuf_printf(sb, "\t <name>%s</name>\n", pp->name); sbuf_printf(sb, "\t <mediasize>%jd</mediasize>\n", (intmax_t)pp->mediasize); + sbuf_printf(sb, "\t <sectorsize>%u</sectorsize>\n", pp->sectorsize); if (pp->geom->dumpconf) { sbuf_printf(sb, "\t <config>\n"); pp->geom->dumpconf(sb, "\t ", pp->geom, NULL, pp); diff --git a/sys/geom/geom_gpt.c b/sys/geom/geom_gpt.c index 7bad00f..ef23af0 100644 --- a/sys/geom/geom_gpt.c +++ b/sys/geom/geom_gpt.c @@ -226,6 +226,7 @@ g_gpt_taste(struct g_class *mp, struct g_provider *pp, int insist) (void)g_slice_addslice(gp, i, ent->ent_lba_start * secsz, (1 + ent->ent_lba_end - ent->ent_lba_start) * secsz, + secsz, "%s%c%d", gp->name, ps, i + 1); g_topology_unlock(); npart++; diff --git a/sys/geom/geom_mbr.c b/sys/geom/geom_mbr.c index 46442b1..418fa4d 100644 --- a/sys/geom/geom_mbr.c +++ b/sys/geom/geom_mbr.c @@ -242,8 +242,9 @@ g_mbr_taste(struct g_class *mp, struct g_provider *pp, int insist) ms->type[i] = dp[i].dp_typ; g_topology_lock(); pp2 = g_slice_addslice(gp, i, - ((off_t)dp[i].dp_start) << 9ULL, - ((off_t)dp[i].dp_size) << 9ULL, + (off_t)dp[i].dp_start << 9ULL, + (off_t)dp[i].dp_size << 9ULL, + sectorsize, "%ss%d", gp->name, i + 1); g_topology_unlock(); } @@ -378,6 +379,7 @@ g_mbrext_taste(struct g_class *mp, struct g_provider *pp, int insist __unused) pp2 = g_slice_addslice(gp, slice, (((off_t)dp[0].dp_start) << 9ULL) + off, ((off_t)dp[0].dp_size) << 9ULL, + sectorsize, "%*.*s%d", strlen(gp->name) - 1, strlen(gp->name) - 1, diff --git a/sys/geom/geom_pc98.c b/sys/geom/geom_pc98.c index 9e68bf7..a47724f 100644 --- a/sys/geom/geom_pc98.c +++ b/sys/geom/geom_pc98.c @@ -162,6 +162,7 @@ g_pc98_taste(struct g_class *mp, struct g_provider *pp, int flags) g_topology_lock(); pp2 = g_slice_addslice(gp, i, start, length, + sectorsize, "%ss%d", pp->name, 1 + i); g_topology_unlock(); g_error_provider(pp2, 0); diff --git a/sys/geom/geom_slice.c b/sys/geom/geom_slice.c index 2cfc998..64745bf 100644 --- a/sys/geom/geom_slice.c +++ b/sys/geom/geom_slice.c @@ -118,7 +118,6 @@ g_slice_access(struct g_provider *pp, int dr, int dw, int de) if ((cp->acr + dr) == 0 && (cp->acw + dw) == 0 && (cp->ace + de) == 1) de--; error = g_access_rel(cp, dr, dw, de); - pp->mediasize = gsp->slices[pp->index].length; return (error); } @@ -228,7 +227,7 @@ g_slice_dumpconf(struct sbuf *sb, char *indent, struct g_geom *gp, struct g_cons } int -g_slice_config(struct g_geom *gp, int index, int how, off_t offset, off_t length, char *fmt, ...) +g_slice_config(struct g_geom *gp, int index, int how, off_t offset, off_t length, u_int sectorsize, char *fmt, ...) { struct g_provider *pp; struct g_slicer *gsp; @@ -261,6 +260,7 @@ g_slice_config(struct g_geom *gp, int index, int how, off_t offset, off_t length return (0); gsl->length = length; gsl->offset = offset; + gsl->sectorsize = sectorsize; if (length != 0 && pp != NULL) return (0); if (length == 0 && pp == NULL) @@ -277,6 +277,8 @@ g_slice_config(struct g_geom *gp, int index, int how, off_t offset, off_t length sbuf_finish(sb); pp = g_new_providerf(gp, sbuf_data(sb)); pp->index = index; + pp->mediasize = gsl->length; + pp->sectorsize = gsl->sectorsize; gsl->provider = pp; gsp->nprovider++; g_error_provider(pp, 0); @@ -285,7 +287,7 @@ g_slice_config(struct g_geom *gp, int index, int how, off_t offset, off_t length } struct g_provider * -g_slice_addslice(struct g_geom *gp, int index, off_t offset, off_t length, char *fmt, ...) +g_slice_addslice(struct g_geom *gp, int index, off_t offset, off_t length, u_int sectorsize, char *fmt, ...) { struct g_provider *pp; struct g_slicer *gsp; @@ -305,6 +307,9 @@ g_slice_addslice(struct g_geom *gp, int index, off_t offset, off_t length, char gsp->slices[index].length = length; gsp->slices[index].offset = offset; gsp->slices[index].provider = pp; + gsp->slices[index].sectorsize = sectorsize; + pp->mediasize = gsp->slices[index].length; + pp->sectorsize = gsp->slices[index].sectorsize; sbuf_delete(sb); return(pp); } diff --git a/sys/geom/geom_slice.h b/sys/geom/geom_slice.h index 8a1a27f..11be047 100644 --- a/sys/geom/geom_slice.h +++ b/sys/geom/geom_slice.h @@ -41,6 +41,7 @@ struct g_slice { off_t offset; off_t length; + u_int sectorsize; struct g_provider *provider; }; @@ -57,8 +58,8 @@ struct g_slicer { }; g_dumpconf_t g_slice_dumpconf; -struct g_provider * g_slice_addslice(struct g_geom *gp, int index, off_t offset, off_t length, char *fmt, ...); -int g_slice_config(struct g_geom *gp, int index, int how, off_t offset, off_t length, char *fmt, ...); +struct g_provider * g_slice_addslice(struct g_geom *gp, int index, off_t offset, off_t length, u_int sectorsize, char *fmt, ...); +int g_slice_config(struct g_geom *gp, int index, int how, off_t offset, off_t length, u_int sectorsize, char *fmt, ...); #define G_SLICE_CONFIG_CHECK 0 #define G_SLICE_CONFIG_SET 1 #define G_SLICE_CONFIG_FORCE 2 diff --git a/sys/geom/geom_sunlabel.c b/sys/geom/geom_sunlabel.c index 97a7390..78d496a 100644 --- a/sys/geom/geom_sunlabel.c +++ b/sys/geom/geom_sunlabel.c @@ -172,6 +172,7 @@ g_sunlabel_taste(struct g_class *mp, struct g_provider *pp, int flags) pp2 = g_slice_addslice(gp, i, ((off_t)v * csize) << 9ULL, ((off_t)u) << 9ULL, + sectorsize, "%s%c", pp->name, 'a' + i); g_topology_unlock(); g_error_provider(pp2, 0); |