diff --git a/sys/geom/geom.h b/sys/geom/geom.h index 7fcdf3c6381d..3bab33d11413 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 d56ac53c7311..22151db9cdeb 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 dcaee02f0852..619e0ed66503 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, " \n", gp); sbuf_printf(sb, " \n", gp->class); sbuf_printf(sb, " %s\n", gp->name); sbuf_printf(sb, " %d\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, " \n"); - sbuf_printf(sb, " %.8s\n", - gsp->name); - sbuf_printf(sb, " %lld\n", - (long long)gsp->offset); - sbuf_printf(sb, " %u\n", - gsp->len); - sbuf_printf(sb, " %u\n", - gsp->flags); - sbuf_printf(sb, " \n"); - } - } if (gp->dumpconf) { sbuf_printf(sb, " \n"); gp->dumpconf(sb, "\t", gp, NULL, NULL); diff --git a/sys/geom/geom_mbr.c b/sys/geom/geom_mbr.c index e00632c13396..1b1ca4daae54 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 c6de3cc559d1..550dec6a7521 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 126afaede551..d0b75f7fafbe 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); }