From 16550bc8bd74d1c00b320858b4855bef54b756f2 Mon Sep 17 00:00:00 2001 From: jakllsch Date: Wed, 4 Dec 2013 20:15:51 +0000 Subject: [PATCH] Use MBR_PTYPE_ defines from . --- sbin/gpt/create.c | 5 +++-- sbin/gpt/gpt.c | 13 +++++++------ sbin/gpt/migrate.c | 4 ++-- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/sbin/gpt/create.c b/sbin/gpt/create.c index 1a37c557b284..b734d33f7a27 100644 --- a/sbin/gpt/create.c +++ b/sbin/gpt/create.c @@ -29,10 +29,11 @@ __FBSDID("$FreeBSD: src/sbin/gpt/create.c,v 1.11 2005/08/31 01:47:19 marcel Exp $"); #endif #ifdef __RCSID -__RCSID("$NetBSD: create.c,v 1.6 2013/04/13 18:04:33 jakllsch Exp $"); +__RCSID("$NetBSD: create.c,v 1.7 2013/12/04 20:15:51 jakllsch Exp $"); #endif #include +#include #include #include @@ -103,7 +104,7 @@ create(int fd) mbr->mbr_part[0].part_shd = 0x00; mbr->mbr_part[0].part_ssect = 0x02; mbr->mbr_part[0].part_scyl = 0x00; - mbr->mbr_part[0].part_typ = 0xee; + mbr->mbr_part[0].part_typ = MBR_PTYPE_PMBR; mbr->mbr_part[0].part_ehd = 0xfe; mbr->mbr_part[0].part_esect = 0xff; mbr->mbr_part[0].part_ecyl = 0xff; diff --git a/sbin/gpt/gpt.c b/sbin/gpt/gpt.c index 3face7aa2959..7a5cc0d5d8d1 100644 --- a/sbin/gpt/gpt.c +++ b/sbin/gpt/gpt.c @@ -31,7 +31,7 @@ __FBSDID("$FreeBSD: src/sbin/gpt/gpt.c,v 1.16 2006/07/07 02:44:23 marcel Exp $"); #endif #ifdef __RCSID -__RCSID("$NetBSD: gpt.c,v 1.24 2013/11/27 01:47:53 jnemeth Exp $"); +__RCSID("$NetBSD: gpt.c,v 1.25 2013/12/04 20:15:51 jakllsch Exp $"); #endif #include @@ -39,6 +39,7 @@ __RCSID("$NetBSD: gpt.c,v 1.24 2013/11/27 01:47:53 jnemeth Exp $"); #include #include #include +#include #include #include @@ -392,9 +393,9 @@ gpt_mbr(int fd, off_t lba) */ pmbr = 0; for (i = 0; i < 4; i++) { - if (mbr->mbr_part[i].part_typ == 0) + if (mbr->mbr_part[i].part_typ == MBR_PTYPE_UNUSED) continue; - if (mbr->mbr_part[i].part_typ == 0xee) + if (mbr->mbr_part[i].part_typ == MBR_PTYPE_PMBR) pmbr++; else break; @@ -419,8 +420,8 @@ gpt_mbr(int fd, off_t lba) if (p == NULL) return (-1); for (i = 0; i < 4; i++) { - if (mbr->mbr_part[i].part_typ == 0 || - mbr->mbr_part[i].part_typ == 0xee) + if (mbr->mbr_part[i].part_typ == MBR_PTYPE_UNUSED || + mbr->mbr_part[i].part_typ == MBR_PTYPE_PMBR) continue; start = le16toh(mbr->mbr_part[i].part_start_hi); start = (start << 16) + le16toh(mbr->mbr_part[i].part_start_lo); @@ -437,7 +438,7 @@ gpt_mbr(int fd, off_t lba) warnx("%s: MBR part: type=%d, start=%llu, size=%llu", device_name, mbr->mbr_part[i].part_typ, (long long)start, (long long)size); - if (mbr->mbr_part[i].part_typ != 15) { + if (mbr->mbr_part[i].part_typ != MBR_PTYPE_EXT_LBA) { m = map_add(start, size, MAP_TYPE_MBR_PART, p); if (m == NULL) return (-1); diff --git a/sbin/gpt/migrate.c b/sbin/gpt/migrate.c index 6d8897e526d1..eeb8d0da596b 100644 --- a/sbin/gpt/migrate.c +++ b/sbin/gpt/migrate.c @@ -29,7 +29,7 @@ __FBSDID("$FreeBSD: src/sbin/gpt/migrate.c,v 1.16 2005/09/01 02:42:52 marcel Exp $"); #endif #ifdef __RCSID -__RCSID("$NetBSD: migrate.c,v 1.13 2013/12/04 19:59:47 jakllsch Exp $"); +__RCSID("$NetBSD: migrate.c,v 1.14 2013/12/04 20:15:51 jakllsch Exp $"); #endif #include @@ -433,7 +433,7 @@ migrate(int fd) mbr->mbr_part[0].part_shd = 0x00; mbr->mbr_part[0].part_ssect = 0x02; mbr->mbr_part[0].part_scyl = 0x00; - mbr->mbr_part[0].part_typ = 0xee; + mbr->mbr_part[0].part_typ = MBR_PTYPE_PMBR; mbr->mbr_part[0].part_ehd = 0xfe; mbr->mbr_part[0].part_esect = 0xff; mbr->mbr_part[0].part_ecyl = 0xff;