svn commit: r318982 - head/lib/libstand

2017-05-27 Thread Baptiste Daroussin
Author: bapt
Date: Sat May 27 10:50:35 2017
New Revision: 318982
URL: https://svnweb.freebsd.org/changeset/base/318982

Log:
  Pass a "FREEBSD" user-class in PXE dhcp request
  
  rfc3004 allows to pass multiple user classes on dhcp requests
  this is used by dhcp servers to differentiate the caller if needed.
  
  As an example with isc dhcp server it will be possible to make options
  only for the FreeBSD loaders:
  
  if exists user-class and option user-class = "FREEBSD" {
 option root-path "tftp://192.168.42.1/FreeBSD;
  }
  
  Reviewed by:  tsoome
  Differential Revision:https://reviews.freebsd.org/D10951

Modified:
  head/lib/libstand/bootp.c
  head/lib/libstand/bootp.h

Modified: head/lib/libstand/bootp.c
==
--- head/lib/libstand/bootp.c   Sat May 27 08:30:32 2017(r318981)
+++ head/lib/libstand/bootp.c   Sat May 27 10:50:35 2017(r318982)
@@ -146,16 +146,20 @@ bootp(int sock, int flag)
bp->bp_vend[7] = TAG_CLASSID;
bp->bp_vend[8] = 9;
bcopy("PXEClient", &bp->bp_vend[9], 9);
-   bp->bp_vend[18] = TAG_PARAM_REQ;
-   bp->bp_vend[19] = 7;
-   bp->bp_vend[20] = TAG_ROOTPATH;
-   bp->bp_vend[21] = TAG_HOSTNAME;
-   bp->bp_vend[22] = TAG_SWAPSERVER;
-   bp->bp_vend[23] = TAG_GATEWAY;
-   bp->bp_vend[24] = TAG_SUBNET_MASK;
-   bp->bp_vend[25] = TAG_INTF_MTU;
-   bp->bp_vend[26] = TAG_SERVERID;
-   bp->bp_vend[27] = TAG_END;
+   bp->bp_vend[18] = TAG_USER_CLASS;
+   bp->bp_vend[19] = 8;
+   bp->bp_vend[20] = 7;
+   bcopy("FREEBSD", &bp->bp_vend[21], 7);
+   bp->bp_vend[28] = TAG_PARAM_REQ;
+   bp->bp_vend[29] = 7;
+   bp->bp_vend[30] = TAG_ROOTPATH;
+   bp->bp_vend[31] = TAG_HOSTNAME;
+   bp->bp_vend[32] = TAG_SWAPSERVER;
+   bp->bp_vend[33] = TAG_GATEWAY;
+   bp->bp_vend[34] = TAG_SUBNET_MASK;
+   bp->bp_vend[35] = TAG_INTF_MTU;
+   bp->bp_vend[36] = TAG_SERVERID;
+   bp->bp_vend[37] = TAG_END;
} else
bp->bp_vend[7] = TAG_END;
 #else

Modified: head/lib/libstand/bootp.h
==
--- head/lib/libstand/bootp.h   Sat May 27 08:30:32 2017(r318981)
+++ head/lib/libstand/bootp.h   Sat May 27 10:50:35 2017(r318982)
@@ -108,6 +108,7 @@ struct bootp {
 #define TAG_T2 ((unsigned char)  59)
 #define TAG_CLASSID((unsigned char)  60)
 #define TAG_CLIENTID   ((unsigned char)  61)
+#define TAG_USER_CLASS ((unsigned char)  77)
 #endif
 
 #define TAG_END((unsigned char) 255)
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r318986 - head/lib/libstand

2017-05-27 Thread Baptiste Daroussin
Author: bapt
Date: Sat May 27 11:41:54 2017
New Revision: 318986
URL: https://svnweb.freebsd.org/changeset/base/318986

Log:
  add a comment on vendor index 19 and 20 to avoid confusion
  
  Suggested by: tsoome

Modified:
  head/lib/libstand/bootp.c

Modified: head/lib/libstand/bootp.c
==
--- head/lib/libstand/bootp.c   Sat May 27 11:25:21 2017(r318985)
+++ head/lib/libstand/bootp.c   Sat May 27 11:41:54 2017(r318986)
@@ -147,7 +147,9 @@ bootp(int sock, int flag)
bp->bp_vend[8] = 9;
bcopy("PXEClient", &bp->bp_vend[9], 9);
bp->bp_vend[18] = TAG_USER_CLASS;
+   /* len of each user class + number of user class */
bp->bp_vend[19] = 8;
+   /* len of the first user class */
bp->bp_vend[20] = 7;
bcopy("FREEBSD", &bp->bp_vend[21], 7);
bp->bp_vend[28] = TAG_PARAM_REQ;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r318987 - head/sys/boot/common

2017-05-27 Thread Baptiste Daroussin
Author: bapt
Date: Sat May 27 12:06:52 2017
New Revision: 318987
URL: https://svnweb.freebsd.org/changeset/base/318987

Log:
  Support URI scheme for root-path in netbooting
  
  Rather that previous attempts to add tftpfs support at the same time as NFS
  support. This time decide on a proper URI parser rather than hacks.
  
  root-path can now be define the following way:
  For tftpfs:
  
  tftp://ip/path
  tftp:/path (this one will consider the tftp server is the same as the one 
where
  the pxeboot file was fetched from)
  
  For nfs:
  nfs:/path
  nfs://ip/path
  
  The historical
  ip:/path
  /path
  
  are kept on NFS
  
  Reviewed by:  tsoom, rgrimes
  Differential Revision:https://reviews.freebsd.org/D10947

Modified:
  head/sys/boot/common/dev_net.c

Modified: head/sys/boot/common/dev_net.c
==
--- head/sys/boot/common/dev_net.c  Sat May 27 11:41:54 2017
(r318986)
+++ head/sys/boot/common/dev_net.c  Sat May 27 12:06:52 2017
(r318987)
@@ -97,6 +97,14 @@ struct devsw netdev = {
net_cleanup
 };
 
+static struct uri_scheme {
+   const char *scheme;
+   int proto;
+} uri_schemes[] = {
+   { "tftp:/", NET_TFTP },
+   { "nfs:/", NET_NFS },
+};
+
 static int
 net_init(void)
 {
@@ -334,11 +342,8 @@ net_getparams(int sock)
return (EIO);
}
 exit:
-   netproto = NET_TFTP;
-   if ((rootaddr = net_parse_rootpath()) != INADDR_NONE) {
-   netproto = NET_NFS;
+   if ((rootaddr = net_parse_rootpath()) != INADDR_NONE)
rootip.s_addr = rootaddr;
-   }
 
 #ifdef NETIF_DEBUG
if (debug) {
@@ -387,14 +392,51 @@ net_print(int verbose)
 uint32_t
 net_parse_rootpath()
 {
-   n_long addr = INADDR_NONE;
-   char *ptr;
+   n_long addr = htonl(INADDR_NONE);
+   size_t i;
+   char ip[FNAME_SIZE];
+   char *ptr, *val;
+
+   netproto = NET_NONE;
+
+   for (i = 0; i < nitems(uri_schemes); i++) {
+   if (strncmp(rootpath, uri_schemes[i].scheme,
+   strlen(uri_schemes[i].scheme)) != 0)
+   continue;
 
+   netproto = uri_schemes[i].proto;
+   break;
+   }
ptr = rootpath;
-   (void)strsep(&ptr, ":");
-   if (ptr != NULL) {
-   addr = inet_addr(rootpath);
-   bcopy(ptr, rootpath, strlen(ptr) + 1);
+   /* Fallback for compatibility mode */
+   if (netproto == NET_NONE) {
+   netproto = NET_NFS;
+   (void)strsep(&ptr, ":");
+   if (ptr != NULL) {
+   addr = inet_addr(rootpath);
+   bcopy(ptr, rootpath, strlen(ptr) + 1);
+   }
+   } else {
+   ptr += strlen(uri_schemes[i].scheme);
+   if (*ptr == '/') {
+   /* we are in the form ://, we do expect an ip */
+   ptr++;
+   /*
+* XXX when http will be there we will need to check for
+* a port, but right now we do not need it yet
+*/
+   val = strchr(ptr, '/');
+   if (val != NULL) {
+   snprintf(ip, sizeof(ip), "%.*s",
+   (int)((uintptr_t)val - (uintptr_t)ptr), 
ptr);
+   printf("%s\n", ip);
+   addr = inet_addr(ip);
+   bcopy(val, rootpath, strlen(val) + 1);
+   }
+   } else {
+   ptr--;
+   bcopy(ptr, rootpath, strlen(ptr) + 1);
+   }
}
 
return (addr);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r318988 - head/sys/boot/i386/loader

2017-05-27 Thread Baptiste Daroussin
Author: bapt
Date: Sat May 27 12:20:13 2017
New Revision: 318988
URL: https://svnweb.freebsd.org/changeset/base/318988

Log:
  Always build tftpfs support along with nfs for pxeboot
  
  This change was already done for loader.efi

Modified:
  head/sys/boot/i386/loader/Makefile

Modified: head/sys/boot/i386/loader/Makefile
==
--- head/sys/boot/i386/loader/Makefile  Sat May 27 12:06:52 2017
(r318987)
+++ head/sys/boot/i386/loader/Makefile  Sat May 27 12:20:13 2017
(r318988)
@@ -10,6 +10,8 @@ INTERNALPROG=
 NEWVERSWHAT?=  "bootstrap loader" x86
 VERSION_FILE=  ${.CURDIR}/../loader/version
 LOADER_NET_SUPPORT?=   yes
+LOADER_NFS_SUPPORT?=   yes
+LOADER_TFTP_SUPPORT?=  yes
 
 # architecture-specific loader code
 SRCS=  main.c conf.c vers.c
@@ -30,10 +32,10 @@ LIBZFSBOOT= ${.OBJDIR}/../../zfs/libzfsb
 CFLAGS+=   -I${.CURDIR}/../../../../lib/libstand
 .endif
 
-# Enable PXE TFTP or NFS support, not both.
 .if defined(LOADER_TFTP_SUPPORT)
 CFLAGS+=   -DLOADER_TFTP_SUPPORT
-.else
+.endif
+.if defined(LOADER_NFS_SUPPORT)
 CFLAGS+=   -DLOADER_NFS_SUPPORT
 .endif
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r318989 - in head: lib/libstand sys/boot/common

2017-05-27 Thread Baptiste Daroussin
Author: bapt
Date: Sat May 27 12:35:01 2017
New Revision: 318989
URL: https://svnweb.freebsd.org/changeset/base/318989

Log:
  Always issue the pxe request
  
  All the code are now only issueing one single dhcp request at startup of the
  loader meaning we can always request a the PXE informations from the
  dhcp server.
  
  Previous code lost that information, meaning no option 55 anymore (meaning not
  working with the kea dhcp server) and no request for rootpath etc, no user 
class
  
  Remove the flags from the bootp function which is not needed anymore
  
  Reviewed by:  tsoome
  Differential Revision:https://reviews.freebsd.org/D10952

Modified:
  head/lib/libstand/bootp.c
  head/lib/libstand/bootp.h
  head/lib/libstand/net.h
  head/sys/boot/common/dev_net.c

Modified: head/lib/libstand/bootp.c
==
--- head/lib/libstand/bootp.c   Sat May 27 12:20:13 2017(r318988)
+++ head/lib/libstand/bootp.c   Sat May 27 12:35:01 2017(r318989)
@@ -95,7 +95,7 @@ size_t bootp_response_size;
 
 /* Fetch required bootp infomation */
 void
-bootp(int sock, int flag)
+bootp(int sock)
 {
void *pkt;
struct iodesc *d;
@@ -138,32 +138,29 @@ bootp(int sock, int flag)
bp->bp_vend[6] = DHCPDISCOVER;
 
/*
-* If we are booting from PXE, we want to send the string
+* We are booting from PXE, we want to send the string
 * 'PXEClient' to the DHCP server so you have the option of
 * only responding to PXE aware dhcp requests.
 */
-   if (flag & BOOTP_PXE) {
-   bp->bp_vend[7] = TAG_CLASSID;
-   bp->bp_vend[8] = 9;
-   bcopy("PXEClient", &bp->bp_vend[9], 9);
-   bp->bp_vend[18] = TAG_USER_CLASS;
-   /* len of each user class + number of user class */
-   bp->bp_vend[19] = 8;
-   /* len of the first user class */
-   bp->bp_vend[20] = 7;
-   bcopy("FREEBSD", &bp->bp_vend[21], 7);
-   bp->bp_vend[28] = TAG_PARAM_REQ;
-   bp->bp_vend[29] = 7;
-   bp->bp_vend[30] = TAG_ROOTPATH;
-   bp->bp_vend[31] = TAG_HOSTNAME;
-   bp->bp_vend[32] = TAG_SWAPSERVER;
-   bp->bp_vend[33] = TAG_GATEWAY;
-   bp->bp_vend[34] = TAG_SUBNET_MASK;
-   bp->bp_vend[35] = TAG_INTF_MTU;
-   bp->bp_vend[36] = TAG_SERVERID;
-   bp->bp_vend[37] = TAG_END;
-   } else
-   bp->bp_vend[7] = TAG_END;
+   bp->bp_vend[7] = TAG_CLASSID;
+   bp->bp_vend[8] = 9;
+   bcopy("PXEClient", &bp->bp_vend[9], 9);
+   bp->bp_vend[18] = TAG_USER_CLASS;
+   /* len of each user class + number of user class */
+   bp->bp_vend[19] = 8;
+   /* len of the first user class */
+   bp->bp_vend[20] = 7;
+   bcopy("FREEBSD", &bp->bp_vend[21], 7);
+   bp->bp_vend[28] = TAG_PARAM_REQ;
+   bp->bp_vend[29] = 7;
+   bp->bp_vend[30] = TAG_ROOTPATH;
+   bp->bp_vend[31] = TAG_HOSTNAME;
+   bp->bp_vend[32] = TAG_SWAPSERVER;
+   bp->bp_vend[33] = TAG_GATEWAY;
+   bp->bp_vend[34] = TAG_SUBNET_MASK;
+   bp->bp_vend[35] = TAG_INTF_MTU;
+   bp->bp_vend[36] = TAG_SERVERID;
+   bp->bp_vend[37] = TAG_END;
 #else
bp->bp_vend[4] = TAG_END;
 #endif
@@ -199,13 +196,10 @@ bootp(int sock, int flag)
bp->bp_vend[20] = 4;
leasetime = htonl(300);
bcopy(&leasetime, &bp->bp_vend[21], 4);
-   if (flag & BOOTP_PXE) {
-   bp->bp_vend[25] = TAG_CLASSID;
-   bp->bp_vend[26] = 9;
-   bcopy("PXEClient", &bp->bp_vend[27], 9);
-   bp->bp_vend[36] = TAG_END;
-   } else
-   bp->bp_vend[25] = TAG_END;
+   bp->bp_vend[25] = TAG_CLASSID;
+   bp->bp_vend[26] = 9;
+   bcopy("PXEClient", &bp->bp_vend[27], 9);
+   bp->bp_vend[36] = TAG_END;
 
expected_dhcpmsgtype = DHCPACK;
 

Modified: head/lib/libstand/bootp.h
==
--- head/lib/libstand/bootp.h   Sat May 27 12:20:13 2017(r318988)
+++ head/lib/libstand/bootp.h   Sat May 27 12:35:01 2017(r318989)
@@ -124,12 +124,6 @@ struct bootp {
 #endif
 
 /*
- * bootp flags
- */
-#defineBOOTP_NONE  0x  /* No flags */
-#defineBOOTP_PXE   0x0001  /* Booting from PXE. */
-
-/*
  * "vendor" data permitted for CMU bootp clients.
  */
 

Modified: head/lib/libstand/net.h
==
--- head/lib/libstand/net.h Sat May 27 12:20:13 2017(r318988)
+++ head/lib/libstand/net.h Sat May 27 12:35:01 2017(r318989)
@@ -119,7 +119,7 @@ ssize_t sendrecv(struct 

svn commit: r318990 - head/sys/boot/common

2017-05-27 Thread Baptiste Daroussin
Author: bapt
Date: Sat May 27 12:46:46 2017
New Revision: 318990
URL: https://svnweb.freebsd.org/changeset/base/318990

Log:
  Partially revert r314948
  
  While it sounds like a good idea to extract the RFC1048 data from PXE, in the
  end it is not and it is causing lots of issues.  Our pxeloader might need
  options which are incompatible with other pxe servers (for example iPXE, but
  not only).
  
  Our pxe loaders are also now settings their own user class, so it is useful to
  issue our own pxe request at startup
  
  Reviewed by:  tsoome
  Differential Revision:https://reviews.freebsd.org/D10953

Modified:
  head/sys/boot/common/dev_net.c

Modified: head/sys/boot/common/dev_net.c
==
--- head/sys/boot/common/dev_net.c  Sat May 27 12:35:01 2017
(r318989)
+++ head/sys/boot/common/dev_net.c  Sat May 27 12:46:46 2017
(r318990)
@@ -256,7 +256,6 @@ net_getparams(int sock)
 {
char buf[MAXHOSTNAMELEN];
n_long rootaddr, smask;
-   struct iodesc *d = socktodesc(sock);
extern struct in_addr servip;
 
 #ifdef SUPPORT_BOOTP
@@ -266,26 +265,8 @@ net_getparams(int sock)
 * be initialized.  If any remain uninitialized, we will
 * use RARP and RPC/bootparam (the Sun way) to get them.
 */
-   if (try_bootp) {
-   int rc = -1;
-   if (bootp_response != NULL) {
-   rc = dhcp_try_rfc1048(bootp_response->bp_vend,
-   bootp_response_size -
-   offsetof(struct bootp, bp_vend));
-
-   if (servip.s_addr == 0)
-   servip = bootp_response->bp_siaddr;
-   if (rootip.s_addr == 0)
-   rootip = bootp_response->bp_siaddr;
-   if (gateip.s_addr == 0)
-   gateip = bootp_response->bp_giaddr;
-   if (myip.s_addr == 0)
-   myip = bootp_response->bp_yiaddr;
-   d->myip = myip;
-   }
-   if (rc < 0)
-   bootp(sock);
-   }
+   if (try_bootp)
+   bootp(sock);
if (myip.s_addr != 0)
goto exit;
 #ifdef NETIF_DEBUG
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r318991 - head/sys/boot/i386/pxeldr

2017-05-27 Thread Baptiste Daroussin
Author: bapt
Date: Sat May 27 13:26:18 2017
New Revision: 318991
URL: https://svnweb.freebsd.org/changeset/base/318991

Log:
  Document recent changes on pxeboot

Modified:
  head/sys/boot/i386/pxeldr/pxeboot.8

Modified: head/sys/boot/i386/pxeldr/pxeboot.8
==
--- head/sys/boot/i386/pxeldr/pxeboot.8 Sat May 27 12:46:46 2017
(r318990)
+++ head/sys/boot/i386/pxeldr/pxeboot.8 Sat May 27 13:26:18 2017
(r318991)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd May 16, 2017
+.Dd May 27, 2017
 .Dt PXEBOOT 8
 .Os
 .Sh NAME
@@ -39,6 +39,11 @@ configured to run under Intel's Preboot 
 PXE is a form of smart boot ROM, built into Intel EtherExpress Pro/100 and
 3Com 3c905c Ethernet cards, and Ethernet-equipped Intel motherboards.
 PXE supports DHCP configuration and provides low-level NIC access services.
+.Pp
+The DHCP client will set a DHCP user class named
+.Va FREEBSD
+to allow flexible configuration of the dhcp server.
+.Pp
 The
 .Nm
 bootloader retrieves the kernel, modules,
@@ -69,6 +74,9 @@ max-lease-time 120;
 subnet 10.0.0.0 netmask 255.255.255.0 {
filename "pxeboot";
range 10.0.0.10 10.0.0.254;
+   if exists user-class and option user-class = "FREEBSD" {
+option root-path "tftp://10.0.0.1/FreeBSD";;
+   }
 }
 
 .Ed
@@ -85,6 +93,27 @@ expects to fetch
 .Pa /boot/loader.rc
 from the specified server before loading any other files.
 .Pp
+Valid
+.Va option root-path
+Syntax is the following
+.Bl -tag -width ://ip/path indent
+.It /path
+path to the root filesystem on the NFS server
+.It ip:/path
+path to the root filesystem on the NFS server
+.Ar ip
+.It nfs:/path
+path to the root filesystem on the NFS server
+.It nfs://ip/path
+path to the root filesystem on the NFS server
+.Ar ip
+.It tftp:/path
+path to the root filesystem on the TFTP server
+.It tftp://ip/path
+path to the root filesystem on the TFTP server
+.Ar ip
+.El
+.Pp
 .Nm
 defaults to a conservative 1024 byte NFS data packet size.
 This may be changed by setting the
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r318991 - head/sys/boot/i386/pxeldr

2017-05-27 Thread Alexey Dokuchaev
On Sat, May 27, 2017 at 01:26:18PM +, Baptiste Daroussin wrote:
> New Revision: 318991
> URL: https://svnweb.freebsd.org/changeset/base/318991
> 
> Log:
>   Document recent changes on pxeboot
> 
> Modified:
>   head/sys/boot/i386/pxeldr/pxeboot.8
> ...
> @@ -39,6 +39,11 @@ configured to run under Intel's Preboot
>  PXE is a form of smart boot ROM, built into Intel EtherExpress Pro/100 and
>  3Com 3c905c Ethernet cards, and Ethernet-equipped Intel motherboards.
>  PXE supports DHCP configuration and provides low-level NIC access services.
> +.Pp
> +The DHCP client will set a DHCP user class named
> +.Va FREEBSD
> +to allow flexible configuration of the dhcp server.
> +.Pp

Inconsistent DHCP/dhcp spelling within a single sentence does not look good.

./danfe
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r318992 - head/sys/boot/i386/pxeldr

2017-05-27 Thread Baptiste Daroussin
Author: bapt
Date: Sat May 27 13:55:20 2017
New Revision: 318992
URL: https://svnweb.freebsd.org/changeset/base/318992

Log:
  Capitalize DHCP
  
  Reported by:  danfe

Modified:
  head/sys/boot/i386/pxeldr/pxeboot.8

Modified: head/sys/boot/i386/pxeldr/pxeboot.8
==
--- head/sys/boot/i386/pxeldr/pxeboot.8 Sat May 27 13:26:18 2017
(r318991)
+++ head/sys/boot/i386/pxeldr/pxeboot.8 Sat May 27 13:55:20 2017
(r318992)
@@ -42,7 +42,7 @@ PXE supports DHCP configuration and prov
 .Pp
 The DHCP client will set a DHCP user class named
 .Va FREEBSD
-to allow flexible configuration of the dhcp server.
+to allow flexible configuration of the DHCP server.
 .Pp
 The
 .Nm
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r318992 - head/sys/boot/i386/pxeldr

2017-05-27 Thread Alexey Dokuchaev
On Sat, May 27, 2017 at 01:55:20PM +, Baptiste Daroussin wrote:
> New Revision: 318992
> URL: https://svnweb.freebsd.org/changeset/base/318992
> 
> Log:
>   Capitalize DHCP

Thank you.

./danfe
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r318993 - head/lib/libstand

2017-05-27 Thread Baptiste Daroussin
Author: bapt
Date: Sat May 27 14:06:57 2017
New Revision: 318993
URL: https://svnweb.freebsd.org/changeset/base/318993

Log:
  Use the usual FreeBSD spelling for the DHCP user class
  
  Reported by:  lidl

Modified:
  head/lib/libstand/bootp.c

Modified: head/lib/libstand/bootp.c
==
--- head/lib/libstand/bootp.c   Sat May 27 13:55:20 2017(r318992)
+++ head/lib/libstand/bootp.c   Sat May 27 14:06:57 2017(r318993)
@@ -150,7 +150,7 @@ bootp(int sock)
bp->bp_vend[19] = 8;
/* len of the first user class */
bp->bp_vend[20] = 7;
-   bcopy("FREEBSD", &bp->bp_vend[21], 7);
+   bcopy("FreeBSD", &bp->bp_vend[21], 7);
bp->bp_vend[28] = TAG_PARAM_REQ;
bp->bp_vend[29] = 7;
bp->bp_vend[30] = TAG_ROOTPATH;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r318994 - head/sys/boot/i386/pxeldr

2017-05-27 Thread Baptiste Daroussin
Author: bapt
Date: Sat May 27 14:07:46 2017
New Revision: 318994
URL: https://svnweb.freebsd.org/changeset/base/318994

Log:
  Catch with the change in the user class

Modified:
  head/sys/boot/i386/pxeldr/pxeboot.8

Modified: head/sys/boot/i386/pxeldr/pxeboot.8
==
--- head/sys/boot/i386/pxeldr/pxeboot.8 Sat May 27 14:06:57 2017
(r318993)
+++ head/sys/boot/i386/pxeldr/pxeboot.8 Sat May 27 14:07:46 2017
(r318994)
@@ -41,7 +41,7 @@ PXE is a form of smart boot ROM, built i
 PXE supports DHCP configuration and provides low-level NIC access services.
 .Pp
 The DHCP client will set a DHCP user class named
-.Va FREEBSD
+.Va FreeBSD
 to allow flexible configuration of the DHCP server.
 .Pp
 The
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r318995 - head/sys/vm

2017-05-27 Thread Alan Cox
Author: alc
Date: Sat May 27 16:40:00 2017
New Revision: 318995
URL: https://svnweb.freebsd.org/changeset/base/318995

Log:
  In r118390, the swap pager's approach to striping swap allocation over
  multiple devices was changed.  However, swapoff_one() was not fully and
  correctly converted.  In particular, with r118390's introduction of a per-
  device blist, the maximum swap block size, "dmmax", became irrelevant to
  swapoff_one()'s operation.  Moreover, swapoff_one() was performing out-of-
  range operations on the per-device blist that were silently ignored by
  blist_fill().
  
  This change corrects both of these problems with swapoff_one(), which will
  allow us to potentially increase MAX_PAGEOUT_CLUSTER.  Previously,
  swapoff_one() would panic inside of blist_fill() if you increased
  MAX_PAGEOUT_CLUSTER.
  
  Reviewed by:  kib, markj
  MFC after:3 days

Modified:
  head/sys/vm/swap_pager.c

Modified: head/sys/vm/swap_pager.c
==
--- head/sys/vm/swap_pager.cSat May 27 14:07:46 2017(r318994)
+++ head/sys/vm/swap_pager.cSat May 27 16:40:00 2017(r318995)
@@ -2310,9 +2310,13 @@ swapoff_one(struct swdevt *sp, struct uc
 */
mtx_lock(&sw_dev_mtx);
sp->sw_flags |= SW_CLOSING;
-   for (dvbase = 0; dvbase < sp->sw_end; dvbase += dmmax) {
+   for (dvbase = 0; dvbase < nblks; dvbase += BLIST_BMAP_RADIX) {
+   /*
+* blist_fill() cannot allocate more than BLIST_BMAP_RADIX
+* blocks per call.
+*/
swap_pager_avail -= blist_fill(sp->sw_blist,
-dvbase, dmmax);
+   dvbase, ulmin(nblks - dvbase, BLIST_BMAP_RADIX));
}
swap_total -= (vm_ooffset_t)nblks * PAGE_SIZE;
mtx_unlock(&sw_dev_mtx);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r318996 - head/usr.bin/netstat

2017-05-27 Thread John Baldwin
Author: jhb
Date: Sat May 27 16:53:39 2017
New Revision: 318996
URL: https://svnweb.freebsd.org/changeset/base/318996

Log:
  Add descriptions for AES-GCM IPSec authentication (AH) counters.
  
  MFC after:1 week
  Sponsored by: Chelsio Communications

Modified:
  head/usr.bin/netstat/ipsec.c

Modified: head/usr.bin/netstat/ipsec.c
==
--- head/usr.bin/netstat/ipsec.cSat May 27 16:40:00 2017
(r318995)
+++ head/usr.bin/netstat/ipsec.cSat May 27 16:53:39 2017
(r318996)
@@ -141,6 +141,15 @@ static struct val2str ipsec_ahnames[] = 
 #ifdef SADB_X_AALG_AES_XCBC_MAC
{ SADB_X_AALG_AES_XCBC_MAC, "aes-xcbc-mac", },
 #endif
+#ifdef SADB_X_AALG_AES128GMAC
+   { SADB_X_AALG_AES128GMAC, "aes-gmac-128", },
+#endif
+#ifdef SADB_X_AALG_AES192GMAC
+   { SADB_X_AALG_AES192GMAC, "aes-gmac-192", },
+#endif
+#ifdef SADB_X_AALG_AES256GMAC
+   { SADB_X_AALG_AES256GMAC, "aes-gmac-256", },
+#endif
{ -1, NULL },
 };
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r318997 - in head/sys: cddl/contrib/opensolaris/uts/common/fs/zfs fs/nfsclient kern sys

2017-05-27 Thread Konstantin Belousov
Author: kib
Date: Sat May 27 17:00:30 2017
New Revision: 318997
URL: https://svnweb.freebsd.org/changeset/base/318997

Log:
  Use whole mnt_stat.f_fsid bits for st_dev.
  
  Since ino64 expanded dev_t to 64bit, make VOP_GETATTR(9) provide all
  bits of mnt_stat.f_fsid as va_fsid for vnodes on filesystems which use
  f_fsid.  In particular, NFSv3 and sometimes NFSv4, and ZFS use this
  method or reporting st_dev by stat(2).
  
  Provide a new helper vn_fsid() to avoid duplicating code to copy
  f_fsid to va_fsid.
  
  Note that the change is mostly cosmetic.  Its motivation is to avoid
  sign-extension of f_fsid[0] into 64bit dev_t value which happens after
  dev_t becomes 64bit..
  
  Reviewed by:  avg(zfs), rmacklem (nfs) (both for previous version)
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
  head/sys/fs/nfsclient/nfs_clport.c
  head/sys/kern/vfs_vnops.c
  head/sys/sys/vnode.h

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.cSat May 
27 16:53:39 2017(r318996)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.cSat May 
27 17:00:30 2017(r318997)
@@ -497,7 +497,7 @@ zfsctl_common_getattr(vnode_t *vp, vattr
vap->va_blksize = 0;
vap->va_nblocks = 0;
vap->va_seq = 0;
-   vap->va_fsid = vp->v_mount->mnt_stat.f_fsid.val[0];
+   vn_fsid(vp, vap);
vap->va_mode = S_IRUSR | S_IXUSR | S_IRGRP | S_IXGRP |
S_IROTH | S_IXOTH;
vap->va_type = VDIR;

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Sat May 
27 16:53:39 2017(r318996)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Sat May 
27 17:00:30 2017(r318997)
@@ -2708,7 +2708,7 @@ zfs_getattr(vnode_t *vp, vattr_t *vap, i
 #ifdef illumos
vap->va_fsid = zp->z_zfsvfs->z_vfs->vfs_dev;
 #else
-   vap->va_fsid = vp->v_mount->mnt_stat.f_fsid.val[0];
+   vn_fsid(vp, vap);
 #endif
vap->va_nodeid = zp->z_id;
if ((vp->v_flag & VROOT) && zfs_show_ctldir(zp))

Modified: head/sys/fs/nfsclient/nfs_clport.c
==
--- head/sys/fs/nfsclient/nfs_clport.c  Sat May 27 16:53:39 2017
(r318996)
+++ head/sys/fs/nfsclient/nfs_clport.c  Sat May 27 17:00:30 2017
(r318997)
@@ -490,14 +490,13 @@ nfscl_loadattrcache(struct vnode **vpp, 
 * from the value used for the top level server volume
 * in the mounted subtree.
 */
-   if (vp->v_mount->mnt_stat.f_fsid.val[0] !=
-   (uint32_t)np->n_vattr.na_filesid[0])
-   vap->va_fsid = (uint32_t)np->n_vattr.na_filesid[0];
-   else
-   vap->va_fsid = (uint32_t)hash32_buf(
+   vn_fsid(vp, vap);
+   vap->va_fsid = np->n_vattr.na_filesid[0];
+   if (vap->va_fsid == np->n_vattr.na_filesid[0])
+   vap->va_fsid = hash32_buf(
np->n_vattr.na_filesid, 2 * sizeof(uint64_t), 0);
} else
-   vap->va_fsid = vp->v_mount->mnt_stat.f_fsid.val[0];
+   vn_fsid(vp, vap);
np->n_attrstamp = time_second;
if (vap->va_size != np->n_size) {
if (vap->va_type == VREG) {

Modified: head/sys/kern/vfs_vnops.c
==
--- head/sys/kern/vfs_vnops.c   Sat May 27 16:53:39 2017(r318996)
+++ head/sys/kern/vfs_vnops.c   Sat May 27 17:00:30 2017(r318997)
@@ -2493,3 +2493,14 @@ vn_mmap(struct file *fp, vm_map_t map, v
 #endif
return (error);
 }
+
+void
+vn_fsid(struct vnode *vp, struct vattr *va)
+{
+   fsid_t *f;
+
+   f = &vp->v_mount->mnt_stat.f_fsid;
+   va->va_fsid = (uint32_t)f->val[1];
+   va->va_fsid <<= sizeof(f->val[1]) * NBBY;
+   va->va_fsid += (uint32_t)f->val[0];
+}

Modified: head/sys/sys/vnode.h
==
--- head/sys/sys/vnode.hSat May 27 16:53:39 2017(r318996)
+++ head/sys/sys/vnode.hSat May 27 17:00:30 2017(r318997)
@@ -885,6 +885,8 @@ int vn_chmod(struct file *fp, mode_t mod
 int vn_chown(struct file *fp, uid_t uid, gid_t gid, struct ucred *active_cred,
 struct thread *td);
 
+void vn_fsid(struct vnode *vp, struct vattr *va);
+
 #endif /* _KERNEL */
 
 #endif /* !_SYS_VNODE_H_ */
___
svn-src-head@freebsd.org mai

svn commit: r318998 - head/sys/contrib/ipfilter/netinet

2017-05-27 Thread Cy Schubert
Author: cy
Date: Sat May 27 18:01:14 2017
New Revision: 318998
URL: https://svnweb.freebsd.org/changeset/base/318998

Log:
  Fix return value of ip_sync_nat. Previously, regardless of error it
  always returned a return code of 0.
  
  Obtained from:NetBSD ip_sync.c r1.5
  MFC after:1 week

Modified:
  head/sys/contrib/ipfilter/netinet/ip_sync.c

Modified: head/sys/contrib/ipfilter/netinet/ip_sync.c
==
--- head/sys/contrib/ipfilter/netinet/ip_sync.c Sat May 27 17:00:30 2017
(r318997)
+++ head/sys/contrib/ipfilter/netinet/ip_sync.c Sat May 27 18:01:14 2017
(r318998)
@@ -939,7 +939,7 @@ ipf_sync_nat(softc, sp, data)
nat_t *n, *nat;
synclist_t *sl;
u_int hv = 0;
-   int err;
+   int err = 0;
 
READ_ENTER(&softs->ipf_syncnat);
 
@@ -1016,7 +1016,7 @@ ipf_sync_nat(softc, sp, data)
}
 
RWLOCK_EXIT(&softs->ipf_syncnat);
-   return 0;
+   return err;
 }
 
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r318999 - head/sys/boot/common

2017-05-27 Thread Baptiste Daroussin
Author: bapt
Date: Sat May 27 18:46:00 2017
New Revision: 318999
URL: https://svnweb.freebsd.org/changeset/base/318999

Log:
  Update the comments concerning net_parse_rootpath to reflect what it is now
  really doing
  
  Reported by:  rgrimes
  Reviewed by:  rgrimes
  Differential Revision:https://reviews.freebsd.org/D10959

Modified:
  head/sys/boot/common/dev_net.c

Modified: head/sys/boot/common/dev_net.c
==
--- head/sys/boot/common/dev_net.c  Sat May 27 18:01:14 2017
(r318998)
+++ head/sys/boot/common/dev_net.c  Sat May 27 18:46:00 2017
(r318999)
@@ -367,8 +367,20 @@ net_print(int verbose)
 }
 
 /*
- * Strip the server's address off of the rootpath if present and return it in
- * network byte order, leaving just the pathname part in the global rootpath.
+ * Parses the rootpath if present
+ *
+ * The rootpath format can be in the form
+ * ://ip/path
+ * :/path
+ *
+ * For compatibility with previous behaviour it also accepts as an NFS scheme
+ * ip:/path
+ * /path
+ *
+ * If an ip is set it returns it in network byte order.
+ * The default scheme defined in the global netproto, if not set it defaults to
+ * NFS.
+ * It leaves just the pathname in the global rootpath.
  */
 uint32_t
 net_parse_rootpath()
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r319000 - head/contrib/binutils/ld

2017-05-27 Thread Pedro F. Giffuni
Author: pfg
Date: Sat May 27 20:01:50 2017
New Revision: 319000
URL: https://svnweb.freebsd.org/changeset/base/319000

Log:
  Align text correctly by using tabs instead of spaces.
  
  The text was copy-pasted from the lines that carry the bogus spaces.
  This is a non-functional change.

Modified:
  head/contrib/binutils/ld/configure.tgt

Modified: head/contrib/binutils/ld/configure.tgt
==
--- head/contrib/binutils/ld/configure.tgt  Sat May 27 18:46:00 2017
(r318999)
+++ head/contrib/binutils/ld/configure.tgt  Sat May 27 20:01:50 2017
(r319000)
@@ -480,7 +480,7 @@ powerpc-*-lynxos*)  targ_emul=ppclynx ;;
 rs6000-*-aix5*)targ_emul=aix5rs6 ;;
 rs6000-*-aix*) targ_emul=aixrs6
;;
-s390x-*-freebsd*) targ_emul=elf64_s390
+s390x-*-freebsd*)  targ_emul=elf64_s390
targ_extra_emuls=elf_s390
targ_extra_libpath=$targ_extra_emuls
tdir_elf_s390=`echo ${targ_alias} | sed -e 
's/s390x/s390/'` ;;
@@ -490,7 +490,7 @@ s390x-*-linux*) targ_emul=elf64_
tdir_elf_s390=`echo ${targ_alias} | sed -e 
's/s390x/s390/'` ;;
 s390x-*-tpf*)  targ_emul=elf64_s390
tdir_elf_s390=`echo ${targ_alias} | sed -e 
's/s390x/s390/'` ;;
-s390-*-freebsd*)  targ_emul=elf_s390
+s390-*-freebsd*)   targ_emul=elf_s390
targ64_extra_emuls=elf64_s390
targ64_extra_libpath=elf64_s390
tdir_elf64_s390=`echo ${targ_alias} | sed -e 
's/s390/s390x/'`
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r319001 - head/sys/vm

2017-05-27 Thread Alan Cox
Author: alc
Date: Sat May 27 21:46:00 2017
New Revision: 319001
URL: https://svnweb.freebsd.org/changeset/base/319001

Log:
  After r118390, the variable "dmmax" was neither the correct strip size
  nor the correct maximum block size.  Moreover, after r318995, it serves
  no purpose except to provide information to user space through a read-
  sysctl.
  
  This change eliminates the variable "dmmax" but retains the sysctl.  It
  also corrects the value returned by the sysctl.
  
  Reviewed by:  kib, markj
  MFC after:3 days

Modified:
  head/sys/vm/swap_pager.c

Modified: head/sys/vm/swap_pager.c
==
--- head/sys/vm/swap_pager.cSat May 27 20:01:50 2017(r319000)
+++ head/sys/vm/swap_pager.cSat May 27 21:46:00 2017(r319001)
@@ -381,18 +381,14 @@ struct pagerops swappagerops = {
 };
 
 /*
- * dmmax is in page-sized chunks with the new swap system.  It was
- * dev-bsized chunks in the old.  dmmax is always a power of 2.
- *
  * swap_*() routines are externally accessible.  swp_*() routines are
  * internal.
  */
-static int dmmax;
 static int nswap_lowat = 128;  /* in pages, swap_pager_almost_full warn */
 static int nswap_hiwat = 512;  /* in pages, swap_pager_almost_full warn */
 
-SYSCTL_INT(_vm, OID_AUTO, dmmax, CTLFLAG_RD, &dmmax, 0,
-"Maximum size of a swap block");
+SYSCTL_INT(_vm, OID_AUTO, dmmax, CTLFLAG_RD, &nsw_cluster_max, 0,
+"Maximum size of a swap block in pages");
 
 static voidswp_sizecheck(void);
 static voidswp_pager_async_iodone(struct buf *bp);
@@ -489,11 +485,6 @@ swap_pager_init(void)
mtx_init(&sw_dev_mtx, "swapdev", NULL, MTX_DEF);
sx_init(&sw_alloc_sx, "swspsx");
sx_init(&swdev_syscall_lock, "swsysc");
-
-   /*
-* Device Stripe, in PAGE_SIZE'd blocks
-*/
-   dmmax = SWB_NPAGES * 2;
 }
 
 /*
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r319002 - head/usr.bin/grep/tests

2017-05-27 Thread Ngie Cooper
Author: ngie
Date: Sat May 27 22:40:20 2017
New Revision: 319002
URL: https://svnweb.freebsd.org/changeset/base/319002

Log:
  :rgrep : use atf-check to check the exit code/save the output of grep -r 
instead
  of calling grep -r without it, and saving the output to a file
  
  This ensures that any errors thrown via grep -r are caught, not lost, and uses
  existing atf-sh idioms for saving files.
  
  Tested with:  bsdgrep, gnu grep (base, ports)
  Sponsored by: Dell EMC Isilon

Modified:
  head/usr.bin/grep/tests/grep_freebsd_test.sh

Modified: head/usr.bin/grep/tests/grep_freebsd_test.sh
==
--- head/usr.bin/grep/tests/grep_freebsd_test.shSat May 27 21:46:00 
2017(r319001)
+++ head/usr.bin/grep/tests/grep_freebsd_test.shSat May 27 22:40:20 
2017(r319002)
@@ -77,8 +77,7 @@ rgrep_head()
 }
 rgrep_body()
 {
-   grep -r --exclude="*.out" -e "test" "$(atf_get_srcdir)" > 
d_grep_r_implied.out
-
+   atf_check -o save:d_grep_r_implied.out grep -r --exclude="*.out" -e 
"test" "$(atf_get_srcdir)"
atf_check -o file:d_grep_r_implied.out rgrep --exclude="*.out" -e 
"test" "$(atf_get_srcdir)"
 }
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r319008 - head/lib/libkvm/tests

2017-05-27 Thread Ngie Cooper
Author: ngie
Date: Sat May 27 23:19:32 2017
New Revision: 319008
URL: https://svnweb.freebsd.org/changeset/base/319008

Log:
  kvm_geterr_test: Compile out the portions that require kvm_open2(3) on
  systems that lack the libcall, based on __FreeBSD_version.
  
  kvm_open2(3) wasn't made available until r291406, which is in ^/stable/11,
  but not ^/stable/10. This makes some of kvm_geterr_test available for testing
  on ^/stable/10.
  
  MFC after:now
  Sponsored by: Dell EMC Isilon

Modified:
  head/lib/libkvm/tests/kvm_geterr_test.c

Modified: head/lib/libkvm/tests/kvm_geterr_test.c
==
--- head/lib/libkvm/tests/kvm_geterr_test.c Sat May 27 23:04:48 2017
(r319007)
+++ head/lib/libkvm/tests/kvm_geterr_test.c Sat May 27 23:19:32 2017
(r319008)
@@ -65,6 +65,8 @@ ATF_TC_HEAD(kvm_geterr_positive_test_err
atf_tc_set_md_var(tc, "require.user", "root");
 }
 
+/* 1100090 was where kvm_open2(3) was introduced. */
+#if __FreeBSD_version >= 1100091
 ATF_TC_BODY(kvm_geterr_positive_test_error, tc)
 {
kvm_t *kd;
@@ -125,13 +127,16 @@ ATF_TC_BODY(kvm_geterr_positive_test_no_
ATF_REQUIRE_MSG(kvm_close(kd) == 0, "kvm_close failed: %s",
strerror(errno));
 }
+#endif
 
 ATF_TP_ADD_TCS(tp)
 {
 
ATF_TP_ADD_TC(tp, kvm_geterr_negative_test_NULL);
+#if __FreeBSD_version >= 1100091
ATF_TP_ADD_TC(tp, kvm_geterr_positive_test_error);
ATF_TP_ADD_TC(tp, kvm_geterr_positive_test_no_error);
+#endif
 
return (atf_no_error());
 }
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r319010 - head/lib/libkvm/tests

2017-05-27 Thread Ngie Cooper
Author: ngie
Date: Sat May 27 23:23:22 2017
New Revision: 319010
URL: https://svnweb.freebsd.org/changeset/base/319010

Log:
  Fix #if conditional added in r319008
  
  I committed an earlier version of the file by accident
  
  This is a no-op on ^/head and ^/stable/11.
  
  MFC after:now
  Sponsored by: Dell EMC Isilon

Modified:
  head/lib/libkvm/tests/kvm_geterr_test.c

Modified: head/lib/libkvm/tests/kvm_geterr_test.c
==
--- head/lib/libkvm/tests/kvm_geterr_test.c Sat May 27 23:20:28 2017
(r319009)
+++ head/lib/libkvm/tests/kvm_geterr_test.c Sat May 27 23:23:22 2017
(r319010)
@@ -56,6 +56,8 @@ ATF_TC_BODY(kvm_geterr_negative_test_NUL
ATF_REQUIRE(!errbuf_has_error(kvm_geterr(NULL)));
 }
 
+/* 1100090 was where kvm_open2(3) was introduced. */
+#if __FreeBSD_version >= 1100091
 ATF_TC(kvm_geterr_positive_test_error);
 ATF_TC_HEAD(kvm_geterr_positive_test_error, tc)
 {
@@ -65,8 +67,6 @@ ATF_TC_HEAD(kvm_geterr_positive_test_err
atf_tc_set_md_var(tc, "require.user", "root");
 }
 
-/* 1100090 was where kvm_open2(3) was introduced. */
-#if __FreeBSD_version >= 1100091
 ATF_TC_BODY(kvm_geterr_positive_test_error, tc)
 {
kvm_t *kd;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r319015 - head/tools/regression/geom_gpt

2017-05-27 Thread Ngie Cooper
Author: ngie
Date: Sat May 27 23:57:09 2017
New Revision: 319015
URL: https://svnweb.freebsd.org/changeset/base/319015

Log:
  Use calloc instead of malloc + memset
  
  MFC after:3 days
  Sponsored by: Dell EMC Isilon

Modified:
  head/tools/regression/geom_gpt/gctl_test_helper.c

Modified: head/tools/regression/geom_gpt/gctl_test_helper.c
==
--- head/tools/regression/geom_gpt/gctl_test_helper.c   Sat May 27 23:31:59 
2017(r319014)
+++ head/tools/regression/geom_gpt/gctl_test_helper.c   Sat May 27 23:57:09 
2017(r319015)
@@ -87,10 +87,9 @@ parse(char *arg, char **param, char **va
return (EINVAL);
if (*len <= 0 || *len > PATH_MAX)
return (EINVAL);
-   *value = malloc(*len);
+   *value = calloc(*len, sizeof(char));
if (*value == NULL)
return (ENOMEM);
-   memset(*value, 0, *len);
if (equal != NULL) {
if (strlen(equal) >= PATH_MAX)
return (ENOMEM);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r319019 - head/lib/libgeom

2017-05-27 Thread Ngie Cooper
Author: ngie
Date: Sun May 28 00:28:11 2017
New Revision: 319019
URL: https://svnweb.freebsd.org/changeset/base/319019

Log:
  Remove getpagesize(3) error checking added in r317312
  
  getpagesize(3) no longer fails as of r317436.
  
  MFC after:3 days
  Sponsored by: Dell EMC Isilon

Modified:
  head/lib/libgeom/geom_stats.c

Modified: head/lib/libgeom/geom_stats.c
==
--- head/lib/libgeom/geom_stats.c   Sun May 28 00:25:44 2017
(r319018)
+++ head/lib/libgeom/geom_stats.c   Sun May 28 00:28:11 2017
(r319019)
@@ -87,8 +87,6 @@ geom_stats_open(void)
if (statsfd < 0)
return (errno);
pagesize = getpagesize();
-   if (pagesize == -1)
-   return (errno);
spp = pagesize / sizeof(struct devstat);
p = mmap(NULL, pagesize, PROT_READ, MAP_SHARED, statsfd, 0);
if (p == MAP_FAILED) {
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r319020 - head/share/mk

2017-05-27 Thread Eric van Gyzen
Author: vangyzen
Date: Sun May 28 00:43:12 2017
New Revision: 319020
URL: https://svnweb.freebsd.org/changeset/base/319020

Log:
  Fix INSTALL_AS_USER
  
  Move INSTALL_AS_USER into bsd.init.mk to maximize the chance that
  it has final authority over fooOWN and fooGRP.
  
  Reviewed by:  sjg
  MFC after:3 days
  Sponsored by: Dell EMC
  Differential Revision:https://reviews.freebsd.org/D10810

Modified:
  head/share/mk/bsd.init.mk
  head/share/mk/bsd.own.mk

Modified: head/share/mk/bsd.init.mk
==
--- head/share/mk/bsd.init.mk   Sun May 28 00:28:11 2017(r319019)
+++ head/share/mk/bsd.init.mk   Sun May 28 00:43:12 2017(r319020)
@@ -16,6 +16,33 @@ :
 .include 
 .MAIN: all
 
+# Handle INSTALL_AS_USER here to maximize the chance that
+# it has final authority over fooOWN and fooGRP.
+.if ${MK_INSTALL_AS_USER} != "no"
+.if !defined(_uid)
+_uid!= id -u
+.export _uid
+.endif
+.if ${_uid} != 0
+.if !defined(USER)
+# Avoid exporting USER
+.if !defined(_USER)
+_USER!=id -un
+.export _USER
+.endif
+USER=  ${_USER}
+.endif
+.if !defined(_gid)
+_gid!= id -g
+.export _gid
+.endif
+.for x in BIN CONF DOC DTB INFO KMOD LIB MAN NLS SHARE
+$xOWN= ${USER}
+$xGRP= ${_gid}
+.endfor
+.endif
+.endif
+
 # Some targets need to know when something may build.  This is used to
 # optimize targets that are only needed when building something, such as
 # (not) reading in depend files.  For DIRDEPS_BUILD, it will only calculate

Modified: head/share/mk/bsd.own.mk
==
--- head/share/mk/bsd.own.mkSun May 28 00:28:11 2017(r319019)
+++ head/share/mk/bsd.own.mkSun May 28 00:43:12 2017(r319020)
@@ -135,31 +135,6 @@ CTFCONVERT_CMD=
 CTFCONVERT_CMD=@:
 .endif 
 
-.if ${MK_INSTALL_AS_USER} != "no"
-.if !defined(_uid)
-_uid!= id -u
-.export _uid
-.endif
-.if ${_uid} != 0
-.if !defined(USER)
-# Avoid exporting USER
-.if !defined(_USER)
-_USER!=id -un
-.export _USER
-.endif
-USER=  ${_USER}
-.endif
-.if !defined(_gid)
-_gid!= id -g
-.export _gid
-.endif
-.for x in BIN CONF DOC DTB INFO KMOD LIB MAN NLS SHARE
-$xOWN= ${USER}
-$xGRP= ${_gid}
-.endfor
-.endif
-.endif
-
 .endif # !_WITHOUT_SRCCONF
 
 # Binaries
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r319022 - head/share/mk

2017-05-27 Thread Eric van Gyzen
Author: vangyzen
Date: Sun May 28 00:45:28 2017
New Revision: 319022
URL: https://svnweb.freebsd.org/changeset/base/319022

Log:
  Fix INSTALL_AS_USER with external nsswitch databases
  
  The INSTALL_AS_USER option tells "install" to use the current
  user name as the owner of the installed file.  The "install"
  command executed by the build is statically linked, so it does not
  load nsswitch modules, such as nss_ldap.so, so it fails when
  the user is only defined in such a database.
  
  Fix it to use the current UID instead of user name.  This works
  for all users.  I expect it is also slightly more efficient.
  
  Reviewed by:  sjg
  MFC after:3 days
  Sponsored by: Dell EMC
  Differential Revision:https://reviews.freebsd.org/D10862

Modified:
  head/share/mk/bsd.init.mk

Modified: head/share/mk/bsd.init.mk
==
--- head/share/mk/bsd.init.mk   Sun May 28 00:45:02 2017(r319021)
+++ head/share/mk/bsd.init.mk   Sun May 28 00:45:28 2017(r319022)
@@ -24,20 +24,12 @@ _uid!=  id -u
 .export _uid
 .endif
 .if ${_uid} != 0
-.if !defined(USER)
-# Avoid exporting USER
-.if !defined(_USER)
-_USER!=id -un
-.export _USER
-.endif
-USER=  ${_USER}
-.endif
 .if !defined(_gid)
 _gid!= id -g
 .export _gid
 .endif
 .for x in BIN CONF DOC DTB INFO KMOD LIB MAN NLS SHARE
-$xOWN= ${USER}
+$xOWN= ${_uid}
 $xGRP= ${_gid}
 .endfor
 .endif
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r319026 - head/usr.sbin/pw/tests

2017-05-27 Thread Ngie Cooper
Author: ngie
Date: Sun May 28 02:15:57 2017
New Revision: 319026
URL: https://svnweb.freebsd.org/changeset/base/319026

Log:
  pw: add some basic testcases for groupshow and usershow
  
  - groupshow: test out -a/-g/-n .
  - usershow: test out -a/-n/-u .
  
  MFC after:1 week
  Sponsored by: Dell EMC Isilon

Added:
  head/usr.sbin/pw/tests/pw_groupshow_test.sh   (contents, props changed)
  head/usr.sbin/pw/tests/pw_usershow_test.sh   (contents, props changed)
Modified:
  head/usr.sbin/pw/tests/Makefile

Modified: head/usr.sbin/pw/tests/Makefile
==
--- head/usr.sbin/pw/tests/Makefile Sun May 28 01:14:59 2017
(r319025)
+++ head/usr.sbin/pw/tests/Makefile Sun May 28 02:15:57 2017
(r319026)
@@ -14,10 +14,12 @@ ATF_TESTS_SH=   pw_etcdir_test \
pw_groupadd_test \
pw_groupdel_test \
pw_groupmod_test \
+   pw_groupshow_test \
pw_useradd_test \
pw_userdel_test \
pw_usermod_test \
-   pw_usernext_test
+   pw_usernext_test \
+   pw_usershow_test
 
 .for tp in ${ATF_TESTS_SH}
 TEST_METADATA.${tp}+=  required_user="root"

Added: head/usr.sbin/pw/tests/pw_groupshow_test.sh
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/usr.sbin/pw/tests/pw_groupshow_test.sh Sun May 28 02:15:57 2017
(r319026)
@@ -0,0 +1,56 @@
+# $FreeBSD$
+
+# Import helper functions
+. $(atf_get_srcdir)/helper_functions.shin
+
+atf_test_case group_show_all
+group_show_all_body() {
+   populate_etc_skel
+   atf_check -o not-empty ${PW} groupshow -a
+}
+
+atf_test_case group_show_gid
+group_show_gid_body() {
+   populate_etc_skel
+   atf_check -o not-empty ${PW} groupshow -g 0
+}
+
+atf_test_case group_show_name
+group_show_name_body() {
+   populate_etc_skel
+   atf_check -o not-empty ${PW} groupshow wheel
+}
+
+atf_test_case group_show_nonexistent_gid
+group_show_nonexistent_gid_body() {
+   populate_etc_skel
+
+   nonexistent_gid=4242
+   no_such_name_msg="pw: unknown gid \`$nonexistent_gid'\n"
+
+   atf_check -e "inline:$no_such_name_msg" -s exit:65 ${PW} groupshow \
+   $nonexistent_gid
+   atf_check -e "inline:$no_such_name_msg" -s exit:65 ${PW} groupshow \
+   -g $nonexistent_gid
+}
+
+atf_test_case group_show_nonexistent_name
+group_show_nonexistent_name_body() {
+   populate_etc_skel
+
+   nonexistent_name=bogus
+   no_such_name_msg="pw: unknown group \`$nonexistent_name'\n"
+
+   atf_check -e "inline:$no_such_name_msg" -s exit:65 ${PW} groupshow \
+   $nonexistent_name
+   atf_check -e "inline:$no_such_name_msg" -s exit:65 ${PW} groupshow \
+   -n $nonexistent_name
+}
+
+atf_init_test_cases() {
+   atf_add_test_case group_show_all
+   atf_add_test_case group_show_gid
+   atf_add_test_case group_show_name
+   atf_add_test_case group_show_nonexistent_gid
+   atf_add_test_case group_show_nonexistent_name
+}

Added: head/usr.sbin/pw/tests/pw_usershow_test.sh
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/usr.sbin/pw/tests/pw_usershow_test.sh  Sun May 28 02:15:57 2017
(r319026)
@@ -0,0 +1,56 @@
+# $FreeBSD$
+
+# Import helper functions
+. $(atf_get_srcdir)/helper_functions.shin
+
+atf_test_case user_show_all
+user_show_all_body() {
+   populate_etc_skel
+   atf_check -o not-empty ${PW} usershow -a
+}
+
+atf_test_case user_show_name
+user_show_name_body() {
+   populate_etc_skel
+   atf_check -o not-empty ${PW} usershow root
+}
+
+atf_test_case user_show_nonexistent_name
+user_show_nonexistent_name_body() {
+   populate_etc_skel
+
+   nonexistent_user=bogus
+   no_such_user_msg="pw: no such user \`$nonexistent_user'\n"
+
+   atf_check -e "inline:$no_such_user_msg" -s exit:67 ${PW} usershow \
+   $nonexistent_user
+   atf_check -e "inline:$no_such_user_msg" -s exit:67 ${PW} usershow \
+   -n $nonexistent_user
+}
+
+atf_test_case user_show_nonexistent_uid
+user_show_nonexistent_uid_body() {
+   populate_etc_skel
+
+   nonexistent_uid=4242
+   no_such_uid_msg="pw: no such uid \`$nonexistent_uid'\n"
+
+   atf_check -e "inline:$no_such_uid_msg" -s exit:67 ${PW} usershow \
+   $nonexistent_uid
+   atf_check -e "inline:$no_such_uid_msg" -s exit:67 ${PW} usershow \
+   -u $nonexistent_uid
+}
+
+atf_test_case user_show_uid
+user_show_uid_body() {
+   populate_etc_skel
+   atf_check -o not-empty ${PW} usershow -u 0
+}
+
+atf_init_test_cases() {
+   atf_add_test_case user_show_all
+   atf_add_test_case user_show_name
+   atf_add_tes

svn commit: r319027 - head/lib/libc/tests/nss

2017-05-27 Thread Ngie Cooper
Author: ngie
Date: Sun May 28 02:55:04 2017
New Revision: 319027
URL: https://svnweb.freebsd.org/changeset/base/319027

Log:
  lib/libc/tests/nss: use calloc appropriately
  
  The pattern used prior to this commit was `calloc(1, n * sizeof(type))`;
  the pattern that should be used however is `calloc(n, sizeof(type))`.
  
  MFC after:3 days
  Sponsored by: Dell EMC Isilon

Modified:
  head/lib/libc/tests/nss/getgr_test.c
  head/lib/libc/tests/nss/gethostby_test.c
  head/lib/libc/tests/nss/getproto_test.c
  head/lib/libc/tests/nss/getrpc_test.c
  head/lib/libc/tests/nss/getserv_test.c

Modified: head/lib/libc/tests/nss/getgr_test.c
==
--- head/lib/libc/tests/nss/getgr_test.cSun May 28 02:15:57 2017
(r319026)
+++ head/lib/libc/tests/nss/getgr_test.cSun May 28 02:55:04 2017
(r319027)
@@ -104,7 +104,7 @@ clone_group(struct group *dest, struct g
for (cp = src->gr_mem; *cp; ++cp)
++members_num;
 
-   dest->gr_mem = calloc(1, (members_num + 1) * sizeof(char *));
+   dest->gr_mem = calloc(members_num + 1, sizeof(char *));
ATF_REQUIRE(dest->gr_mem != NULL);
 
for (cp = src->gr_mem; *cp; ++cp) {

Modified: head/lib/libc/tests/nss/gethostby_test.c
==
--- head/lib/libc/tests/nss/gethostby_test.cSun May 28 02:15:57 2017
(r319026)
+++ head/lib/libc/tests/nss/gethostby_test.cSun May 28 02:55:04 2017
(r319027)
@@ -163,8 +163,7 @@ clone_hostent(struct hostent *dest, stru
for (cp = src->h_aliases; *cp; ++cp)
++aliases_num;
 
-   dest->h_aliases = calloc(1, (aliases_num + 1) *
-   sizeof(char *));
+   dest->h_aliases = calloc(aliases_num + 1, sizeof(char *));
ATF_REQUIRE(dest->h_aliases != NULL);
 
for (cp = src->h_aliases; *cp; ++cp) {
@@ -178,7 +177,7 @@ clone_hostent(struct hostent *dest, stru
for (cp = src->h_addr_list; *cp; ++cp)
++addrs_num;
 
-   dest->h_addr_list = calloc(1, (addrs_num + 1) * sizeof(char *));
+   dest->h_addr_list = calloc(addrs_num + 1, sizeof(char *));
ATF_REQUIRE(dest->h_addr_list != NULL);
 
for (cp = src->h_addr_list; *cp; ++cp) {

Modified: head/lib/libc/tests/nss/getproto_test.c
==
--- head/lib/libc/tests/nss/getproto_test.c Sun May 28 02:15:57 2017
(r319026)
+++ head/lib/libc/tests/nss/getproto_test.c Sun May 28 02:55:04 2017
(r319027)
@@ -99,7 +99,7 @@ clone_protoent(struct protoent *dest, st
for (cp = src->p_aliases; *cp; ++cp)
++aliases_num;
 
-   dest->p_aliases = calloc(1, (aliases_num+1) * sizeof(char *));
+   dest->p_aliases = calloc(aliases_num + 1, sizeof(char *));
assert(dest->p_aliases != NULL);
 
for (cp = src->p_aliases; *cp; ++cp) {

Modified: head/lib/libc/tests/nss/getrpc_test.c
==
--- head/lib/libc/tests/nss/getrpc_test.c   Sun May 28 02:15:57 2017
(r319026)
+++ head/lib/libc/tests/nss/getrpc_test.c   Sun May 28 02:55:04 2017
(r319027)
@@ -100,7 +100,7 @@ clone_rpcent(struct rpcent *dest, struct
for (cp = src->r_aliases; *cp; ++cp)
++aliases_num;
 
-   dest->r_aliases = calloc(1, (aliases_num + 1) * sizeof(char *));
+   dest->r_aliases = calloc(aliases_num + 1, sizeof(char *));
ATF_REQUIRE(dest->r_aliases != NULL);
 
for (cp = src->r_aliases; *cp; ++cp) {

Modified: head/lib/libc/tests/nss/getserv_test.c
==
--- head/lib/libc/tests/nss/getserv_test.c  Sun May 28 02:15:57 2017
(r319026)
+++ head/lib/libc/tests/nss/getserv_test.c  Sun May 28 02:55:04 2017
(r319027)
@@ -102,7 +102,7 @@ clone_servent(struct servent *dest, stru
for (cp = src->s_aliases; *cp; ++cp)
++aliases_num;
 
-   dest->s_aliases = calloc(1, (aliases_num + 1) * sizeof(char *));
+   dest->s_aliases = calloc(aliases_num + 1, sizeof(char *));
ATF_REQUIRE(dest->s_aliases != NULL);
 
for (cp = src->s_aliases; *cp; ++cp) {
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r319028 - head/lib/libc/tests/nss

2017-05-27 Thread Ngie Cooper
Author: ngie
Date: Sun May 28 03:39:24 2017
New Revision: 319028
URL: https://svnweb.freebsd.org/changeset/base/319028

Log:
  Sort make variables to suit style.Makefile(5)
  
  This is being done prior to functional changes.
  
  MFC after:3 days
  Sponsored by: Dell EMC Isilon

Modified:
  head/lib/libc/tests/nss/Makefile

Modified: head/lib/libc/tests/nss/Makefile
==
--- head/lib/libc/tests/nss/MakefileSun May 28 02:55:04 2017
(r319027)
+++ head/lib/libc/tests/nss/MakefileSun May 28 03:39:24 2017
(r319028)
@@ -1,18 +1,13 @@
 # $FreeBSD$
 
+.PATH: ${.CURDIR:H}/resolv
+
 PACKAGE=   tests
 
 TESTSDIR=  ${TESTSBASE}/lib/libc/nss
 
 BINDIR=${TESTSDIR}
 
-.PATH: ${.CURDIR:H}/resolv
-
-${PACKAGE}FILES+=  mach
-
-WARNS?=1
-CFLAGS+=   -I${SRCTOP}/tests
-
 ATF_TESTS_C+=  getaddrinfo_test
 ATF_TESTS_C+=  getgr_test
 ATF_TESTS_C+=  gethostby_test
@@ -23,4 +18,10 @@ ATF_TESTS_C+=getrpc_test
 ATF_TESTS_C+=  getserv_test
 ATF_TESTS_C+=  getusershell_test
 
+${PACKAGE}FILES+=  mach
+
+WARNS?=1
+
+CFLAGS+=   -I${SRCTOP}/tests
+
 .include 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r319029 - head/lib/libc/tests/nss

2017-05-27 Thread Ngie Cooper
Author: ngie
Date: Sun May 28 03:42:49 2017
New Revision: 319029
URL: https://svnweb.freebsd.org/changeset/base/319029

Log:
  Staticize functions and remove unused variables to aid with bumping WARNS
  
  MFC after:3 days
  Sponsored by: Dell EMC Isilon

Modified:
  head/lib/libc/tests/nss/getaddrinfo_test.c
  head/lib/libc/tests/nss/getgr_test.c
  head/lib/libc/tests/nss/getpw_test.c
  head/lib/libc/tests/nss/getusershell_test.c

Modified: head/lib/libc/tests/nss/getaddrinfo_test.c
==
--- head/lib/libc/tests/nss/getaddrinfo_test.c  Sun May 28 03:39:24 2017
(r319028)
+++ head/lib/libc/tests/nss/getaddrinfo_test.c  Sun May 28 03:42:49 2017
(r319029)
@@ -144,7 +144,7 @@ compare_addrinfo(struct addrinfo *ai1, s
return (rv);
 }
 
-void
+static void
 free_addrinfo(struct addrinfo *ai)
 {
if (ai == NULL)
@@ -409,7 +409,7 @@ addrinfo_read_hostlist_func(struct addri
return (0);
 }
 
-void
+static void
 run_tests(char *hostlist_file, char *snapshot_file, int ai_family)
 {
struct addrinfo_test_data td, td_snap;

Modified: head/lib/libc/tests/nss/getgr_test.c
==
--- head/lib/libc/tests/nss/getgr_test.cSun May 28 03:39:24 2017
(r319028)
+++ head/lib/libc/tests/nss/getgr_test.cSun May 28 03:42:49 2017
(r319029)
@@ -49,8 +49,6 @@ enum test_methods {
TEST_BUILD_SNAPSHOT = 16,
 };
 
-static enum test_methods method = TEST_BUILD_SNAPSHOT;
-
 DECLARE_TEST_DATA(group)
 DECLARE_TEST_FILE_SNAPSHOT(group)
 DECLARE_1PASS_TEST(group)

Modified: head/lib/libc/tests/nss/getpw_test.c
==
--- head/lib/libc/tests/nss/getpw_test.cSun May 28 03:39:24 2017
(r319028)
+++ head/lib/libc/tests/nss/getpw_test.cSun May 28 03:42:49 2017
(r319029)
@@ -47,8 +47,6 @@ enum test_methods {
TEST_BUILD_SNAPSHOT
 };
 
-static enum test_methods method = TEST_BUILD_SNAPSHOT;
-
 DECLARE_TEST_DATA(passwd)
 DECLARE_TEST_FILE_SNAPSHOT(passwd)
 DECLARE_1PASS_TEST(passwd)

Modified: head/lib/libc/tests/nss/getusershell_test.c
==
--- head/lib/libc/tests/nss/getusershell_test.c Sun May 28 03:39:24 2017
(r319028)
+++ head/lib/libc/tests/nss/getusershell_test.c Sun May 28 03:42:49 2017
(r319029)
@@ -48,8 +48,6 @@ struct usershell {
char *path;
 };
 
-static enum test_methods method = TEST_GETUSERSHELL;
-
 DECLARE_TEST_DATA(usershell)
 DECLARE_TEST_FILE_SNAPSHOT(usershell)
 DECLARE_2PASS_TEST(usershell)
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r319030 - head/lib/libc/tests/nss

2017-05-27 Thread Ngie Cooper
Author: ngie
Date: Sun May 28 03:47:58 2017
New Revision: 319030
URL: https://svnweb.freebsd.org/changeset/base/319030

Log:
  Fix -Wsign-compare warnings
  
  MFC after:3 days
  Sponsored by: Dell EMC Isilon

Modified:
  head/lib/libc/tests/nss/getgr_test.c

Modified: head/lib/libc/tests/nss/getgr_test.c
==
--- head/lib/libc/tests/nss/getgr_test.cSun May 28 03:42:49 2017
(r319029)
+++ head/lib/libc/tests/nss/getgr_test.cSun May 28 03:47:58 2017
(r319030)
@@ -177,7 +177,7 @@ sdump_group(struct group *grp, char *buf
written = snprintf(buffer, buflen, "%s:%s:%d:",
grp->gr_name, grp->gr_passwd, grp->gr_gid);
buffer += written;
-   if (written > buflen)
+   if (written > (int)buflen)
return;
buflen -= written;
 
@@ -187,7 +187,7 @@ sdump_group(struct group *grp, char *buf
written = snprintf(buffer, buflen, "%s%s",
cp == grp->gr_mem ? "" : ",", *cp);
buffer += written;
-   if (written > buflen)
+   if (written > (int)buflen)
return;
buflen -= written;
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r319031 - head/lib/libc/tests/nss

2017-05-27 Thread Ngie Cooper
Author: ngie
Date: Sun May 28 03:58:36 2017
New Revision: 319031
URL: https://svnweb.freebsd.org/changeset/base/319031

Log:
  getusershell_test: staticize run_tests(..) to fix warnings
  
  MFC after:3 days
  Sponsored by: Dell EMC Isilon

Modified:
  head/lib/libc/tests/nss/getusershell_test.c

Modified: head/lib/libc/tests/nss/getusershell_test.c
==
--- head/lib/libc/tests/nss/getusershell_test.c Sun May 28 03:47:58 2017
(r319030)
+++ head/lib/libc/tests/nss/getusershell_test.c Sun May 28 03:58:36 2017
(r319031)
@@ -132,7 +132,7 @@ usershell_read_snapshot_func(struct user
return (0);
 }
 
-int
+static int
 run_tests(const char *snapshot_file, enum test_methods method)
 {
struct usershell_test_data td, td_snap;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r319034 - head/lib/libc/tests/nss

2017-05-27 Thread Ngie Cooper
Author: ngie
Date: Sun May 28 04:03:45 2017
New Revision: 319034
URL: https://svnweb.freebsd.org/changeset/base/319034

Log:
  getaddrinfo_test: fix -Wsign-compare warnings
  
  MFC after:3 days
  Sponsored by: Dell EMC Isilon

Modified:
  head/lib/libc/tests/nss/getaddrinfo_test.c

Modified: head/lib/libc/tests/nss/getaddrinfo_test.c
==
--- head/lib/libc/tests/nss/getaddrinfo_test.c  Sun May 28 04:03:06 2017
(r319033)
+++ head/lib/libc/tests/nss/getaddrinfo_test.c  Sun May 28 04:03:45 2017
(r319034)
@@ -164,30 +164,30 @@ sdump_addrinfo(struct addrinfo *ai, char
ai->ai_flags, ai->ai_family, ai->ai_socktype, ai->ai_protocol,
ai->ai_addrlen);
buffer += written;
-   if (written > buflen)
+   if (written > (int)buflen)
return;
buflen -= written;
 
written = snprintf(buffer, buflen, "%s ",
ai->ai_canonname == NULL ? "(null)" : ai->ai_canonname);
buffer += written;
-   if (written > buflen)
+   if (written > (int)buflen)
return;
buflen -= written;
 
if (ai->ai_addr == NULL) {
written = snprintf(buffer, buflen, "(null)");
buffer += written;
-   if (written > buflen)
+   if (written > (int)buflen)
return;
buflen -= written;
} else {
-   for (i = 0; i < ai->ai_addrlen; i++) {
+   for (i = 0; i < (int)ai->ai_addrlen; i++) {
written = snprintf(buffer, buflen,
-   i + 1 != ai->ai_addrlen ? "%d." : "%d",
+   i + 1 != (int)ai->ai_addrlen ? "%d." : "%d",
((unsigned char *)ai->ai_addr)[i]);
buffer += written;
-   if (written > buflen)
+   if (written > (int)buflen)
return;
buflen -= written;
 
@@ -199,7 +199,7 @@ sdump_addrinfo(struct addrinfo *ai, char
if (ai->ai_next != NULL) {
written = snprintf(buffer, buflen, ":");
buffer += written;
-   if (written > buflen)
+   if (written > (int)buflen)
return;
buflen -= written;
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r319033 - head/lib/libc/tests/nss

2017-05-27 Thread Ngie Cooper
Author: ngie
Date: Sun May 28 04:03:06 2017
New Revision: 319033
URL: https://svnweb.freebsd.org/changeset/base/319033

Log:
  getserv_test: fix -Wsign-compare and -Wmissing-prototypes warnings
  
  MFC after:3 days
  Sponsored by: Dell EMC Isilon

Modified:
  head/lib/libc/tests/nss/getserv_test.c

Modified: head/lib/libc/tests/nss/getserv_test.c
==
--- head/lib/libc/tests/nss/getserv_test.c  Sun May 28 03:59:33 2017
(r319032)
+++ head/lib/libc/tests/nss/getserv_test.c  Sun May 28 04:03:06 2017
(r319033)
@@ -177,16 +177,16 @@ sdump_servent(struct servent *serv, char
written = snprintf(buffer, buflen, "%s %d %s",
serv->s_name, ntohs(serv->s_port), serv->s_proto);
buffer += written;
-   if (written > buflen)
+   if (written > (int)buflen)
return;
buflen -= written;
 
if (serv->s_aliases != NULL) {
if (*(serv->s_aliases) != '\0') {
for (cp = serv->s_aliases; *cp; ++cp) {
-   written = snprintf(buffer, buflen, " %s",*cp);
+   written = snprintf(buffer, buflen, " %s", *cp);
buffer += written;
-   if (written > buflen)
+   if (written > (int)buflen)
return;
buflen -= written;
 
@@ -410,7 +410,7 @@ servent_test_getservent(struct servent *
return (servent_test_correctness(serv, NULL));
 }
 
-int
+static int
 run_tests(const char *snapshot_file, enum test_methods method)
 {
struct servent_test_data td, td_snap, td_2pass;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r319035 - head/lib/libc/tests/nss

2017-05-27 Thread Ngie Cooper
Author: ngie
Date: Sun May 28 04:04:32 2017
New Revision: 319035
URL: https://svnweb.freebsd.org/changeset/base/319035

Log:
  getrpc_test: fix -Wmissing-prototypes and -Wsign-compare warnings
  
  MFC after:3 days
  Sponsored by: Dell EMC Isilon

Modified:
  head/lib/libc/tests/nss/getrpc_test.c

Modified: head/lib/libc/tests/nss/getrpc_test.c
==
--- head/lib/libc/tests/nss/getrpc_test.c   Sun May 28 04:03:45 2017
(r319034)
+++ head/lib/libc/tests/nss/getrpc_test.c   Sun May 28 04:04:32 2017
(r319035)
@@ -173,16 +173,16 @@ sdump_rpcent(struct rpcent *rpc, char *b
written = snprintf(buffer, buflen, "%s %d",
rpc->r_name, rpc->r_number);
buffer += written;
-   if (written > buflen)
+   if (written > (int)buflen)
return;
buflen -= written;
 
if (rpc->r_aliases != NULL) {
if (*(rpc->r_aliases) != '\0') {
for (cp = rpc->r_aliases; *cp; ++cp) {
-   written = snprintf(buffer, buflen, " %s",*cp);
+   written = snprintf(buffer, buflen, " %s", *cp);
buffer += written;
-   if (written > buflen)
+   if (written > (int)buflen)
return;
buflen -= written;
 
@@ -400,7 +400,7 @@ rpcent_test_getrpcent(struct rpcent *rpc
return (rpcent_test_correctness(rpc, NULL));
 }
 
-int
+static int
 run_tests(const char *snapshot_file, enum test_methods method)
 {
struct rpcent_test_data td, td_snap, td_2pass;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r319036 - head/lib/libc/tests/nss

2017-05-27 Thread Ngie Cooper
Author: ngie
Date: Sun May 28 04:05:19 2017
New Revision: 319036
URL: https://svnweb.freebsd.org/changeset/base/319036

Log:
  getproto_test: fix -Wmissing-prototypes and -Wsign-compare warnings
  
  MFC after:3 days
  Sponsored by: Dell EMC Isilon

Modified:
  head/lib/libc/tests/nss/getproto_test.c

Modified: head/lib/libc/tests/nss/getproto_test.c
==
--- head/lib/libc/tests/nss/getproto_test.c Sun May 28 04:04:32 2017
(r319035)
+++ head/lib/libc/tests/nss/getproto_test.c Sun May 28 04:05:19 2017
(r319036)
@@ -172,16 +172,16 @@ sdump_protoent(struct protoent *pe, char
written = snprintf(buffer, buflen, "%s %d",
pe->p_name, pe->p_proto);
buffer += written;
-   if (written > buflen)
+   if (written > (int)buflen)
return;
buflen -= written;
 
if (pe->p_aliases != NULL) {
if (*(pe->p_aliases) != '\0') {
for (cp = pe->p_aliases; *cp; ++cp) {
-   written = snprintf(buffer, buflen, " %s",*cp);
+   written = snprintf(buffer, buflen, " %s", *cp);
buffer += written;
-   if (written > buflen)
+   if (written > (int)buflen)
return;
buflen -= written;
 
@@ -395,7 +395,7 @@ protoent_test_getprotoent(struct protoen
return (protoent_test_correctness(pe, NULL));
 }
 
-int
+static int
 run_tests(const char *snapshot_file, enum test_methods method)
 {
struct protoent_test_data td, td_snap, td_2pass;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r319037 - head/lib/libc/tests/nss

2017-05-27 Thread Ngie Cooper
Author: ngie
Date: Sun May 28 04:11:04 2017
New Revision: 319037
URL: https://svnweb.freebsd.org/changeset/base/319037

Log:
  getaddrinfo_test: mark unused function parameters __unused to fix -Wunused
  warnings
  
  MFC after:3 days
  Sponsored by: Dell EMC Isilon

Modified:
  head/lib/libc/tests/nss/getaddrinfo_test.c

Modified: head/lib/libc/tests/nss/getaddrinfo_test.c
==
--- head/lib/libc/tests/nss/getaddrinfo_test.c  Sun May 28 04:05:19 2017
(r319036)
+++ head/lib/libc/tests/nss/getaddrinfo_test.c  Sun May 28 04:11:04 2017
(r319037)
@@ -28,7 +28,7 @@
 #include 
 __FBSDID("$FreeBSD$");
 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -125,7 +125,8 @@ compare_addrinfo_(struct addrinfo *ai1, 
 }
 
 static int
-compare_addrinfo(struct addrinfo *ai1, struct addrinfo *ai2, void *mdata)
+compare_addrinfo(struct addrinfo *ai1, struct addrinfo *ai2,
+void *mdata __unused)
 {
int rv;
 
@@ -344,7 +345,7 @@ addrinfo_read_snapshot_func(struct addri
 }
 
 static int
-addrinfo_test_correctness(struct addrinfo *ai, void *mdata)
+addrinfo_test_correctness(struct addrinfo *ai, void *mdata __unused)
 {
 
printf("testing correctness with the following data:\n");
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r319038 - head/lib/libc/tests/nss

2017-05-27 Thread Ngie Cooper
Author: ngie
Date: Sun May 28 04:12:02 2017
New Revision: 319038
URL: https://svnweb.freebsd.org/changeset/base/319038

Log:
  getusershell_test: mark mdata parameter in compare_usershell __unused
  
  MFC after:3 days
  Sponsored by: Dell EMC Isilon

Modified:
  head/lib/libc/tests/nss/getusershell_test.c

Modified: head/lib/libc/tests/nss/getusershell_test.c
==
--- head/lib/libc/tests/nss/getusershell_test.c Sun May 28 04:11:04 2017
(r319037)
+++ head/lib/libc/tests/nss/getusershell_test.c Sun May 28 04:12:02 2017
(r319038)
@@ -76,7 +76,8 @@ clone_usershell(struct usershell *dest, 
 }
 
 static int
-compare_usershell(struct usershell *us1, struct usershell *us2, void *mdata)
+compare_usershell(struct usershell *us1, struct usershell *us2,
+void *mdata __unused)
 {
int rv;
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r319039 - head/lib/libc/tests/nss

2017-05-27 Thread Ngie Cooper
Author: ngie
Date: Sun May 28 04:12:52 2017
New Revision: 319039
URL: https://svnweb.freebsd.org/changeset/base/319039

Log:
  getserv_test: mark unused parameters __unused to fix corresponding
  warnings
  
  MFC after:3 days
  Sponsored by: Dell EMC Isilon

Modified:
  head/lib/libc/tests/nss/getserv_test.c

Modified: head/lib/libc/tests/nss/getserv_test.c
==
--- head/lib/libc/tests/nss/getserv_test.c  Sun May 28 04:12:02 2017
(r319038)
+++ head/lib/libc/tests/nss/getserv_test.c  Sun May 28 04:12:52 2017
(r319039)
@@ -300,7 +300,7 @@ servent_fill_test_data(struct servent_te
 }
 
 static int
-servent_test_correctness(struct servent *serv, void *mdata)
+servent_test_correctness(struct servent *serv, void *mdata __unused)
 {
printf("testing correctness with the following data:\n");
dump_servent(serv);
@@ -403,7 +403,7 @@ servent_test_getservbyport(struct serven
 }
 
 static int
-servent_test_getservent(struct servent *serv, void *mdata)
+servent_test_getservent(struct servent *serv, void *mdata __unused)
 {
/* Only correctness can be checked when doing 1-pass test for
 * getservent(). */
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r319040 - head/lib/libc/tests/nss

2017-05-27 Thread Ngie Cooper
Author: ngie
Date: Sun May 28 04:15:05 2017
New Revision: 319040
URL: https://svnweb.freebsd.org/changeset/base/319040

Log:
  getrpc_test: fix -Wunused warnings
  
  - Mark unused function parameters unused.
  - Remove an unused function prototype.
  
  MFC after:3 days
  Sponsored by: Dell EMC Isilon

Modified:
  head/lib/libc/tests/nss/getrpc_test.c

Modified: head/lib/libc/tests/nss/getrpc_test.c
==
--- head/lib/libc/tests/nss/getrpc_test.c   Sun May 28 04:12:52 2017
(r319039)
+++ head/lib/libc/tests/nss/getrpc_test.c   Sun May 28 04:15:05 2017
(r319040)
@@ -70,8 +70,6 @@ static int rpcent_test_getrpcbyname(stru
 static int rpcent_test_getrpcbynumber(struct rpcent *, void *);
 static int rpcent_test_getrpcent(struct rpcent *, void *);
 
-static void usage(void)  __attribute__((__noreturn__));
-
 IMPLEMENT_TEST_DATA(rpcent)
 IMPLEMENT_TEST_FILE_SNAPSHOT(rpcent)
 IMPLEMENT_1PASS_TEST(rpcent)
@@ -289,7 +287,7 @@ rpcent_fill_test_data(struct rpcent_test
 }
 
 static int
-rpcent_test_correctness(struct rpcent *rpc, void *mdata)
+rpcent_test_correctness(struct rpcent *rpc, void *mdata __unused)
 {
 
printf("testing correctness with the following data:\n");
@@ -390,7 +388,7 @@ rpcent_test_getrpcbynumber(struct rpcent
 }
 
 static int
-rpcent_test_getrpcent(struct rpcent *rpc, void *mdata)
+rpcent_test_getrpcent(struct rpcent *rpc, void *mdata __unused)
 {
 
/*
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r319041 - head/lib/libc/tests/nss

2017-05-27 Thread Ngie Cooper
Author: ngie
Date: Sun May 28 04:15:57 2017
New Revision: 319041
URL: https://svnweb.freebsd.org/changeset/base/319041

Log:
  getproto_test: fix -Wunused warnings
  
  Mark unused parameters __unused in functions.
  
  MFC after:3 days
  Sponsored by: Dell EMC Isilon

Modified:
  head/lib/libc/tests/nss/getproto_test.c

Modified: head/lib/libc/tests/nss/getproto_test.c
==
--- head/lib/libc/tests/nss/getproto_test.c Sun May 28 04:15:05 2017
(r319040)
+++ head/lib/libc/tests/nss/getproto_test.c Sun May 28 04:15:57 2017
(r319041)
@@ -288,7 +288,7 @@ protoent_fill_test_data(struct protoent_
 }
 
 static int
-protoent_test_correctness(struct protoent *pe, void *mdata)
+protoent_test_correctness(struct protoent *pe, void *mdata __unused)
 {
printf("testing correctness with the following data:\n");
dump_protoent(pe);
@@ -388,7 +388,7 @@ protoent_test_getprotobynumber(struct pr
 }
 
 static int
-protoent_test_getprotoent(struct protoent *pe, void *mdata)
+protoent_test_getprotoent(struct protoent *pe, void *mdata __unused)
 {
/* Only correctness can be checked when doing 1-pass test for
 * getprotoent(). */
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r319042 - head/lib/libc/tests/nss

2017-05-27 Thread Ngie Cooper
Author: ngie
Date: Sun May 28 04:34:57 2017
New Revision: 319042
URL: https://svnweb.freebsd.org/changeset/base/319042

Log:
  gethostby_test: fix multiple warning types
  
  - Fix -Wmissing-declaration warning by staticizing run_tests.
  - Fix -Wsign-compare warnings by casting size_t types to int
for comparisons.
  
  Reindent some of the code in sdump_hostent(..) to accomodate the
  overall changes.
  
  MFC after:3 days
  Sponsored by: Dell EMC Isilon

Modified:
  head/lib/libc/tests/nss/gethostby_test.c

Modified: head/lib/libc/tests/nss/gethostby_test.c
==
--- head/lib/libc/tests/nss/gethostby_test.cSun May 28 04:15:57 2017
(r319041)
+++ head/lib/libc/tests/nss/gethostby_test.cSun May 28 04:34:57 2017
(r319042)
@@ -412,7 +412,7 @@ sdump_hostent(struct hostent *ht, char *
written = snprintf(buffer, buflen, "%s %d %d",
ht->h_name, ht->h_addrtype, ht->h_length);
buffer += written;
-   if (written > buflen)
+   if (written > (int)buflen)
return;
buflen -= written;
 
@@ -421,7 +421,7 @@ sdump_hostent(struct hostent *ht, char *
for (cp = ht->h_aliases; *cp; ++cp) {
written = snprintf(buffer, buflen, " %s",*cp);
buffer += written;
-   if (written > buflen)
+   if (written > (int)buflen)
return;
buflen -= written;
 
@@ -431,59 +431,61 @@ sdump_hostent(struct hostent *ht, char *
} else {
written = snprintf(buffer, buflen, " noaliases");
buffer += written;
-   if (written > buflen)
+   if (written > (int)buflen)
return;
buflen -= written;
}
} else {
written = snprintf(buffer, buflen, " (null)");
buffer += written;
-   if (written > buflen)
+   if (written > (int)buflen)
return;
buflen -= written;
}
 
written = snprintf(buffer, buflen, " : ");
buffer += written;
-   if (written > buflen)
+   if (written > (int)buflen)
return;
buflen -= written;
 
if (ht->h_addr_list != NULL) {
if (*(ht->h_addr_list) != NULL) {
for (cp = ht->h_addr_list; *cp; ++cp) {
-   for (i = 0; i < ht->h_length; ++i ) {
-   written = snprintf(buffer, buflen,
-   i + 1 != ht->h_length ? "%d." : "%d",
-   (unsigned char)(*cp)[i]);
-   buffer += written;
-   if (written > buflen)
-   return;
-   buflen -= written;
+   for (i = 0; i < (size_t)ht->h_length; ++i) {
+   written = snprintf(buffer, buflen,
+   i + 1 != (size_t)ht->h_length ?
+   "%d." : "%d",
+   (unsigned char)(*cp)[i]);
+   buffer += written;
+   if (written > (int)buflen)
+   return;
+   buflen -= written;
 
-   if (buflen == 0)
-   return;
-   }
+   if (buflen == 0)
+   return;
+   }
 
-   if (*(cp + 1) ) {
-   written = snprintf(buffer, buflen, " ");
-   buffer += written;
-   if (written > buflen)
-   return;
-   buflen -= written;
-   }
+   if (*(cp + 1)) {
+   written = snprintf(buffer, buflen,
+   " ");
+   buffer += written;
+   if (written > (int)buflen)
+   return;
+   buflen -= written;
+   }
}
} else {
written = snprintf(buffer, buflen, " noaddrs");
buffer += written;
-   if

svn commit: r319043 - head/lib/libc/tests/nss

2017-05-27 Thread Ngie Cooper
Author: ngie
Date: Sun May 28 04:41:06 2017
New Revision: 319043
URL: https://svnweb.freebsd.org/changeset/base/319043

Log:
  getpw_test: fix -Wunused warnings
  
  - Mark unused parameters __unused.
  - Put dump_passwd under DEBUG as it's only used in that case.
  
  MFC after:3 days
  Sponsored by: Dell EMC Isilon

Modified:
  head/lib/libc/tests/nss/getpw_test.c

Modified: head/lib/libc/tests/nss/getpw_test.c
==
--- head/lib/libc/tests/nss/getpw_test.cSun May 28 04:34:57 2017
(r319042)
+++ head/lib/libc/tests/nss/getpw_test.cSun May 28 04:41:06 2017
(r319043)
@@ -57,7 +57,9 @@ static int compare_passwd(struct passwd 
 static void free_passwd(struct passwd *);
 
 static void sdump_passwd(struct passwd *, char *, size_t);
+#ifdef DEBUG
 static void dump_passwd(struct passwd *);
+#endif
 
 static int passwd_read_snapshot_func(struct passwd *, char *);
 
@@ -95,7 +97,7 @@ clone_passwd(struct passwd *dest, struct
 }
 
 static int
-compare_passwd(struct passwd *pwd1, struct passwd *pwd2, void *mdata)
+compare_passwd(struct passwd *pwd1, struct passwd *pwd2, void *mdata __unused)
 {
ATF_REQUIRE(pwd1 != NULL);
ATF_REQUIRE(pwd2 != NULL);
@@ -140,6 +142,7 @@ sdump_passwd(struct passwd *pwd, char *b
pwd->pw_fields);
 }
 
+#ifdef DEBUG
 static void
 dump_passwd(struct passwd *pwd)
 {
@@ -150,6 +153,7 @@ dump_passwd(struct passwd *pwd)
} else
printf("(null)\n");
 }
+#endif
 
 static int
 passwd_read_snapshot_func(struct passwd *pwd, char *line)
@@ -249,7 +253,7 @@ passwd_fill_test_data(struct passwd_test
 }
 
 static int
-passwd_test_correctness(struct passwd *pwd, void *mdata)
+passwd_test_correctness(struct passwd *pwd, void *mdata __unused)
 {
 
 #ifdef DEBUG
@@ -361,7 +365,7 @@ passwd_test_getpwuid(struct passwd *pwd_
 }
 
 static int
-passwd_test_getpwent(struct passwd *pwd, void *mdata)
+passwd_test_getpwent(struct passwd *pwd, void *mdata __unused)
 {
/* Only correctness can be checked when doing 1-pass test for
 * getpwent(). */
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r319044 - head/lib/libc/tests/nss

2017-05-27 Thread Ngie Cooper
Author: ngie
Date: Sun May 28 04:43:02 2017
New Revision: 319044
URL: https://svnweb.freebsd.org/changeset/base/319044

Log:
  getgr_test: fix -Wunused warnings
  
  MFC after:3 days
  Sponsored by: Dell EMC Isilon

Modified:
  head/lib/libc/tests/nss/getgr_test.c

Modified: head/lib/libc/tests/nss/getgr_test.c
==
--- head/lib/libc/tests/nss/getgr_test.cSun May 28 04:41:06 2017
(r319043)
+++ head/lib/libc/tests/nss/getgr_test.cSun May 28 04:43:02 2017
(r319044)
@@ -307,7 +307,7 @@ group_fill_test_data(struct group_test_d
 }
 
 static int
-group_test_correctness(struct group *grp, void *mdata)
+group_test_correctness(struct group *grp, void *mdata __unused)
 {
printf("testing correctness with the following data:\n");
dump_group(grp);
@@ -385,7 +385,7 @@ group_test_getgrgid(struct group *grp_mo
 }
 
 static int
-group_test_getgrent(struct group *grp, void *mdata)
+group_test_getgrent(struct group *grp, void *mdata __unused)
 {
/* Only correctness can be checked when doing 1-pass test for
 * getgrent(). */
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r319045 - head/lib/libc/tests/nss

2017-05-27 Thread Ngie Cooper
Author: ngie
Date: Sun May 28 05:26:45 2017
New Revision: 319045
URL: https://svnweb.freebsd.org/changeset/base/319045

Log:
  Fix -Wunused and -Wshadow warnings
  
  MFC after:3 days
  Sponsored by: Dell EMC Isilon

Modified:
  head/lib/libc/tests/nss/gethostby_test.c

Modified: head/lib/libc/tests/nss/gethostby_test.c
==
--- head/lib/libc/tests/nss/gethostby_test.cSun May 28 04:43:02 2017
(r319044)
+++ head/lib/libc/tests/nss/gethostby_test.cSun May 28 05:26:45 2017
(r319045)
@@ -87,8 +87,6 @@ static int hostent_test_gethostbyaddr(st
 static int hostent_test_getaddrinfo_eq(struct hostent *, void *);
 static int hostent_test_getnameinfo_eq(struct hostent *, void *);
 
-static void usage(void)  __attribute__((__noreturn__));
-
 IMPLEMENT_TEST_DATA(hostent)
 IMPLEMENT_TEST_FILE_SNAPSHOT(hostent)
 IMPLEMENT_1PASS_TEST(hostent)
@@ -677,7 +675,7 @@ dump_hostent(struct hostent *result)
 }
 
 static int
-hostent_test_correctness(struct hostent *ht, void *mdata)
+hostent_test_correctness(struct hostent *ht, void *mdata __unused)
 {
 
 #ifdef DEBUG
@@ -760,7 +758,7 @@ hostent_test_gethostbyaddr(struct hosten
 }
 
 static int
-hostent_test_getaddrinfo_eq(struct hostent *he, void *mdata)
+hostent_test_getaddrinfo_eq(struct hostent *he, void *mdata __unused)
 {
struct addrinfo *ai, hints;
int rv;
@@ -799,7 +797,7 @@ hostent_test_getaddrinfo_eq(struct hoste
 }
 
 static int
-hostent_test_getnameinfo_eq(struct hostent *he, void *mdata)
+hostent_test_getnameinfo_eq(struct hostent *he, void *mdata __unused)
 {
char **cp;
char buffer[NI_MAXHOST];
@@ -923,14 +921,14 @@ hostent_test_getnameinfo_eq(struct hoste
 }
 
 static int
-run_tests(const char *hostlist_file, const char *snapshot_file, int af_type,
+run_tests(const char *hostlist_file, const char *snapshot_file, int _af_type,
 enum test_methods method, bool use_ipv6_mapping)
 {
struct hostent_test_data td, td_addr, td_snap;
res_state statp;
int rv = -2;
 
-   switch (af_type) {
+   switch (_af_type) {
case AF_INET:
ATF_REQUIRE_FEATURE("inet");
ATF_REQUIRE(!use_ipv6_mapping);
@@ -939,7 +937,7 @@ run_tests(const char *hostlist_file, con
ATF_REQUIRE_FEATURE("inet6");
break;
default:
-   atf_tc_fail("unhandled address family: %d", af_type);
+   atf_tc_fail("unhandled address family: %d", _af_type);
break;
}
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r319046 - head/lib/libc/tests/nss

2017-05-27 Thread Ngie Cooper
Author: ngie
Date: Sun May 28 05:31:18 2017
New Revision: 319046
URL: https://svnweb.freebsd.org/changeset/base/319046

Log:
  Fix a -Wunused-but-set-variable warning reported by gcc 6.3.0
  
  MFC after:3 days
  Sponsored by: Dell EMC Isilon

Modified:
  head/lib/libc/tests/nss/getaddrinfo_test.c

Modified: head/lib/libc/tests/nss/getaddrinfo_test.c
==
--- head/lib/libc/tests/nss/getaddrinfo_test.c  Sun May 28 05:26:45 2017
(r319045)
+++ head/lib/libc/tests/nss/getaddrinfo_test.c  Sun May 28 05:31:18 2017
(r319046)
@@ -310,12 +310,11 @@ addrinfo_read_snapshot_func(struct addri
 {
struct addrinfo *ai2;
char *s, *ps;
-   int i, rv;
+   int rv;
 
printf("1 line read from snapshot:\n%s\n", line);
 
rv = 0;
-   i = 0;
ps = line;
 
s = strsep(&ps, ":");
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r319047 - in head/lib/msun: . man src

2017-05-27 Thread Michal Meloun
Author: mmel
Date: Sun May 28 06:13:38 2017
New Revision: 319047
URL: https://svnweb.freebsd.org/changeset/base/319047

Log:
  Implement sincos, sincosf, and sincosl.
  The primary benefit of these functions is that argument
  reduction is done once instead of twice in independent
  calls to sin() and cos().
  
  * lib/msun/Makefile:
. Add s_sincos[fl].c to the build.
. Add sincos.3 documentation.
. Add appropriate MLINKS.
  
  * lib/msun/Symbol.map:
. Expose sincos[fl] symbols in dynamic libm.so.
  
  * lib/msun/man/sincos.3:
. Documentation for sincos[fl].
  
  * lib/msun/src/k_sincos.h:
. Kernel for sincos() function.  This merges the individual kernels
  for sin() and cos().  The merger offered an opportunity to re-arrange
  the individual kernels for better performance.
  
  * lib/msun/src/k_sincosf.h:
 . Kernel for sincosf() function.  This merges the individual kernels
   for sinf() and cosf(). The merger offered an opportunity to re-arrange
   the individual kernels for better performance.
  
  * lib/msun/src/k_sincosl.h:
 . Kernel for sincosl() function.  This merges the individual kernels
   for sinl() and cosl(). The merger offered an opportunity to re-arrange
   the individual kernels for better performance.
  
  * lib/msun/src/math.h:
. Add prototytpes for sincos[fl]().
  
  * lib/msun/src/math_private.h:
. Add RETURNV macros.  This is needed to reset fpsetprec on I386
  hardware for a function with type void.
  
  * lib/msun/src/s_sincos.c:
. Implementation of sincos() where sin() and cos() were merged into
  one routine and possibly re-arranged for better performance.
  
  * lib/msun/src/s_sincosf.c:
. Implementation of sincosf() where sinf() and cosf() were merged into
  one routine and possibly re-arranged for better performance.
  
  * lib/msun/src/s_sincosl.c:
. Implementation of sincosl() where sinl() and cosl() were merged into
  one routine and possibly re-arranged for better performance.
  
  PR:   215977, 218300
  Submitted by: Steven G. Kargl 
  MFC after:1 month
  Differential Revision:https://reviews.freebsd.org/D10765

Added:
  head/lib/msun/man/sincos.3   (contents, props changed)
  head/lib/msun/src/k_sincos.h   (contents, props changed)
  head/lib/msun/src/k_sincosf.h   (contents, props changed)
  head/lib/msun/src/k_sincosl.h   (contents, props changed)
  head/lib/msun/src/s_sincos.c   (contents, props changed)
  head/lib/msun/src/s_sincosf.c   (contents, props changed)
  head/lib/msun/src/s_sincosl.c   (contents, props changed)
Modified:
  head/lib/msun/Makefile
  head/lib/msun/Symbol.map
  head/lib/msun/src/math.h
  head/lib/msun/src/math_private.h

Modified: head/lib/msun/Makefile
==
--- head/lib/msun/Makefile  Sun May 28 05:31:18 2017(r319046)
+++ head/lib/msun/Makefile  Sun May 28 06:13:38 2017(r319047)
@@ -73,7 +73,8 @@ COMMON_SRCS= b_exp.c b_log.c b_tgamma.c 
s_nexttowardf.c s_remquo.c s_remquof.c \
s_rint.c s_rintf.c s_round.c s_roundf.c \
s_scalbln.c s_scalbn.c s_scalbnf.c s_signbit.c \
-   s_signgam.c s_significand.c s_significandf.c s_sin.c s_sinf.c \
+   s_signgam.c s_significand.c s_significandf.c s_sin.c \
+   s_sincos.c s_sincosf.c s_sinf.c \
s_tan.c s_tanf.c s_tanh.c s_tanhf.c s_tgammaf.c s_trunc.c s_truncf.c \
w_cabs.c w_cabsf.c w_drem.c w_dremf.c
 
@@ -104,7 +105,8 @@ COMMON_SRCS+=   catrigl.c \
s_csqrtl.c s_erfl.c s_exp2l.c s_expl.c s_floorl.c s_fmal.c \
s_fmaxl.c s_fminl.c s_frexpl.c s_logbl.c s_logl.c s_nanl.c \
s_nextafterl.c s_nexttoward.c s_remquol.c s_rintl.c s_roundl.c \
-   s_scalbnl.c s_sinl.c s_tanhl.c s_tanl.c s_truncl.c w_cabsl.c
+   s_scalbnl.c s_sinl.c s_sincosl.c \
+   s_tanhl.c s_tanl.c s_truncl.c w_cabsl.c
 .endif
 
 # C99 complex functions
@@ -137,7 +139,8 @@ MAN=acos.3 acosh.3 asin.3 asinh.3 atan.
fma.3 fmax.3 fmod.3 hypot.3 ieee.3 ieee_test.3 ilogb.3 j0.3 \
lgamma.3 log.3 lrint.3 lround.3 math.3 nan.3 \
nextafter.3 remainder.3 rint.3 \
-   round.3 scalbn.3 signbit.3 sin.3 sinh.3 sqrt.3 tan.3 tanh.3 trunc.3 \
+   round.3 scalbn.3 signbit.3 sin.3 sincos.3 \
+   sinh.3 sqrt.3 tan.3 tanh.3 trunc.3 \
complex.3
 
 MLINKS+=acos.3 acosf.3 acos.3 acosl.3
@@ -215,6 +218,7 @@ MLINKS+=round.3 roundf.3 round.3 roundl.
 MLINKS+=scalbn.3 scalbln.3 scalbn.3 scalblnf.3 scalbn.3 scalblnl.3
 MLINKS+=scalbn.3 scalbnf.3 scalbn.3 scalbnl.3
 MLINKS+=sin.3 sinf.3 sin.3 sinl.3
+MLINKS+=sincos.3 sincosf.3 sin.3 sincosl.3
 MLINKS+=sinh.3 sinhf.3 sinh.3 sinhl.3
 MLINKS+=sqrt.3 cbrt.3 sqrt.3 cbrtf.3 sqrt.3 cbrtl.3 sqrt.3 sqrtf.3 \
sqrt.3 sqrtl.3

Modified: head/lib/msun/Symbol.map
==
--- head/lib/msun/Symbol.mapSun May 28 05:31:1

svn commit: r319048 - head/lib/libc/tests/nss

2017-05-27 Thread Ngie Cooper
Author: ngie
Date: Sun May 28 06:26:43 2017
New Revision: 319048
URL: https://svnweb.freebsd.org/changeset/base/319048

Log:
  Push `snapshot_file` copying down into run_tests function, and mark 
snapshot_file
  const char *.
  
  This fixes a bogus set of errors from gcc about strdup not being allowed a 
NULL
  argument.
  
  MFC after:1 week
  Sponsored by: Dell EMC Isilon

Modified:
  head/lib/libc/tests/nss/getaddrinfo_test.c
  head/lib/libc/tests/nss/gethostby_test.c

Modified: head/lib/libc/tests/nss/getaddrinfo_test.c
==
--- head/lib/libc/tests/nss/getaddrinfo_test.c  Sun May 28 06:13:38 2017
(r319047)
+++ head/lib/libc/tests/nss/getaddrinfo_test.c  Sun May 28 06:26:43 2017
(r319048)
@@ -410,11 +410,19 @@ addrinfo_read_hostlist_func(struct addri
 }
 
 static void
-run_tests(char *hostlist_file, char *snapshot_file, int ai_family)
+run_tests(char *hostlist_file, const char *snapshot_file, int ai_family)
 {
struct addrinfo_test_data td, td_snap;
+   char *snapshot_file_copy;
int rv;
 
+   if (snapshot_file == NULL)
+   snapshot_file_copy = NULL;
+   else {
+   snapshot_file_copy = strdup(snapshot_file);
+   ATF_REQUIRE(snapshot_file_copy != NULL);
+   }
+
memset(&hints, 0, sizeof(struct addrinfo));
hints.ai_family = ai_family;
hints.ai_flags = AI_CANONNAME;
@@ -477,24 +485,17 @@ fin:
TEST_DATA_DESTROY(addrinfo, &td_snap);
TEST_DATA_DESTROY(addrinfo, &td);
 
-   free(hostlist_file);
-   free(snapshot_file);
+   free(snapshot_file_copy);
 }
 
 #defineHOSTLIST_FILE   "mach"
 #defineRUN_TESTS(tc, snapshot_file, ai_family) do {
\
char *_hostlist_file;   \
-   char *_snapshot_file;   \
ATF_REQUIRE(0 < asprintf(&_hostlist_file, "%s/%s",  \
atf_tc_get_config_var(tc, "srcdir"), HOSTLIST_FILE));   \
-   if (snapshot_file == NULL)  \
-   _snapshot_file = NULL;  \
-   else {  \
-   _snapshot_file = strdup(snapshot_file); \
-   ATF_REQUIRE(_snapshot_file != NULL);\
-   }   \
-   run_tests(_hostlist_file, _snapshot_file, ai_family);   \
-} while(0)
+   run_tests(_hostlist_file, snapshot_file, ai_family);\
+   free(_hostlist_file);   \
+} while (0)
 
 ATF_TC_WITHOUT_HEAD(pf_unspec);
 ATF_TC_BODY(pf_unspec, tc)

Modified: head/lib/libc/tests/nss/gethostby_test.c
==
--- head/lib/libc/tests/nss/gethostby_test.cSun May 28 06:13:38 2017
(r319047)
+++ head/lib/libc/tests/nss/gethostby_test.cSun May 28 06:26:43 2017
(r319048)
@@ -924,10 +924,19 @@ static int
 run_tests(const char *hostlist_file, const char *snapshot_file, int _af_type,
 enum test_methods method, bool use_ipv6_mapping)
 {
+   char *snapshot_file_copy;
struct hostent_test_data td, td_addr, td_snap;
res_state statp;
int rv = -2;
 
+   if (snapshot_file == NULL)
+   snapshot_file_copy = NULL;
+   else {
+   snapshot_file_copy = strdup(snapshot_file);
+   ATF_REQUIRE(snapshot_file_copy != NULL);
+   }
+   snapshot_file = snapshot_file_copy;
+
switch (_af_type) {
case AF_INET:
ATF_REQUIRE_FEATURE("inet");
@@ -946,8 +955,8 @@ run_tests(const char *hostlist_file, con
if (statp == NULL || ((statp->options & RES_INIT) == 0 &&
res_ninit(statp) == -1)) {
printf("error: can't init res_state\n");
-
-   return (-1);
+   rv = -1;
+   goto fin2;
}
 
if (use_ipv6_mapping)
@@ -1051,6 +1060,9 @@ fin:
TEST_DATA_DESTROY(hostent, &td_addr);
TEST_DATA_DESTROY(hostent, &td);
 
+fin2:
+   free(snapshot_file_copy);
+
return (rv);
 }
 
@@ -1059,30 +1071,24 @@ fin:
 #define_RUN_TESTS(tc, snapshot_file, af_type, method, 
use_ipv6_mapping) \
 do {   \
char *_hostlist_file;   \
-   char *_snapshot_file;   \
ATF_REQUIRE(0 < asprintf(&_hostlist_file, "%s/%s",  \
atf_tc_get_config_var(tc, "srcdir"), HOSTLIST_FILE));   \
-   if (snapshot_file == NULL)  \
-  

svn commit: r319049 - head/lib/libc/tests/nss

2017-05-27 Thread Ngie Cooper
Author: ngie
Date: Sun May 28 06:29:01 2017
New Revision: 319049
URL: https://svnweb.freebsd.org/changeset/base/319049

Log:
  Bump WARNS from 1 to 3 after recent commits to fix warnings in the
  directory.
  
  Tested with:  clang 4.0, gcc 4.2.1, gcc 6.3.0
  MFC after:1 week
  Sponsored by: Dell EMC Isilon

Modified:
  head/lib/libc/tests/nss/Makefile

Modified: head/lib/libc/tests/nss/Makefile
==
--- head/lib/libc/tests/nss/MakefileSun May 28 06:26:43 2017
(r319048)
+++ head/lib/libc/tests/nss/MakefileSun May 28 06:29:01 2017
(r319049)
@@ -20,7 +20,7 @@ ATF_TESTS_C+= getusershell_test
 
 ${PACKAGE}FILES+=  mach
 
-WARNS?=1
+WARNS?=3
 
 CFLAGS+=   -I${SRCTOP}/tests
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"