Use MBR_PTYPE_ defines from <sys/bootblock.h>.

This commit is contained in:
jakllsch 2013-12-04 20:15:51 +00:00
parent e22b4ebb4a
commit 16550bc8bd
3 changed files with 12 additions and 10 deletions

View File

@ -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 <sys/types.h>
#include <sys/bootblock.h>
#include <err.h>
#include <stddef.h>
@ -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;

View File

@ -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 <sys/param.h>
@ -39,6 +39,7 @@ __RCSID("$NetBSD: gpt.c,v 1.24 2013/11/27 01:47:53 jnemeth Exp $");
#include <sys/disk.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <sys/bootblock.h>
#include <err.h>
#include <errno.h>
@ -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);

View File

@ -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 <sys/types.h>
@ -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;