Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sbin/gpt Use MBR_PTYPE_ defines from <sys/bootblock.h>.



details:   https://anonhg.NetBSD.org/src/rev/a100b40ee6f8
branches:  trunk
changeset: 325092:a100b40ee6f8
user:      jakllsch <jakllsch%NetBSD.org@localhost>
date:      Wed Dec 04 20:15:51 2013 +0000

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

diffstat:

 sbin/gpt/create.c  |   5 +++--
 sbin/gpt/gpt.c     |  13 +++++++------
 sbin/gpt/migrate.c |   4 ++--
 3 files changed, 12 insertions(+), 10 deletions(-)

diffs (98 lines):

diff -r 8439d098336d -r a100b40ee6f8 sbin/gpt/create.c
--- a/sbin/gpt/create.c Wed Dec 04 19:59:47 2013 +0000
+++ b/sbin/gpt/create.c Wed Dec 04 20:15:51 2013 +0000
@@ -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 @@
                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 -r 8439d098336d -r a100b40ee6f8 sbin/gpt/gpt.c
--- a/sbin/gpt/gpt.c    Wed Dec 04 19:59:47 2013 +0000
+++ b/sbin/gpt/gpt.c    Wed Dec 04 20:15:51 2013 +0000
@@ -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 @@
 #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 @@
         */
        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 @@
        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 @@
                        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 -r 8439d098336d -r a100b40ee6f8 sbin/gpt/migrate.c
--- a/sbin/gpt/migrate.c        Wed Dec 04 19:59:47 2013 +0000
+++ b/sbin/gpt/migrate.c        Wed Dec 04 20:15:51 2013 +0000
@@ -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 @@
        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;



Home | Main Index | Thread Index | Old Index