Re: svn commit: r301023 - head/sys/boot/geli

2016-05-31 Thread Allan Jude
On 2016-05-31 02:31, Xin Li wrote:
> 
> 
> On 5/30/16 23:24, Garrett Cooper wrote:
>> Author: ngie
>> Date: Tue May 31 06:24:09 2016
>> New Revision: 301023
>> URL: https://svnweb.freebsd.org/changeset/base/301023
>>
>> Log:
>>   Add missing libc includes to fix -Wimplicit-function-declaration warnings
>>   
>>   MFC after: 2 weeks
>>   Reported by: clang
>>   Sponsored by: EMC / Isilon Storage Division
>>
>> Modified:
>>   head/sys/boot/geli/geliboot_crypto.c
>>
>> Modified: head/sys/boot/geli/geliboot_crypto.c
>> ==
>> --- head/sys/boot/geli/geliboot_crypto.c Tue May 31 06:00:18 2016
>> (r301022)
>> +++ head/sys/boot/geli/geliboot_crypto.c Tue May 31 06:24:09 2016
>> (r301023)
>> @@ -27,6 +27,10 @@
>>   * $FreeBSD$
>>   */
>>  
>> +#include 
>> +#include 
>> +#include 
>> +
>>  #include "geliboot.h"
> 
> This is wrong, you shouldn't use standard C library in freestanding
> environment.
> 
> It seems that libstand.h is explicitly excluded, why? (in geliboot.h,
> allanjude cc'ed):
> 
> %%%
> /* AES-XTS implementation */
> #define _STAND
> #define STAND_H /* We don't want stand.h in {gpt,zfs,gptzfs}boot */
> #include 
> 
> %%%
> 
> Cheers,
> 

The boot loader uses sys/common/util.h to avoid needing all of libstand
in size sensitive files like boot2 (7kb) and zfsboot (64kb).
If you then pull in stand.h or string.h, you get conflicting definitions
of the functions like printf and bcmp. The manual defines for STAND_H,
_STRING_H_, _STDIO_H_, etc, are there to block those files being
included by existing library we use, like opencrypto and geli.

Since these are included before geliboot.h, and only compiled into the
libgeliboot.a archive, it would seem to work, although it is probably
confusing to anyone trying to read the code.

-- 
Allan Jude
___
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"


Re: svn commit: r301023 - head/sys/boot/geli

2016-05-31 Thread Xin Li


On 5/30/16 23:24, Garrett Cooper wrote:
> Author: ngie
> Date: Tue May 31 06:24:09 2016
> New Revision: 301023
> URL: https://svnweb.freebsd.org/changeset/base/301023
> 
> Log:
>   Add missing libc includes to fix -Wimplicit-function-declaration warnings
>   
>   MFC after: 2 weeks
>   Reported by: clang
>   Sponsored by: EMC / Isilon Storage Division
> 
> Modified:
>   head/sys/boot/geli/geliboot_crypto.c
> 
> Modified: head/sys/boot/geli/geliboot_crypto.c
> ==
> --- head/sys/boot/geli/geliboot_crypto.c  Tue May 31 06:00:18 2016
> (r301022)
> +++ head/sys/boot/geli/geliboot_crypto.c  Tue May 31 06:24:09 2016
> (r301023)
> @@ -27,6 +27,10 @@
>   * $FreeBSD$
>   */
>  
> +#include 
> +#include 
> +#include 
> +
>  #include "geliboot.h"

This is wrong, you shouldn't use standard C library in freestanding
environment.

It seems that libstand.h is explicitly excluded, why? (in geliboot.h,
allanjude cc'ed):

%%%
/* AES-XTS implementation */
#define _STAND
#define STAND_H /* We don't want stand.h in {gpt,zfs,gptzfs}boot */
#include 

%%%

Cheers,



signature.asc
Description: OpenPGP digital signature


svn commit: r301023 - head/sys/boot/geli

2016-05-31 Thread Garrett Cooper
Author: ngie
Date: Tue May 31 06:24:09 2016
New Revision: 301023
URL: https://svnweb.freebsd.org/changeset/base/301023

Log:
  Add missing libc includes to fix -Wimplicit-function-declaration warnings
  
  MFC after: 2 weeks
  Reported by: clang
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/sys/boot/geli/geliboot_crypto.c

Modified: head/sys/boot/geli/geliboot_crypto.c
==
--- head/sys/boot/geli/geliboot_crypto.cTue May 31 06:00:18 2016
(r301022)
+++ head/sys/boot/geli/geliboot_crypto.cTue May 31 06:24:09 2016
(r301023)
@@ -27,6 +27,10 @@
  * $FreeBSD$
  */
 
+#include 
+#include 
+#include 
+
 #include "geliboot.h"
 
 int
___
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"