diff options
author | phk <phk@FreeBSD.org> | 2002-09-06 08:50:28 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2002-09-06 08:50:28 +0000 |
commit | 42ca888ae8c4fc973e744c26f157b8f17d46744c (patch) | |
tree | 066067ca6695e2c968ad2b897234a1d43d1ac949 /sys/geom | |
parent | 33a29ee495ec7a6be113d9fd823bdb77e2c5a34c (diff) | |
download | FreeBSD-src-42ca888ae8c4fc973e744c26f157b8f17d46744c.zip FreeBSD-src-42ca888ae8c4fc973e744c26f157b8f17d46744c.tar.gz |
Remove "magicspace". It looks good on paper, it doesn't work in practice.
Sponsored by: DARPA & NAI Labs.
Diffstat (limited to 'sys/geom')
-rw-r--r-- | sys/geom/geom.h | 31 | ||||
-rw-r--r-- | sys/geom/geom_bsd.c | 14 | ||||
-rw-r--r-- | sys/geom/geom_dump.c | 19 | ||||
-rw-r--r-- | sys/geom/geom_mbr.c | 3 | ||||
-rw-r--r-- | sys/geom/geom_subr.c | 44 | ||||
-rw-r--r-- | sys/geom/geom_sunlabel.c | 4 |
6 files changed, 2 insertions, 113 deletions
diff --git a/sys/geom/geom.h b/sys/geom/geom.h index 7fcdf3c..3bab33d 100644 --- a/sys/geom/geom.h +++ b/sys/geom/geom.h @@ -61,8 +61,6 @@ struct g_event; struct thread; struct bio; struct sbuf; -struct g_magicspaces; - typedef struct g_geom * g_create_geom_t (struct g_class *mp, struct g_provider *pp, char *name); @@ -123,7 +121,6 @@ struct g_geom { void *softc; struct g_event *event; unsigned flags; - struct g_magicspaces *magicspaces; #define G_GEOM_WITHER 1 }; @@ -174,33 +171,6 @@ struct g_provider { off_t mediasize; }; -/* - * Some methods may implement various "magic spaces", this is reserved - * or magic areas on the disk, set a side for various and sundry purposes. - * A good example is the BSD disklabel and boot code on i386 which occupies - * a total of four magic spaces: boot1, the disklabel, the padding behind - * the disklabel and boot2. The reason we don't simply tell people to - * write the appropriate stuff on the underlying device is that (some of) - * the magic spaces might be real-time modifiable. It is for instance - * possible to change a disklabel while partitions are open, provided - * the open partitions do not get trampled in the process. - */ - -struct g_magicspace { - char name[8]; - off_t offset; - u_int len; - u_int flags; -}; - -struct g_magicspaces { - uintptr_t geom_id; - char class[8]; - uint nmagic; - uint nspace; - struct g_magicspace *magicspace; -}; - /* geom_dump.c */ void g_hexdump(void *ptr, int length); void g_trace(int level, char *, ...); @@ -224,7 +194,6 @@ void g_silence(void); int g_access_abs(struct g_consumer *cp, int read, int write, int exclusive); int g_access_rel(struct g_consumer *cp, int read, int write, int exclusive); void g_add_class(struct g_class *mp); -int g_add_magicspace(struct g_geom *gp, const char *name, off_t start, u_int len, u_int flags); int g_attach(struct g_consumer *cp, struct g_provider *pp); struct g_geom *g_create_geomf(char *class, struct g_provider *, char *fmt, ...); void g_destroy_consumer(struct g_consumer *cp); diff --git a/sys/geom/geom_bsd.c b/sys/geom/geom_bsd.c index d56ac53..22151db 100644 --- a/sys/geom/geom_bsd.c +++ b/sys/geom/geom_bsd.c @@ -338,20 +338,8 @@ g_bsd_taste(struct g_class *mp, struct g_provider *pp, int flags) error, (long long)mediasize); } error = g_bsd_try(gsp, cp, secsize, ms, secsize); - if (!error) { - g_add_magicspace(gp, "boot1", 0, 512, 0); - g_add_magicspace(gp, "label", 512, 276, 0); - g_add_magicspace(gp, "fill0", 748, 236, 0); - g_add_magicspace(gp, "boot2", 1024, 7168, 0); - } - if (error) { + if (error) error = g_bsd_try(gsp, cp, secsize, ms, 64); - if (!error) { - g_add_magicspace(gp, "fill0", 0, 64, 0); - g_add_magicspace(gp, "label", 64, 276, 0); - g_add_magicspace(gp, "fill1", 340, 172, 0); - } - } if (error) break; dl = &ms->ondisk; diff --git a/sys/geom/geom_dump.c b/sys/geom/geom_dump.c index dcaee02..619e0ed 100644 --- a/sys/geom/geom_dump.c +++ b/sys/geom/geom_dump.c @@ -157,30 +157,11 @@ g_conf_geom(struct sbuf *sb, struct g_geom *gp, struct g_provider *pp, struct g_ { struct g_consumer *cp2; struct g_provider *pp2; - struct g_magicspace *gsp; - u_int u; sbuf_printf(sb, " <geom id=\"%p\">\n", gp); sbuf_printf(sb, " <class ref=\"%p\"/>\n", gp->class); sbuf_printf(sb, " <name>%s</name>\n", gp->name); sbuf_printf(sb, " <rank>%d</rank>\n", gp->rank); - if (gp->magicspaces) { - for (u = 0; u < gp->magicspaces->nmagic; u++) { - gsp = &gp->magicspaces->magicspace[u]; - if (gsp->len == 0 || gsp->name == NULL) - continue; - sbuf_printf(sb, " <magicspace>\n"); - sbuf_printf(sb, " <name>%.8s</name>\n", - gsp->name); - sbuf_printf(sb, " <offset>%lld</offset>\n", - (long long)gsp->offset); - sbuf_printf(sb, " <length>%u</length>\n", - gsp->len); - sbuf_printf(sb, " <flags>%u</flags>\n", - gsp->flags); - sbuf_printf(sb, " </magicspace>\n"); - } - } if (gp->dumpconf) { sbuf_printf(sb, " <config>\n"); gp->dumpconf(sb, "\t", gp, NULL, NULL); diff --git a/sys/geom/geom_mbr.c b/sys/geom/geom_mbr.c index e00632c1..1b1ca4d 100644 --- a/sys/geom/geom_mbr.c +++ b/sys/geom/geom_mbr.c @@ -251,9 +251,6 @@ g_mbr_taste(struct g_class *mp, struct g_provider *pp, int insist) g_topology_lock(); error = g_access_rel(cp, -1, 0, 0); if (npart > 0) { - g_add_magicspace(gp, "boot", 0, DOSPARTOFF, 0); - g_add_magicspace(gp, "mbr", DOSPARTOFF, 4 * 16, 0); - g_add_magicspace(gp, "magic", 510, 2, 0); LIST_FOREACH(pp, &gp->provider, provider) g_error_provider(pp, 0); return (gp); diff --git a/sys/geom/geom_subr.c b/sys/geom/geom_subr.c index c6de3cc..550dec6 100644 --- a/sys/geom/geom_subr.c +++ b/sys/geom/geom_subr.c @@ -114,46 +114,6 @@ g_new_geomf(struct g_class *mp, char *fmt, ...) return (gp); } -/* - * Add a magic space to a geom. There is no locking here because nobody - * should be modifying these except the geom itself during configuration, - * so it cannot go away while we fiddling it. - * For now, no provision exists for removing magic spaces or for changing - * them on the fly. - */ - -int -g_add_magicspace(struct g_geom *gp, const char *name, off_t start, u_int len, u_int flags) -{ - int i; - struct g_magicspaces *msps; - struct g_magicspace *msp, *msp2; - - if (gp->magicspaces == NULL) { - msps = g_malloc(sizeof *gp->magicspaces, M_WAITOK | M_ZERO); - msps->geom_id = (uintptr_t)gp; - strncpy(msps->class, gp->class->name, sizeof msps->class); - gp->magicspaces = msps; - } - msps = gp->magicspaces; - if (msps->nmagic >= msps->nspace) { - i = msps->nspace + 1; - msp = g_malloc(sizeof(*msp) * i, M_WAITOK | M_ZERO); - bcopy(msps->magicspace, msp, sizeof(*msp) * msps->nmagic); - msp2 = msps->magicspace; - msps->magicspace = msp; - if (msp2 != NULL) - g_free(msp2); - msps->nspace = i; - } - msp = &msps->magicspace[msps->nmagic++]; - strncpy(msp->name, name, sizeof msp->name); - msp->offset = start; - msp->len = len; - msp->flags = flags; - return (0); -} - void g_destroy_geom(struct g_geom *gp) { @@ -169,10 +129,6 @@ g_destroy_geom(struct g_geom *gp) gp->name, LIST_FIRST(&gp->consumer))); LIST_REMOVE(gp, geom); TAILQ_REMOVE(&geoms, gp, geoms); - if (gp->magicspaces) { - g_free(gp->magicspaces->magicspace); - g_free(gp->magicspaces); - } g_free(gp->name); g_free(gp); } diff --git a/sys/geom/geom_sunlabel.c b/sys/geom/geom_sunlabel.c index 126afae..d0b75f7 100644 --- a/sys/geom/geom_sunlabel.c +++ b/sys/geom/geom_sunlabel.c @@ -179,10 +179,8 @@ g_sunlabel_taste(struct g_class *mp, struct g_provider *pp, int flags) } g_topology_lock(); error = g_access_rel(cp, -1, 0, 0); - if (npart > 0) { - g_add_magicspace(gp, "label", 0, 512, 0); + if (npart > 0) return (gp); - } g_std_spoiled(cp); return (NULL); } |