summaryrefslogtreecommitdiffstats
path: root/sys/geom/geom.h
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2002-05-21 20:33:49 +0000
committerphk <phk@FreeBSD.org>2002-05-21 20:33:49 +0000
commit476ca0197fe439db32412d254212efdcc10bd9cf (patch)
treefec49ff015cfe691229ddfbcf6205b4f482aec1e /sys/geom/geom.h
parent4c8f46cf75901f6eeca741030d0075e8789c0566 (diff)
downloadFreeBSD-src-476ca0197fe439db32412d254212efdcc10bd9cf.zip
FreeBSD-src-476ca0197fe439db32412d254212efdcc10bd9cf.tar.gz
Introduce the concept of "magic spaces", and implement them in most of
the relevant classes. 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. Sponsored by: DARPA & NAI Labs.
Diffstat (limited to 'sys/geom/geom.h')
-rw-r--r--sys/geom/geom.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/sys/geom/geom.h b/sys/geom/geom.h
index dafe65e..8fdf07d 100644
--- a/sys/geom/geom.h
+++ b/sys/geom/geom.h
@@ -61,6 +61,7 @@ struct g_event;
struct thread;
struct bio;
struct sbuf;
+struct g_magicspaces;
typedef struct g_geom * g_create_geom_t (struct g_class *mp,
@@ -122,6 +123,7 @@ struct g_geom {
void *softc;
struct g_event *event;
unsigned flags;
+ struct g_magicspaces *magicspaces;
#define G_GEOM_WITHER 1
};
@@ -172,6 +174,32 @@ 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;
+ struct g_magicspace *magicspace;
+};
+
/* geom_dump.c */
void g_hexdump(void *ptr, int length);
void g_trace(int level, char *, ...);
@@ -195,6 +223,7 @@ 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, u_int index, 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);
@@ -210,6 +239,7 @@ int g_haveattr_off_t(struct bio *bp, char *attribute, off_t val);
struct g_geom * g_insert_geom(char *class, struct g_consumer *cp);
struct g_consumer * g_new_consumer(struct g_geom *gp);
struct g_geom * g_new_geomf(struct g_class *mp, char *fmt, ...);
+int g_new_magicspaces(struct g_geom *gp, int nspaces);
struct g_provider * g_new_providerf(struct g_geom *gp, char *fmt, ...);
void g_sanity(void *ptr);
void g_spoil(struct g_provider *pp, struct g_consumer *cp);
OpenPOWER on IntegriCloud