From owner-svn-src-head@FreeBSD.ORG Sat Mar 29 23:46:02 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1951AE13; Sat, 29 Mar 2014 23:46:02 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 EE10E9F6; Sat, 29 Mar 2014 23:46:01 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s2TNk1UJ047657; Sat, 29 Mar 2014 23:46:01 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s2TNk1fR047652; Sat, 29 Mar 2014 23:46:01 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <201403292346.s2TNk1fR047652@svn.freebsd.org> From: Marcel Moolenaar Date: Sat, 29 Mar 2014 23:46:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r263926 - 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.17 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: Sat, 29 Mar 2014 23:46:02 -0000 Author: marcel Date: Sat Mar 29 23:46:01 2014 New Revision: 263926 URL: http://svnweb.freebsd.org/changeset/base/263926 Log: Fix build on FreeBSD 7 where: 1. DOSPTYP_FAT32 is not defined in 2. uuid_enc_le() does not exist in libc. Modified: head/usr.bin/mkimg/ebr.c head/usr.bin/mkimg/gpt.c head/usr.bin/mkimg/mbr.c Modified: head/usr.bin/mkimg/ebr.c ============================================================================== --- head/usr.bin/mkimg/ebr.c Sat Mar 29 23:25:09 2014 (r263925) +++ head/usr.bin/mkimg/ebr.c Sat Mar 29 23:46:01 2014 (r263926) @@ -38,6 +38,10 @@ __FBSDID("$FreeBSD$"); #include "mkimg.h" #include "scheme.h" +#ifndef DOSPTYP_FAT32 +#define DOSPTYP_FAT32 0x0b +#endif + static struct mkimg_alias ebr_aliases[] = { { ALIAS_FAT32, ALIAS_INT2TYPE(DOSPTYP_FAT32) }, { ALIAS_FREEBSD, ALIAS_INT2TYPE(DOSPTYP_386BSD) }, Modified: head/usr.bin/mkimg/gpt.c ============================================================================== --- head/usr.bin/mkimg/gpt.c Sat Mar 29 23:25:09 2014 (r263925) +++ head/usr.bin/mkimg/gpt.c Sat Mar 29 23:46:01 2014 (r263926) @@ -128,6 +128,21 @@ crc32(const void *buf, size_t sz) return (crc ^ ~0U); } +static void +gpt_uuid_enc(void *buf, const uuid_t *uuid) +{ + uint8_t *p = buf; + int i; + + le32enc(p, uuid->time_low); + le16enc(p + 4, uuid->time_mid); + le16enc(p + 6, uuid->time_hi_and_version); + p[8] = uuid->clock_seq_hi_and_reserved; + p[9] = uuid->clock_seq_low; + for (i = 0; i < _UUID_NODE_LEN; i++) + p[10 + i] = uuid->node[i]; +} + static u_int gpt_tblsz(void) { @@ -207,9 +222,9 @@ gpt_mktbl(u_int tblsz) STAILQ_FOREACH(part, &partlist, link) { ent = tbl + part->index; - uuid_enc_le(&ent->ent_type, ALIAS_TYPE2PTR(part->type)); + gpt_uuid_enc(&ent->ent_type, ALIAS_TYPE2PTR(part->type)); uuidgen(&uuid, 1); - uuid_enc_le(&ent->ent_uuid, &uuid); + gpt_uuid_enc(&ent->ent_uuid, &uuid); le64enc(&ent->ent_lba_start, part->block); le64enc(&ent->ent_lba_end, part->block + part->size - 1); if (part->label != NULL) { @@ -278,7 +293,7 @@ gpt_write(int fd, lba_t imgsz, void *boo le64enc(&hdr->hdr_lba_start, 2 + tblsz); le64enc(&hdr->hdr_lba_end, imgsz - tblsz - 2); uuidgen(&uuid, 1); - uuid_enc_le(&hdr->hdr_uuid, &uuid); + gpt_uuid_enc(&hdr->hdr_uuid, &uuid); le32enc(&hdr->hdr_entries, nparts); le32enc(&hdr->hdr_entsz, sizeof(struct gpt_ent)); crc = crc32(tbl, nparts * sizeof(struct gpt_ent)); Modified: head/usr.bin/mkimg/mbr.c ============================================================================== --- head/usr.bin/mkimg/mbr.c Sat Mar 29 23:25:09 2014 (r263925) +++ head/usr.bin/mkimg/mbr.c Sat Mar 29 23:46:01 2014 (r263926) @@ -38,6 +38,10 @@ __FBSDID("$FreeBSD$"); #include "mkimg.h" #include "scheme.h" +#ifndef DOSPTYP_FAT32 +#define DOSPTYP_FAT32 0x0b +#endif + static struct mkimg_alias mbr_aliases[] = { { ALIAS_EBR, ALIAS_INT2TYPE(DOSPTYP_EXT) }, { ALIAS_FAT32, ALIAS_INT2TYPE(DOSPTYP_FAT32) },