diff options
| author | Kyle Evans <kevans@FreeBSD.org> | 2019-09-03 20:57:20 +0000 |
|---|---|---|
| committer | Kyle Evans <kevans@FreeBSD.org> | 2019-09-03 20:57:20 +0000 |
| commit | ef03f57dd201827cc74615571c410273e49a5964 (patch) | |
| tree | 817841551cbdd7b5ab38853f4cd816fb400f6830 /sys/geom | |
| parent | dca52ab480bfe71c3dc1d86822e551a7d1c9ec72 (diff) | |
Notes
Diffstat (limited to 'sys/geom')
| -rw-r--r-- | sys/geom/part/g_part.c | 12 | ||||
| -rw-r--r-- | sys/geom/part/g_part_gpt.c | 16 |
2 files changed, 23 insertions, 5 deletions
diff --git a/sys/geom/part/g_part.c b/sys/geom/part/g_part.c index 3b8fe3916aece..583fa190f9f86 100644 --- a/sys/geom/part/g_part.c +++ b/sys/geom/part/g_part.c @@ -143,6 +143,10 @@ static u_int auto_resize = 1; SYSCTL_UINT(_kern_geom_part, OID_AUTO, auto_resize, CTLFLAG_RWTUN, &auto_resize, 1, "Enable auto resize"); +static u_int allow_nesting = 0; +SYSCTL_UINT(_kern_geom_part, OID_AUTO, allow_nesting, + CTLFLAG_RWTUN, &allow_nesting, 0, + "Allow additional levels of nesting"); /* * The GEOM partitioning class. @@ -2271,7 +2275,13 @@ g_part_start(struct bio *bp) return; if (g_handleattr_int(bp, "GEOM::fwsectors", table->gpt_sectors)) return; - if (g_handleattr_int(bp, "PART::isleaf", table->gpt_isleaf)) + /* + * allow_nesting overrides "isleaf" to false _unless_ the + * provider offset is zero, since otherwise we would recurse. + */ + if (g_handleattr_int(bp, "PART::isleaf", + table->gpt_isleaf && + (allow_nesting == 0 || entry->gpe_offset == 0))) return; if (g_handleattr_int(bp, "PART::depth", table->gpt_depth)) return; diff --git a/sys/geom/part/g_part_gpt.c b/sys/geom/part/g_part_gpt.c index f69cd84efab49..5eb2c03fe5523 100644 --- a/sys/geom/part/g_part_gpt.c +++ b/sys/geom/part/g_part_gpt.c @@ -54,6 +54,14 @@ __FBSDID("$FreeBSD$"); FEATURE(geom_part_gpt, "GEOM partitioning class for GPT partitions support"); +SYSCTL_DECL(_kern_geom_part); +static SYSCTL_NODE(_kern_geom_part, OID_AUTO, gpt, CTLFLAG_RW, 0, + "GEOM_PART_GPT GUID Partition Table"); + +static u_int allow_nesting = 0; +SYSCTL_UINT(_kern_geom_part_gpt, OID_AUTO, allow_nesting, + CTLFLAG_RWTUN, &allow_nesting, 0, "Allow GPT to be nested inside other schemes"); + CTASSERT(offsetof(struct gpt_hdr, padding) == 92); CTASSERT(sizeof(struct gpt_ent) == 128); @@ -652,8 +660,8 @@ g_part_gpt_create(struct g_part_table *basetable, struct g_part_parms *gpp) struct g_part_gpt_table *table; size_t tblsz; - /* We don't nest, which means that our depth should be 0. */ - if (basetable->gpt_depth != 0) + /* Our depth should be 0 unless nesting was explicitly enabled. */ + if (!allow_nesting && basetable->gpt_depth != 0) return (ENXIO); table = (struct g_part_gpt_table *)basetable; @@ -815,8 +823,8 @@ g_part_gpt_probe(struct g_part_table *table, struct g_consumer *cp) u_char *buf; int error, index, pri, res; - /* We don't nest, which means that our depth should be 0. */ - if (table->gpt_depth != 0) + /* Our depth should be 0 unless nesting was explicitly enabled. */ + if (!allow_nesting && table->gpt_depth != 0) return (ENXIO); pp = cp->provider; |
