Re: svn commit: r307544 - head/usr.bin/mkimg

2016-10-17 Thread Marcel Moolenaar
On October 17, 2016 at 8:34:11 PM, Ngie Cooper (yaneurab...@gmail.com) wrote:

> On Oct 17, 2016, at 18:55, Marcel Moolenaar  wrote: 
>
*snip*

> +CFLAGS+=-I${SRCTOP}/sys/sys/disk 

Isn't it a better app idea to maintain the disk/ namespace for includes? 
Thanks! 
You mean, add -I${SRCTOP}//sys/sys on the compile line and change the code to 
use #include ?

Unfortunately, that creates conflicts with header files that are included as 
 and match headers we have under sys/sys.




signature.asc
Description: Message signed with OpenPGP using AMPGpg


Re: svn commit: r307544 - head/usr.bin/mkimg

2016-10-17 Thread Ngie Cooper

> On Oct 17, 2016, at 18:55, Marcel Moolenaar  wrote:
> 
> Author: marcel
> Date: Tue Oct 18 01:55:07 2016
> New Revision: 307544
> URL: https://svnweb.freebsd.org/changeset/base/307544
> 
> Log:
>   o  Provide a private definition for UUIDs (mkimg_uuid_t) because
>  UUIDs are not portable.
>   o  Move mkimg_uuid() to a new file and merge both gpt_uuid_enc()
>  and vhd_uuid_enc() into a single mkimg_uuid_enc() that lives
>  in the same file.
>   o  Move the OS-specific implementation of generating a UUID to
>  osdep_uuidgen() and provide the implementations for FreeBSD,
>  macOS and Linux.
>   o  Expect the partitioning scheme headers to be found by having
>  a search to the directory in which the headers live. This
>  avoids conflicts on non-FreeBSD machines.
> 
> Added:
>  head/usr.bin/mkimg/uuid.c   (contents, props changed)
> 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/mkimg.c
>  head/usr.bin/mkimg/mkimg.h
>  head/usr.bin/mkimg/pc98.c
>  head/usr.bin/mkimg/vhd.c
>  head/usr.bin/mkimg/vtoc8.c
> 
> Modified: head/usr.bin/mkimg/Makefile
> ==
> --- head/usr.bin/mkimg/MakefileTue Oct 18 01:42:42 2016(r307543)
> +++ head/usr.bin/mkimg/MakefileTue Oct 18 01:55:07 2016(r307544)
> @@ -3,15 +3,15 @@
> .include 
> 
> PROG=mkimg
> -SRCS=format.c image.c mkimg.c scheme.c
> +SRCS=format.c image.c mkimg.c scheme.c uuid.c
> MAN=mkimg.1
> 
> -MKIMG_VERSION=20151211
> +MKIMG_VERSION=20161016
> mkimg.o: Makefile
> 
> CFLAGS+=-DMKIMG_VERSION=${MKIMG_VERSION}
> CFLAGS+=-DSPARSE_WRITE
> -CFLAGS+=-I${.CURDIR:H:H}/sys
> +CFLAGS+=-I${SRCTOP}/sys/sys/disk

Isn't it a better app idea to maintain the disk/ namespace for includes?
Thanks!
-Ngie
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r307544 - head/usr.bin/mkimg

2016-10-17 Thread Marcel Moolenaar
Author: marcel
Date: Tue Oct 18 01:55:07 2016
New Revision: 307544
URL: https://svnweb.freebsd.org/changeset/base/307544

Log:
   o  Provide a private definition for UUIDs (mkimg_uuid_t) because
  UUIDs are not portable.
   o  Move mkimg_uuid() to a new file and merge both gpt_uuid_enc()
  and vhd_uuid_enc() into a single mkimg_uuid_enc() that lives
  in the same file.
   o  Move the OS-specific implementation of generating a UUID to
  osdep_uuidgen() and provide the implementations for FreeBSD,
  macOS and Linux.
   o  Expect the partitioning scheme headers to be found by having
  a search to the directory in which the headers live. This
  avoids conflicts on non-FreeBSD machines.

Added:
  head/usr.bin/mkimg/uuid.c   (contents, props changed)
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/mkimg.c
  head/usr.bin/mkimg/mkimg.h
  head/usr.bin/mkimg/pc98.c
  head/usr.bin/mkimg/vhd.c
  head/usr.bin/mkimg/vtoc8.c

Modified: head/usr.bin/mkimg/Makefile
==
--- head/usr.bin/mkimg/Makefile Tue Oct 18 01:42:42 2016(r307543)
+++ head/usr.bin/mkimg/Makefile Tue Oct 18 01:55:07 2016(r307544)
@@ -3,15 +3,15 @@
 .include 
 
 PROG=  mkimg
-SRCS=  format.c image.c mkimg.c scheme.c
+SRCS=  format.c image.c mkimg.c scheme.c uuid.c
 MAN=   mkimg.1
 
-MKIMG_VERSION=20151211
+MKIMG_VERSION=20161016
 mkimg.o: Makefile
 
 CFLAGS+=-DMKIMG_VERSION=${MKIMG_VERSION}
 CFLAGS+=-DSPARSE_WRITE
-CFLAGS+=-I${.CURDIR:H:H}/sys
+CFLAGS+=-I${SRCTOP}/sys/sys/disk
 
 # List of formats to support
 SRCS+= \

Modified: head/usr.bin/mkimg/apm.c
==
--- head/usr.bin/mkimg/apm.cTue Oct 18 01:42:42 2016(r307543)
+++ head/usr.bin/mkimg/apm.cTue Oct 18 01:55:07 2016(r307544)
@@ -33,7 +33,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-#include 
+#include 
 
 #include "endian.h"
 #include "image.h"

Modified: head/usr.bin/mkimg/bsd.c
==
--- head/usr.bin/mkimg/bsd.cTue Oct 18 01:42:42 2016(r307543)
+++ head/usr.bin/mkimg/bsd.cTue Oct 18 01:55:07 2016(r307544)
@@ -33,7 +33,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-#include 
+#include 
 
 #include "endian.h"
 #include "image.h"

Modified: head/usr.bin/mkimg/ebr.c
==
--- head/usr.bin/mkimg/ebr.cTue Oct 18 01:42:42 2016(r307543)
+++ head/usr.bin/mkimg/ebr.cTue Oct 18 01:55:07 2016(r307544)
@@ -33,7 +33,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-#include 
+#include 
 
 #include "endian.h"
 #include "image.h"

Modified: head/usr.bin/mkimg/gpt.c
==
--- head/usr.bin/mkimg/gpt.cTue Oct 18 01:42:42 2016(r307543)
+++ head/usr.bin/mkimg/gpt.cTue Oct 18 01:55:07 2016(r307544)
@@ -33,26 +33,25 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 
-#include 
-#include 
+#include 
+#include 
 
 #include "endian.h"
 #include "image.h"
 #include "mkimg.h"
 #include "scheme.h"
 
-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;
-static uuid_t gpt_uuid_freebsd_nandfs = GPT_ENT_TYPE_FREEBSD_NANDFS;
-static uuid_t gpt_uuid_freebsd_swap = GPT_ENT_TYPE_FREEBSD_SWAP;
-static uuid_t gpt_uuid_freebsd_ufs = GPT_ENT_TYPE_FREEBSD_UFS;
-static uuid_t gpt_uuid_freebsd_vinum = GPT_ENT_TYPE_FREEBSD_VINUM;
-static uuid_t gpt_uuid_freebsd_zfs = GPT_ENT_TYPE_FREEBSD_ZFS;
-static uuid_t gpt_uuid_mbr = GPT_ENT_TYPE_MBR;
-static uuid_t gpt_uuid_ms_basic_data = GPT_ENT_TYPE_MS_BASIC_DATA;
+static mkimg_uuid_t gpt_uuid_efi = GPT_ENT_TYPE_EFI;
+static mkimg_uuid_t gpt_uuid_freebsd = GPT_ENT_TYPE_FREEBSD;
+static mkimg_uuid_t gpt_uuid_freebsd_boot = GPT_ENT_TYPE_FREEBSD_BOOT;
+static mkimg_uuid_t gpt_uuid_freebsd_nandfs = GPT_ENT_TYPE_FREEBSD_NANDFS;
+static mkimg_uuid_t gpt_uuid_freebsd_swap = GPT_ENT_TYPE_FREEBSD_SWAP;
+static mkimg_uuid_t gpt_uuid_freebsd_ufs = GPT_ENT_TYPE_FREEBSD_UFS;
+static mkimg_uuid_t gpt_uuid_freebsd_vinum = GPT_ENT_TYPE_FREEBSD_VINUM;
+static mkimg_uuid_t gpt_uuid_freebsd_zfs = GPT_ENT_TYPE_FREEBSD_ZFS;
+static mkimg_uuid_t gpt_uuid_mbr = GPT_ENT_TYPE_MBR;
+static mkimg_uuid_t gpt_uuid_ms_basic_data = GPT_ENT_TYPE_MS_BASIC_DATA;
 
 static struct mkimg_alias gpt_aliases[] = {
 {  ALIAS_EFI, ALIAS_PTR2TYPE(_uuid_efi) },
@@ -126,21 +125,6 @@ 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;
-