summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormarcel <marcel@FreeBSD.org>2008-04-23 20:13:05 +0000
committermarcel <marcel@FreeBSD.org>2008-04-23 20:13:05 +0000
commit38e8adf72053670c84a15fd57d641357ec1d4501 (patch)
tree0e7bf464079f7c3553cf6f191b95c9772ae66018
parentf7fcfdc595633492f520f12db8f7447003ab54b3 (diff)
downloadFreeBSD-src-38e8adf72053670c84a15fd57d641357ec1d4501.zip
FreeBSD-src-38e8adf72053670c84a15fd57d641357ec1d4501.tar.gz
Implement the G_PART_DUMPCONF method for all 6 schemes. Also call
the method for the (indent == NULL) case (i.e. the kern.geom.conftxt sysctl). The purpose is to extend the conftxt output with scheme- specific fields which can be used by libdisk. In particular, have the schemes dump the xs and xt fields, which contain the backward compatible values for class type and partition type. This allows libdisk to work with the legacy slicers as well as with gpart and helps/promotes migration.
-rw-r--r--sys/geom/part/g_part.c7
-rw-r--r--sys/geom/part/g_part_apm.c17
-rw-r--r--sys/geom/part/g_part_bsd.c17
-rw-r--r--sys/geom/part/g_part_gpt.c18
-rw-r--r--sys/geom/part/g_part_mbr.c17
-rw-r--r--sys/geom/part/g_part_pc98.c18
-rw-r--r--sys/geom/part/g_part_vtoc8.c19
7 files changed, 113 insertions, 0 deletions
diff --git a/sys/geom/part/g_part.c b/sys/geom/part/g_part.c
index f05d750..68b2515 100644
--- a/sys/geom/part/g_part.c
+++ b/sys/geom/part/g_part.c
@@ -1489,6 +1489,13 @@ g_part_dumpconf(struct sbuf *sb, const char *indent, struct g_geom *gp,
sbuf_printf(sb, " i %u o %ju ty %s", entry->gpe_index,
(uintmax_t)entry->gpe_offset,
G_PART_TYPE(table, entry, buf, sizeof(buf)));
+ /*
+ * libdisk compatibility quirk - the scheme dumps the
+ * slicer name and partition type in a way that is
+ * compatible with libdisk. When libdisk is not used
+ * anymore, this should go away.
+ */
+ G_PART_DUMPCONF(table, entry, sb, indent);
} else if (cp != NULL) { /* Consumer configuration. */
KASSERT(pp == NULL, (__func__));
/* none */
diff --git a/sys/geom/part/g_part_apm.c b/sys/geom/part/g_part_apm.c
index 3b4ec73..34647c3 100644
--- a/sys/geom/part/g_part_apm.c
+++ b/sys/geom/part/g_part_apm.c
@@ -61,6 +61,8 @@ static int g_part_apm_add(struct g_part_table *, struct g_part_entry *,
struct g_part_parms *);
static int g_part_apm_create(struct g_part_table *, struct g_part_parms *);
static int g_part_apm_destroy(struct g_part_table *, struct g_part_parms *);
+static int g_part_apm_dumpconf(struct g_part_table *, struct g_part_entry *,
+ struct sbuf *, const char *);
static int g_part_apm_dumpto(struct g_part_table *, struct g_part_entry *);
static int g_part_apm_modify(struct g_part_table *, struct g_part_entry *,
struct g_part_parms *);
@@ -76,6 +78,7 @@ static kobj_method_t g_part_apm_methods[] = {
KOBJMETHOD(g_part_add, g_part_apm_add),
KOBJMETHOD(g_part_create, g_part_apm_create),
KOBJMETHOD(g_part_destroy, g_part_apm_destroy),
+ KOBJMETHOD(g_part_dumpconf, g_part_apm_dumpconf),
KOBJMETHOD(g_part_dumpto, g_part_apm_dumpto),
KOBJMETHOD(g_part_modify, g_part_apm_modify),
KOBJMETHOD(g_part_name, g_part_apm_name),
@@ -229,6 +232,20 @@ g_part_apm_destroy(struct g_part_table *basetable, struct g_part_parms *gpp)
}
static int
+g_part_apm_dumpconf(struct g_part_table *table, struct g_part_entry *baseentry,
+ struct sbuf *sb, const char *indent)
+{
+ struct g_part_apm_entry *entry;
+
+ if (indent != NULL)
+ return (0);
+
+ entry = (struct g_part_apm_entry *)baseentry;
+ sbuf_printf(sb, " xs APPLE xt %s", entry->ent.ent_type);
+ return (0);
+}
+
+static int
g_part_apm_dumpto(struct g_part_table *table, struct g_part_entry *baseentry)
{
struct g_part_apm_entry *entry;
diff --git a/sys/geom/part/g_part_bsd.c b/sys/geom/part/g_part_bsd.c
index 533cd507..24f896e 100644
--- a/sys/geom/part/g_part_bsd.c
+++ b/sys/geom/part/g_part_bsd.c
@@ -60,6 +60,8 @@ static int g_part_bsd_add(struct g_part_table *, struct g_part_entry *,
struct g_part_parms *);
static int g_part_bsd_create(struct g_part_table *, struct g_part_parms *);
static int g_part_bsd_destroy(struct g_part_table *, struct g_part_parms *);
+static int g_part_bsd_dumpconf(struct g_part_table *, struct g_part_entry *,
+ struct sbuf *, const char *);
static int g_part_bsd_dumpto(struct g_part_table *, struct g_part_entry *);
static int g_part_bsd_modify(struct g_part_table *, struct g_part_entry *,
struct g_part_parms *);
@@ -75,6 +77,7 @@ static kobj_method_t g_part_bsd_methods[] = {
KOBJMETHOD(g_part_add, g_part_bsd_add),
KOBJMETHOD(g_part_create, g_part_bsd_create),
KOBJMETHOD(g_part_destroy, g_part_bsd_destroy),
+ KOBJMETHOD(g_part_dumpconf, g_part_bsd_dumpconf),
KOBJMETHOD(g_part_dumpto, g_part_bsd_dumpto),
KOBJMETHOD(g_part_modify, g_part_bsd_modify),
KOBJMETHOD(g_part_name, g_part_bsd_name),
@@ -214,6 +217,20 @@ g_part_bsd_destroy(struct g_part_table *basetable, struct g_part_parms *gpp)
}
static int
+g_part_bsd_dumpconf(struct g_part_table *table, struct g_part_entry *baseentry,
+ struct sbuf *sb, const char *indent)
+{
+ struct g_part_bsd_entry *entry;
+
+ if (indent != NULL)
+ return (0);
+
+ entry = (struct g_part_bsd_entry *)baseentry;
+ sbuf_printf(sb, " xs BSD xt %u", entry->part.p_fstype);
+ return (0);
+}
+
+static int
g_part_bsd_dumpto(struct g_part_table *table, struct g_part_entry *baseentry)
{
struct g_part_bsd_entry *entry;
diff --git a/sys/geom/part/g_part_gpt.c b/sys/geom/part/g_part_gpt.c
index cc9cdfc..d2df420 100644
--- a/sys/geom/part/g_part_gpt.c
+++ b/sys/geom/part/g_part_gpt.c
@@ -88,6 +88,8 @@ static int g_part_gpt_add(struct g_part_table *, struct g_part_entry *,
static int g_part_gpt_bootcode(struct g_part_table *, struct g_part_parms *);
static int g_part_gpt_create(struct g_part_table *, struct g_part_parms *);
static int g_part_gpt_destroy(struct g_part_table *, struct g_part_parms *);
+static int g_part_gpt_dumpconf(struct g_part_table *, struct g_part_entry *,
+ struct sbuf *, const char *);
static int g_part_gpt_dumpto(struct g_part_table *, struct g_part_entry *);
static int g_part_gpt_modify(struct g_part_table *, struct g_part_entry *,
struct g_part_parms *);
@@ -104,6 +106,7 @@ static kobj_method_t g_part_gpt_methods[] = {
KOBJMETHOD(g_part_bootcode, g_part_gpt_bootcode),
KOBJMETHOD(g_part_create, g_part_gpt_create),
KOBJMETHOD(g_part_destroy, g_part_gpt_destroy),
+ KOBJMETHOD(g_part_dumpconf, g_part_gpt_dumpconf),
KOBJMETHOD(g_part_dumpto, g_part_gpt_dumpto),
KOBJMETHOD(g_part_modify, g_part_gpt_modify),
KOBJMETHOD(g_part_name, g_part_gpt_name),
@@ -430,6 +433,21 @@ g_part_gpt_destroy(struct g_part_table *basetable, struct g_part_parms *gpp)
}
static int
+g_part_gpt_dumpconf(struct g_part_table *table, struct g_part_entry *baseentry,
+ struct sbuf *sb, const char *indent)
+{
+ struct g_part_gpt_entry *entry;
+
+ if (indent != NULL)
+ return (0);
+
+ entry = (struct g_part_gpt_entry *)baseentry;
+ sbuf_printf(sb, " xs GPT xt ");
+ sbuf_printf_uuid(sb, &entry->ent.ent_type);
+ return (0);
+}
+
+static int
g_part_gpt_dumpto(struct g_part_table *table, struct g_part_entry *baseentry)
{
struct g_part_gpt_entry *entry;
diff --git a/sys/geom/part/g_part_mbr.c b/sys/geom/part/g_part_mbr.c
index 5741b15..b4c625d 100644
--- a/sys/geom/part/g_part_mbr.c
+++ b/sys/geom/part/g_part_mbr.c
@@ -62,6 +62,8 @@ static int g_part_mbr_add(struct g_part_table *, struct g_part_entry *,
static int g_part_mbr_bootcode(struct g_part_table *, struct g_part_parms *);
static int g_part_mbr_create(struct g_part_table *, struct g_part_parms *);
static int g_part_mbr_destroy(struct g_part_table *, struct g_part_parms *);
+static int g_part_mbr_dumpconf(struct g_part_table *, struct g_part_entry *,
+ struct sbuf *, const char *);
static int g_part_mbr_dumpto(struct g_part_table *, struct g_part_entry *);
static int g_part_mbr_modify(struct g_part_table *, struct g_part_entry *,
struct g_part_parms *);
@@ -78,6 +80,7 @@ static kobj_method_t g_part_mbr_methods[] = {
KOBJMETHOD(g_part_bootcode, g_part_mbr_bootcode),
KOBJMETHOD(g_part_create, g_part_mbr_create),
KOBJMETHOD(g_part_destroy, g_part_mbr_destroy),
+ KOBJMETHOD(g_part_dumpconf, g_part_mbr_dumpconf),
KOBJMETHOD(g_part_dumpto, g_part_mbr_dumpto),
KOBJMETHOD(g_part_modify, g_part_mbr_modify),
KOBJMETHOD(g_part_name, g_part_mbr_name),
@@ -246,6 +249,20 @@ g_part_mbr_destroy(struct g_part_table *basetable, struct g_part_parms *gpp)
}
static int
+g_part_mbr_dumpconf(struct g_part_table *table, struct g_part_entry *baseentry,
+ struct sbuf *sb, const char *indent)
+{
+ struct g_part_mbr_entry *entry;
+
+ if (indent != NULL)
+ return (0);
+
+ entry = (struct g_part_mbr_entry *)baseentry;
+ sbuf_printf(sb, " xs MBR xt %u", entry->ent.dp_typ);
+ return (0);
+}
+
+static int
g_part_mbr_dumpto(struct g_part_table *table, struct g_part_entry *baseentry)
{
struct g_part_mbr_entry *entry;
diff --git a/sys/geom/part/g_part_pc98.c b/sys/geom/part/g_part_pc98.c
index 05d56f3..0c98241 100644
--- a/sys/geom/part/g_part_pc98.c
+++ b/sys/geom/part/g_part_pc98.c
@@ -63,6 +63,8 @@ static int g_part_pc98_add(struct g_part_table *, struct g_part_entry *,
static int g_part_pc98_bootcode(struct g_part_table *, struct g_part_parms *);
static int g_part_pc98_create(struct g_part_table *, struct g_part_parms *);
static int g_part_pc98_destroy(struct g_part_table *, struct g_part_parms *);
+static int g_part_pc98_dumpconf(struct g_part_table *, struct g_part_entry *,
+ struct sbuf *, const char *);
static int g_part_pc98_dumpto(struct g_part_table *, struct g_part_entry *);
static int g_part_pc98_modify(struct g_part_table *, struct g_part_entry *,
struct g_part_parms *);
@@ -79,6 +81,7 @@ static kobj_method_t g_part_pc98_methods[] = {
KOBJMETHOD(g_part_bootcode, g_part_pc98_bootcode),
KOBJMETHOD(g_part_create, g_part_pc98_create),
KOBJMETHOD(g_part_destroy, g_part_pc98_destroy),
+ KOBJMETHOD(g_part_dumpconf, g_part_pc98_dumpconf),
KOBJMETHOD(g_part_dumpto, g_part_pc98_dumpto),
KOBJMETHOD(g_part_modify, g_part_pc98_modify),
KOBJMETHOD(g_part_name, g_part_pc98_name),
@@ -234,6 +237,21 @@ g_part_pc98_destroy(struct g_part_table *basetable, struct g_part_parms *gpp)
}
static int
+g_part_pc98_dumpconf(struct g_part_table *table,
+ struct g_part_entry *baseentry, struct sbuf *sb, const char *indent)
+{
+ struct g_part_pc98_entry *entry;
+ u_int type;
+ if (indent != NULL)
+ return (0);
+
+ entry = (struct g_part_pc98_entry *)baseentry;
+ type = entry->ent.dp_mid + (entry->ent.dp_sid << 8);
+ sbuf_printf(sb, " xs PC98 xt %u", type);
+ return (0);
+}
+
+static int
g_part_pc98_dumpto(struct g_part_table *table, struct g_part_entry *baseentry)
{
struct g_part_pc98_entry *entry;
diff --git a/sys/geom/part/g_part_vtoc8.c b/sys/geom/part/g_part_vtoc8.c
index 05804c7..efe6d44 100644
--- a/sys/geom/part/g_part_vtoc8.c
+++ b/sys/geom/part/g_part_vtoc8.c
@@ -55,6 +55,8 @@ static int g_part_vtoc8_add(struct g_part_table *, struct g_part_entry *,
struct g_part_parms *);
static int g_part_vtoc8_create(struct g_part_table *, struct g_part_parms *);
static int g_part_vtoc8_destroy(struct g_part_table *, struct g_part_parms *);
+static int g_part_vtoc8_dumpconf(struct g_part_table *, struct g_part_entry *,
+ struct sbuf *, const char *);
static int g_part_vtoc8_dumpto(struct g_part_table *, struct g_part_entry *);
static int g_part_vtoc8_modify(struct g_part_table *, struct g_part_entry *,
struct g_part_parms *);
@@ -70,6 +72,7 @@ static kobj_method_t g_part_vtoc8_methods[] = {
KOBJMETHOD(g_part_add, g_part_vtoc8_add),
KOBJMETHOD(g_part_create, g_part_vtoc8_create),
KOBJMETHOD(g_part_destroy, g_part_vtoc8_destroy),
+ KOBJMETHOD(g_part_dumpconf, g_part_vtoc8_dumpconf),
KOBJMETHOD(g_part_dumpto, g_part_vtoc8_dumpto),
KOBJMETHOD(g_part_modify, g_part_vtoc8_modify),
KOBJMETHOD(g_part_name, g_part_vtoc8_name),
@@ -236,6 +239,22 @@ g_part_vtoc8_destroy(struct g_part_table *basetable, struct g_part_parms *gpp)
}
static int
+g_part_vtoc8_dumpconf(struct g_part_table *basetable,
+ struct g_part_entry *entry, struct sbuf *sb, const char *indent)
+{
+ struct g_part_vtoc8_table *table;
+
+ if (indent != NULL)
+ return (0);
+
+ table = (struct g_part_vtoc8_table *)basetable;
+ sbuf_printf(sb, " xs SUN sc %u hd %u alt %u",
+ be16dec(&table->vtoc.nsecs), be16dec(&table->vtoc.nheads),
+ be16dec(&table->vtoc.altcyls));
+ return (0);
+}
+
+static int
g_part_vtoc8_dumpto(struct g_part_table *basetable, struct g_part_entry *entry)
{
struct g_part_vtoc8_table *table;
OpenPOWER on IntegriCloud