From owner-svn-src-head@freebsd.org Sun Oct 16 02:55:54 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C50D6C11937; Sun, 16 Oct 2016 02:55:54 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9F2E9C92; Sun, 16 Oct 2016 02:55:54 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9G2trKD054359; Sun, 16 Oct 2016 02:55:53 GMT (envelope-from marcel@FreeBSD.org) Received: (from marcel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9G2trba054350; Sun, 16 Oct 2016 02:55:53 GMT (envelope-from marcel@FreeBSD.org) Message-Id: <201610160255.u9G2trba054350@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marcel set sender to marcel@FreeBSD.org using -f From: Marcel Moolenaar Date: Sun, 16 Oct 2016 02:55:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r307387 - head/usr.bin/mkimg X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Oct 2016 02:55:54 -0000 Author: marcel Date: Sun Oct 16 02:55:52 2016 New Revision: 307387 URL: https://svnweb.freebsd.org/changeset/base/307387 Log: Switch to using the portable partition scheme headers. Modified: head/usr.bin/mkimg/Makefile head/usr.bin/mkimg/apm.c head/usr.bin/mkimg/bsd.c head/usr.bin/mkimg/ebr.c head/usr.bin/mkimg/gpt.c head/usr.bin/mkimg/mbr.c head/usr.bin/mkimg/pc98.c head/usr.bin/mkimg/vtoc8.c Modified: head/usr.bin/mkimg/Makefile ============================================================================== --- head/usr.bin/mkimg/Makefile Sun Oct 16 02:43:51 2016 (r307386) +++ head/usr.bin/mkimg/Makefile Sun Oct 16 02:55:52 2016 (r307387) @@ -11,6 +11,7 @@ mkimg.o: Makefile CFLAGS+=-DMKIMG_VERSION=${MKIMG_VERSION} CFLAGS+=-DSPARSE_WRITE +CFLAGS+=-I${.CURDIR:H:H}/sys # List of formats to support SRCS+= \ Modified: head/usr.bin/mkimg/apm.c ============================================================================== --- head/usr.bin/mkimg/apm.c Sun Oct 16 02:43:51 2016 (r307386) +++ head/usr.bin/mkimg/apm.c Sun Oct 16 02:55:52 2016 (r307387) @@ -33,20 +33,13 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include #include "endian.h" #include "image.h" #include "mkimg.h" #include "scheme.h" -#ifndef APM_ENT_TYPE_APPLE_BOOT -#define APM_ENT_TYPE_APPLE_BOOT "Apple_Bootstrap" -#endif -#ifndef APM_ENT_TYPE_FREEBSD_NANDFS -#define APM_ENT_TYPE_FREEBSD_NANDFS "FreeBSD-nandfs" -#endif - static struct mkimg_alias apm_aliases[] = { { ALIAS_FREEBSD, ALIAS_PTR2TYPE(APM_ENT_TYPE_FREEBSD) }, { ALIAS_FREEBSD_BOOT, ALIAS_PTR2TYPE(APM_ENT_TYPE_APPLE_BOOT) }, Modified: head/usr.bin/mkimg/bsd.c ============================================================================== --- head/usr.bin/mkimg/bsd.c Sun Oct 16 02:43:51 2016 (r307386) +++ head/usr.bin/mkimg/bsd.c Sun Oct 16 02:55:52 2016 (r307387) @@ -33,17 +33,13 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include #include "endian.h" #include "image.h" #include "mkimg.h" #include "scheme.h" -#ifndef FS_NANDFS -#define FS_NANDFS 30 -#endif - static struct mkimg_alias bsd_aliases[] = { { ALIAS_FREEBSD_NANDFS, ALIAS_INT2TYPE(FS_NANDFS) }, { ALIAS_FREEBSD_SWAP, ALIAS_INT2TYPE(FS_SWAP) }, @@ -58,7 +54,7 @@ bsd_metadata(u_int where, lba_t blk) { if (where == SCHEME_META_IMG_START) - blk += BBSIZE / secsz; + blk += BSD_BOOTBLOCK_SIZE / secsz; else if (where == SCHEME_META_IMG_END) blk = round_cylinder(blk); else @@ -76,21 +72,21 @@ bsd_write(lba_t imgsz, void *bootcode) int bsdparts, error, n; uint16_t checksum; - buf = malloc(BBSIZE); + buf = malloc(BSD_BOOTBLOCK_SIZE); if (buf == NULL) return (ENOMEM); if (bootcode != NULL) { - memcpy(buf, bootcode, BBSIZE); + memcpy(buf, bootcode, BSD_BOOTBLOCK_SIZE); memset(buf + secsz, 0, sizeof(struct disklabel)); } else - memset(buf, 0, BBSIZE); + memset(buf, 0, BSD_BOOTBLOCK_SIZE); bsdparts = nparts + 1; /* Account for c partition */ - if (bsdparts < MAXPARTITIONS) - bsdparts = MAXPARTITIONS; + if (bsdparts < BSD_NPARTS_MIN) + bsdparts = BSD_NPARTS_MIN; d = (void *)(buf + secsz); - le32enc(&d->d_magic, DISKMAGIC); + le32enc(&d->d_magic, BSD_MAGIC); le32enc(&d->d_secsize, secsz); le32enc(&d->d_nsectors, nsecs); le32enc(&d->d_ntracks, nheads); @@ -98,14 +94,14 @@ bsd_write(lba_t imgsz, void *bootcode) le32enc(&d->d_secpercyl, nsecs * nheads); le32enc(&d->d_secperunit, imgsz); le16enc(&d->d_rpm, 3600); - le32enc(&d->d_magic2, DISKMAGIC); + le32enc(&d->d_magic2, BSD_MAGIC); le16enc(&d->d_npartitions, bsdparts); - le32enc(&d->d_bbsize, BBSIZE); + le32enc(&d->d_bbsize, BSD_BOOTBLOCK_SIZE); - dp = &d->d_partitions[RAW_PART]; + dp = &d->d_partitions[BSD_PART_RAW]; le32enc(&dp->p_size, imgsz); TAILQ_FOREACH(part, &partlist, link) { - n = part->index + ((part->index >= RAW_PART) ? 1 : 0); + n = part->index + ((part->index >= BSD_PART_RAW) ? 1 : 0); dp = &d->d_partitions[n]; le32enc(&dp->p_size, part->size); le32enc(&dp->p_offset, part->block); @@ -121,7 +117,7 @@ bsd_write(lba_t imgsz, void *bootcode) checksum ^= le16dec(p); le16enc(&d->d_checksum, checksum); - error = image_write(0, buf, BBSIZE / secsz); + error = image_write(0, buf, BSD_BOOTBLOCK_SIZE / secsz); free(buf); return (error); } @@ -132,8 +128,8 @@ static struct mkimg_scheme bsd_scheme = .aliases = bsd_aliases, .metadata = bsd_metadata, .write = bsd_write, - .nparts = 19, - .bootcode = BBSIZE, + .nparts = BSD_NPARTS_MAX - 1, + .bootcode = BSD_BOOTBLOCK_SIZE, .maxsecsz = 512 }; Modified: head/usr.bin/mkimg/ebr.c ============================================================================== --- head/usr.bin/mkimg/ebr.c Sun Oct 16 02:43:51 2016 (r307386) +++ head/usr.bin/mkimg/ebr.c Sun Oct 16 02:55:52 2016 (r307387) @@ -33,22 +33,15 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include #include "endian.h" #include "image.h" #include "mkimg.h" #include "scheme.h" -#ifndef DOSPTYP_FAT16B -#define DOSPTYP_FAT16B 0x06 -#endif -#ifndef DOSPTYP_FAT32 -#define DOSPTYP_FAT32 0x0b -#endif - static struct mkimg_alias ebr_aliases[] = { - { ALIAS_FAT16B, ALIAS_INT2TYPE(DOSPTYP_FAT16B) }, + { ALIAS_FAT16B, ALIAS_INT2TYPE(DOSPTYP_FAT16) }, { ALIAS_FAT32, ALIAS_INT2TYPE(DOSPTYP_FAT32) }, { ALIAS_FREEBSD, ALIAS_INT2TYPE(DOSPTYP_386BSD) }, { ALIAS_NONE, 0 } Modified: head/usr.bin/mkimg/gpt.c ============================================================================== --- head/usr.bin/mkimg/gpt.c Sun Oct 16 02:43:51 2016 (r307386) +++ head/usr.bin/mkimg/gpt.c Sun Oct 16 02:55:52 2016 (r307387) @@ -35,19 +35,14 @@ __FBSDID("$FreeBSD$"); #include #include -#include -#include +#include +#include #include "endian.h" #include "image.h" #include "mkimg.h" #include "scheme.h" -#ifndef GPT_ENT_TYPE_FREEBSD_NANDFS -#define GPT_ENT_TYPE_FREEBSD_NANDFS \ - {0x74ba7dd9,0xa689,0x11e1,0xbd,0x04,{0x00,0xe0,0x81,0x28,0x6a,0xcf}} -#endif - static uuid_t gpt_uuid_efi = GPT_ENT_TYPE_EFI; static uuid_t gpt_uuid_freebsd = GPT_ENT_TYPE_FREEBSD; static uuid_t gpt_uuid_freebsd_boot = GPT_ENT_TYPE_FREEBSD_BOOT; Modified: head/usr.bin/mkimg/mbr.c ============================================================================== --- head/usr.bin/mkimg/mbr.c Sun Oct 16 02:43:51 2016 (r307386) +++ head/usr.bin/mkimg/mbr.c Sun Oct 16 02:55:52 2016 (r307387) @@ -33,30 +33,17 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include #include "endian.h" #include "image.h" #include "mkimg.h" #include "scheme.h" -#ifndef DOSPTYP_FAT16B -#define DOSPTYP_FAT16B 0x06 -#endif -#ifndef DOSPTYP_FAT32 -#define DOSPTYP_FAT32 0x0b -#endif -#ifndef DOSPTYP_PPCBOOT -#define DOSPTYP_PPCBOOT 0x41 -#endif -#ifndef DOSPTYP_EFI -#define DOSPTYP_EFI 0xef -#endif - static struct mkimg_alias mbr_aliases[] = { { ALIAS_EBR, ALIAS_INT2TYPE(DOSPTYP_EXT) }, { ALIAS_EFI, ALIAS_INT2TYPE(DOSPTYP_EFI) }, - { ALIAS_FAT16B, ALIAS_INT2TYPE(DOSPTYP_FAT16B) }, + { ALIAS_FAT16B, ALIAS_INT2TYPE(DOSPTYP_FAT16) }, { ALIAS_FAT32, ALIAS_INT2TYPE(DOSPTYP_FAT32) }, { ALIAS_FREEBSD, ALIAS_INT2TYPE(DOSPTYP_386BSD) }, { ALIAS_NTFS, ALIAS_INT2TYPE(DOSPTYP_NTFS) }, Modified: head/usr.bin/mkimg/pc98.c ============================================================================== --- head/usr.bin/mkimg/pc98.c Sun Oct 16 02:43:51 2016 (r307386) +++ head/usr.bin/mkimg/pc98.c Sun Oct 16 02:55:52 2016 (r307387) @@ -33,26 +33,13 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include #include "endian.h" #include "image.h" #include "mkimg.h" #include "scheme.h" -#ifndef PC98_MAGIC -#define PC98_MAGIC 0xaa55 -#endif -#ifndef PC98_MAGICOFS -#define PC98_MAGICOFS 510 -#endif -#ifndef PC98_NPARTS -#define PC98_NPARTS 16 -#endif -#ifndef PC98_PTYP_386BSD -#define PC98_PTYP_386BSD 0xc494 -#endif - #define PC98_BOOTCODESZ 8192 static struct mkimg_alias pc98_aliases[] = { Modified: head/usr.bin/mkimg/vtoc8.c ============================================================================== --- head/usr.bin/mkimg/vtoc8.c Sun Oct 16 02:43:51 2016 (r307386) +++ head/usr.bin/mkimg/vtoc8.c Sun Oct 16 02:55:52 2016 (r307387) @@ -34,17 +34,13 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include #include "endian.h" #include "image.h" #include "mkimg.h" #include "scheme.h" -#ifndef VTOC_TAG_FREEBSD_NANDFS -#define VTOC_TAG_FREEBSD_NANDFS 0x0905 -#endif - static struct mkimg_alias vtoc8_aliases[] = { { ALIAS_FREEBSD_NANDFS, ALIAS_INT2TYPE(VTOC_TAG_FREEBSD_NANDFS) }, { ALIAS_FREEBSD_SWAP, ALIAS_INT2TYPE(VTOC_TAG_FREEBSD_SWAP) },