From fec26e0e4c415446caa9d13d63ba1ac771abf196 Mon Sep 17 00:00:00 2001 From: Marcel Moolenaar Date: Wed, 23 Oct 2002 03:33:06 +0000 Subject: [PATCH] Don't complain if we have an inconsistent map that may be the result of an incomplete migration. An incomplete migration is one where the MBR is not turned into a PMBR after creating the GPT. This early in the game it's more convenient to allow the inconsistency, because that avoids that we have to destroy the MBR partitioning for now. --- sbin/gpt/map.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/sbin/gpt/map.c b/sbin/gpt/map.c index 93d0f6159a7c..5aba63cd66c9 100644 --- a/sbin/gpt/map.c +++ b/sbin/gpt/map.c @@ -69,20 +69,25 @@ map_add(off_t start, off_t size, int type, void *data) } if (n->map_start == start && n->map_size == size) { - if (n->map_type != MAP_TYPE_UNUSED) - warnx("warning: partition(%llu,%llu) mirrored", - (long long)start, (long long)size); + if (n->map_type != MAP_TYPE_UNUSED) { + if (n->map_type != MAP_TYPE_MBR_PART || + type != MAP_TYPE_GPT_PART) { + warnx("warning: partition(%llu,%llu) mirrored", + (long long)start, (long long)size); + } + } n->map_type = type; n->map_data = data; return (n); } if (n->map_type != MAP_TYPE_UNUSED) { - warnx( - "error: partition(%llu,%llu) overlaps partition(%llu,%llu)", - (long long)start, (long long)size, - (long long)n->map_start, (long long)n->map_size); - return (0); + if (n->map_type != MAP_TYPE_MBR_PART || + type != MAP_TYPE_GPT_PART) { + warnx("error: bogus map"); + return (0); + } + n->map_type = MAP_TYPE_UNUSED; } m = mkmap(start, size, type);