svn commit: r317316 - head/lib/libgeom

2017-04-22 Thread Ngie Cooper
Author: ngie
Date: Sun Apr 23 03:36:03 2017
New Revision: 317316
URL: https://svnweb.freebsd.org/changeset/base/317316

Log:
  Minor style(9) fixups
  
  Delete trailing whitespace and sort headers.
  
  Leave libgeom.h's placement alone, per reasoning in r317289.
  
  MFC after:5 weeks
  Sponsored by: Dell EMC Isilon

Modified:
  head/lib/libgeom/geom_ctl.c

Modified: head/lib/libgeom/geom_ctl.c
==
--- head/lib/libgeom/geom_ctl.c Sun Apr 23 03:17:32 2017(r317315)
+++ head/lib/libgeom/geom_ctl.c Sun Apr 23 03:36:03 2017(r317316)
@@ -29,23 +29,22 @@
  * $FreeBSD$
  */
 
-#include 
+#include 
+#include 
 #include 
 #include 
-#include 
-#include 
+#include 
 #include 
-#include 
-#include 
+#include 
+#include 
 #include 
-#include 
-
-#include 
+#include 
+#include 
 
 #define GCTL_TABLE 1
 #include 
 
-/* 
+/*
  * Global pointer to a string that is used to avoid an errorneous free in
  * gctl_free.
  */
@@ -172,7 +171,7 @@ gctl_param_add(struct gctl_req *req, con
ap->len = len;
else if (len < 0) {
ap->flag |= GCTL_PARAM_ASCII;
-   ap->len = strlen(value) + 1;
+   ap->len = strlen(value) + 1;
}
 }
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r317315 - head/lib/libc/gen

2017-04-22 Thread Ngie Cooper
Author: ngie
Date: Sun Apr 23 03:17:32 2017
New Revision: 317315
URL: https://svnweb.freebsd.org/changeset/base/317315

Log:
  Note that getpagesize(3) can return -1 on failure
  
  MFC after:5 weeks
  Sponsored by: Dell EMC Isilon

Modified:
  head/lib/libc/gen/getpagesize.3

Modified: head/lib/libc/gen/getpagesize.3
==
--- head/lib/libc/gen/getpagesize.3 Sun Apr 23 03:16:38 2017
(r317314)
+++ head/lib/libc/gen/getpagesize.3 Sun Apr 23 03:17:32 2017
(r317315)
@@ -28,7 +28,7 @@
 .\" @(#)getpagesize.3  8.1 (Berkeley) 6/4/93
 .\" $FreeBSD$
 .\"
-.Dd June 4, 1993
+.Dd April 22, 2017
 .Dt GETPAGESIZE 3
 .Os
 .Sh NAME
@@ -51,6 +51,9 @@ management calls.
 The page size is a system
 page size and may not be the same as the underlying
 hardware page size.
+.Sh RETURN VALUES
+.Nm
+returns the number of bytes in a page on success, -1 on failure.
 .Sh SEE ALSO
 .Xr pagesize 1 ,
 .Xr sbrk 2
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r317314 - in stable: 10/contrib/ipfilter/lib 10/contrib/ipfilter/tools 11/contrib/ipfilter/lib 11/contrib/ipfilter/tools

2017-04-22 Thread Cy Schubert
Author: cy
Date: Sun Apr 23 03:16:38 2017
New Revision: 317314
URL: https://svnweb.freebsd.org/changeset/base/317314

Log:
  MFC r316993, r316994, r316997 as follows:
  
  r316993:
  
  Fix CID 1372601 in ipfilter/lib/parsefields.c, possible NULL pointer
  dereference should reallocarray() fail.
  
Reported by:Coverity CID 1372601
  
  r316994:
  
  Fix CID 1372600 in ipfilter/tools/ipf_y.y, possible NULL pointer
  dereference should reallocarray() fail.
  
Reported by:Coverity CID 1372600
  
  r316997:
  
  Use warnx() to issue error message.
  
Reported by:cem

Modified:
  stable/11/contrib/ipfilter/lib/parsefields.c
  stable/11/contrib/ipfilter/tools/ipf_y.y
Directory Properties:
  stable/11/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/10/contrib/ipfilter/lib/parsefields.c
  stable/10/contrib/ipfilter/tools/ipf_y.y
Directory Properties:
  stable/10/   (props changed)

Modified: stable/11/contrib/ipfilter/lib/parsefields.c
==
--- stable/11/contrib/ipfilter/lib/parsefields.cSun Apr 23 02:30:06 
2017(r317313)
+++ stable/11/contrib/ipfilter/lib/parsefields.cSun Apr 23 03:16:38 
2017(r317314)
@@ -1,4 +1,5 @@
 #include "ipf.h"
+#include 
 
 extern int nohdrfields;
 
@@ -32,6 +33,10 @@ wordtab_t *parsefields(table, arg)
fields = malloc(2 * sizeof(*fields));
} else {
fields = realloc(fields, (num + 1) * sizeof(*fields));
+   if (fields == NULL) {
+   warnx("memory allocation error at %d in %s in 
%s", __LINE__, __FUNCTION__, __FILE__);
+   abort();
+   }
}
 
if (t == NULL) {

Modified: stable/11/contrib/ipfilter/tools/ipf_y.y
==
--- stable/11/contrib/ipfilter/tools/ipf_y.ySun Apr 23 02:30:06 2017
(r317313)
+++ stable/11/contrib/ipfilter/tools/ipf_y.ySun Apr 23 03:16:38 2017
(r317314)
@@ -9,6 +9,7 @@
 #include "ipf.h"
 #include 
 #include 
+#include 
 #ifdef IPFILTER_BPF
 # include 
 #endif
@@ -2195,6 +2196,10 @@ char *phrase;
for (i = 0, s = strtok(phrase, " \r\n\t"); s != NULL;
 s = strtok(NULL, " \r\n\t"), i++) {
fb = realloc(fb, (i / 4 + 1) * sizeof(*fb));
+   if (fb == NULL) {
+   warnx("memory allocation error at %d in 
%s in %s", __LINE__, __FUNCTION__, __FILE__);
+   abort();
+   }
l = (u_32_t)strtol(s, NULL, 0);
switch (i & 3)
{
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r317314 - in stable: 10/contrib/ipfilter/lib 10/contrib/ipfilter/tools 11/contrib/ipfilter/lib 11/contrib/ipfilter/tools

2017-04-22 Thread Cy Schubert
Author: cy
Date: Sun Apr 23 03:16:38 2017
New Revision: 317314
URL: https://svnweb.freebsd.org/changeset/base/317314

Log:
  MFC r316993, r316994, r316997 as follows:
  
  r316993:
  
  Fix CID 1372601 in ipfilter/lib/parsefields.c, possible NULL pointer
  dereference should reallocarray() fail.
  
Reported by:Coverity CID 1372601
  
  r316994:
  
  Fix CID 1372600 in ipfilter/tools/ipf_y.y, possible NULL pointer
  dereference should reallocarray() fail.
  
Reported by:Coverity CID 1372600
  
  r316997:
  
  Use warnx() to issue error message.
  
Reported by:cem

Modified:
  stable/10/contrib/ipfilter/lib/parsefields.c
  stable/10/contrib/ipfilter/tools/ipf_y.y
Directory Properties:
  stable/10/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/11/contrib/ipfilter/lib/parsefields.c
  stable/11/contrib/ipfilter/tools/ipf_y.y
Directory Properties:
  stable/11/   (props changed)

Modified: stable/10/contrib/ipfilter/lib/parsefields.c
==
--- stable/10/contrib/ipfilter/lib/parsefields.cSun Apr 23 02:30:06 
2017(r317313)
+++ stable/10/contrib/ipfilter/lib/parsefields.cSun Apr 23 03:16:38 
2017(r317314)
@@ -1,4 +1,5 @@
 #include "ipf.h"
+#include 
 
 extern int nohdrfields;
 
@@ -32,6 +33,10 @@ wordtab_t *parsefields(table, arg)
fields = malloc(2 * sizeof(*fields));
} else {
fields = realloc(fields, (num + 1) * sizeof(*fields));
+   if (fields == NULL) {
+   warnx("memory allocation error at %d in %s in 
%s", __LINE__, __FUNCTION__, __FILE__);
+   abort();
+   }
}
 
if (t == NULL) {

Modified: stable/10/contrib/ipfilter/tools/ipf_y.y
==
--- stable/10/contrib/ipfilter/tools/ipf_y.ySun Apr 23 02:30:06 2017
(r317313)
+++ stable/10/contrib/ipfilter/tools/ipf_y.ySun Apr 23 03:16:38 2017
(r317314)
@@ -9,6 +9,7 @@
 #include "ipf.h"
 #include 
 #include 
+#include 
 #ifdef IPFILTER_BPF
 # include 
 #endif
@@ -2195,6 +2196,10 @@ char *phrase;
for (i = 0, s = strtok(phrase, " \r\n\t"); s != NULL;
 s = strtok(NULL, " \r\n\t"), i++) {
fb = realloc(fb, (i / 4 + 1) * sizeof(*fb));
+   if (fb == NULL) {
+   warnx("memory allocation error at %d in 
%s in %s", __LINE__, __FUNCTION__, __FILE__);
+   abort();
+   }
l = (u_32_t)strtol(s, NULL, 0);
switch (i & 3)
{
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2017-04-22 Thread Ngie Cooper
Author: ngie
Date: Sun Apr 23 02:30:06 2017
New Revision: 317313
URL: https://svnweb.freebsd.org/changeset/base/317313

Log:
  gctl_test.t: catch errors with the mdcfg directive
  
  While here, add a note about certain testcases relying on `count=1024` in
  the "create" portion.
  
  MFC after:5 weeks
  Sponsored by: Dell EMC Isilon

Modified:
  head/tools/regression/geom_gpt/gctl_test.t

Modified: head/tools/regression/geom_gpt/gctl_test.t
==
--- head/tools/regression/geom_gpt/gctl_test.t  Sun Apr 23 01:50:47 2017
(r317312)
+++ head/tools/regression/geom_gpt/gctl_test.t  Sun Apr 23 02:30:06 2017
(r317313)
@@ -172,20 +172,32 @@ foreach my $key (sort keys %steps) {
($errmsg eq "" ? "" : " - $errmsg"));
unlink $out;
 } elsif ($action =~ "^mdcfg") {
+   my $errmsg = "";
if ($args =~ "^create") {
-   system("dd if=/dev/zero of=$disk count=1024 2>&1");
-   if ($args =~ "corrupted") {
-   system("gpt create -p $disk");
+   # NOTE: `count=1024` affects $key => {"025" "054", "065"}.
+   if (system("dd if=/dev/zero of=$disk count=1024 2>&1") == 0) {
+   chomp($dev = `mdconfig -a -t vnode -f $disk`);
+   if ($? == 0) {
+   if (system("gpart create -s GPT $dev") != 0) {
+   $errmsg = "gpart create failed";
+   }
+   } else {
+   $errmsg = "mdconfig -a failed";
+   }
+   } else {
+   $errmsg = "dd failed";
}
-   $dev = `mdconfig -a -t vnode -f $disk`;
-   chomp $dev;
} elsif ($args =~ "^destroy") {
$dev =~ s/md/-u /g;
-   system("mdconfig -d $dev");
+   if (system("mdconfig -d $dev") != 0) {
+   $errmsg = "mdconfig -d failed";
+   }
unlink $disk;
$dev = "n/a";
}
-   print "ok $nr \# mdcfg($key)\n";
+   printf("%sok $nr # mdcfg($key)%s\n",
+   ($errmsg eq "" ? "" : "not "),
+   ($errmsg eq "" ? "" : " - $errmsg"));
 } elsif ($action =~ "^conf") {
system("sysctl -b kern.geom.conftxt | grep -a $dev | sed -e 
s:$disk:DISK:g -e s:$dev:DEV:g | sort | md5 -p | tee $out 2>&1");
$st = `tail -1 $out`;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r317312 - head/lib/libgeom

2017-04-22 Thread Ngie Cooper
Author: ngie
Date: Sun Apr 23 01:50:47 2017
New Revision: 317312
URL: https://svnweb.freebsd.org/changeset/base/317312

Log:
  Fix type for `pagesize` to match the return type for getpagesize(3)
  to fix the build
  
  MFC after:5 weeks
  X-MFC with:   r317311
  Pointyhat to: ngie
  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 Apr 23 01:47:51 2017
(r317311)
+++ head/lib/libgeom/geom_stats.c   Sun Apr 23 01:50:47 2017
(r317312)
@@ -42,8 +42,8 @@
 #include 
 
 //
-static uint npages, pagesize, spp;
-static int statsfd = -1;
+static uint npages, spp;
+static int pagesize, statsfd = -1;
 static u_char *statp;
 
 void
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r317311 - head/lib/libgeom

2017-04-22 Thread Ngie Cooper
Author: ngie
Date: Sun Apr 23 01:47:51 2017
New Revision: 317311
URL: https://svnweb.freebsd.org/changeset/base/317311

Log:
  Check for failures from getpagesize(3)
  
  Return errno on failure, similar to the open(2) call above it.
  
  MFC after:5 weeks
  Reported by:  Coverity
  CID:  1193753
  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 Apr 23 01:17:59 2017
(r317310)
+++ head/lib/libgeom/geom_stats.c   Sun Apr 23 01:47:51 2017
(r317311)
@@ -87,6 +87,8 @@ 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-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r317310 - head/lib/libgeom

2017-04-22 Thread Ngie Cooper
Author: ngie
Date: Sun Apr 23 01:17:59 2017
New Revision: 317310
URL: https://svnweb.freebsd.org/changeset/base/317310

Log:
  Minor style(9) fixups
  
  Delete trailing whitespace and sort headers.
  
  Leave libgeom.h's placement alone, per reasoning in r317289.
  
  MFC after:5 weeks
  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   Sat Apr 22 23:30:02 2017
(r317309)
+++ head/lib/libgeom/geom_stats.c   Sun Apr 23 01:17:59 2017
(r317310)
@@ -29,20 +29,18 @@
  * $FreeBSD$
  */
 
-#include 
+#include 
+#include 
+#include 
+#include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
 #include 
 
-#include 
-#include 
-#include 
-#include 
-
-
 //
 static uint npages, pagesize, spp;
 static int statsfd = -1;
@@ -67,7 +65,7 @@ geom_stats_resync(void)
if (statsfd == -1)
return;
for (;;) {
-   p = mmap(statp, (npages + 1) * pagesize, 
+   p = mmap(statp, (npages + 1) * pagesize,
PROT_READ, MAP_SHARED, statsfd, 0);
if (p == MAP_FAILED)
break;
___
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: r316978 - in head: contrib/zstd etc/mtree lib lib/libzstd share/mk usr.bin usr.bin/zstd

2017-04-22 Thread Ian Lepore
On Sun, 2017-04-23 at 01:27 +0200, Baptiste Daroussin wrote:
> On Sat, Apr 22, 2017 at 04:05:28PM -0600, Ian Lepore wrote:
> > 
> > On Sun, 2017-04-16 at 09:35 +0200, Baptiste Daroussin wrote:
> > > 
> > > On Sat, Apr 15, 2017 at 04:37:02PM -0700, Rodney W. Grimes wrote:
> > > > 
> > > > 
> > > > And we need this in base for what great purpose???
> > > > 
> > > zstandard is the successor to lz4, there are attempts to
> > > integrate
> > > zstandard in
> > > ZFS, Allan Jude is working on that, I am working on integrating
> > > in
> > > libstand to
> > > allow to boot a kernel compressed with zstandard or a mfsroot
> > > with
> > > zstandard,
> > > which would benefit lots of pxe users.
> > > 
> > > I have also added it to newsyslog(8) so users can benefit
> > > zstandard
> > > compression
> > > for the log files, which will consume less CPUs for greater
> > > compression that
> > > bzip2. On low ended boxes with low storage this is actually very
> > > useful as well.
> > > 
> > > I haven't checked yet the performances on my armv6 boxes, but on
> > > the
> > > low ended
> > > recent atom laptops I can tell this is already very useful.
> > > 
> > > Bapt
> > Does it also need to be added to the toolkit in /rescue?  The other
> > major compression tools in base are there.
> I'm not sure it is worth it, is it?
> 
> Bapt

I'm not sure what "worth it" means.  The other compression tools are in
there, I assume because there are recovery scenarios that require them.
 If this new compression gets used in the base system, then perhaps it
also would need to be in there.

For example, if logs are compressed this new way, and you get into a
recovery situation, then you might need to view the logs to figure out
how to recover the system.

-- Ian

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


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

2017-04-22 Thread Ngie Cooper
Author: ngie
Date: Sat Apr 22 23:30:02 2017
New Revision: 317309
URL: https://svnweb.freebsd.org/changeset/base/317309

Log:
  gctl_test.t: improve error reporting with mdcfg and mount directives
  
  If the commands had failed previously, it would press on and result in a
  series of cascading failures. Fail early and continue on to the next case
  instead of executing additional commands after a previously failed series
  of steps.
  
  MFC after:  5 weeks
  Sponsored by:   Dell EMC Isilon

Modified:
  head/tools/regression/geom_gpt/gctl_test.t

Modified: head/tools/regression/geom_gpt/gctl_test.t
==
--- head/tools/regression/geom_gpt/gctl_test.t  Sat Apr 22 23:27:40 2017
(r317308)
+++ head/tools/regression/geom_gpt/gctl_test.t  Sat Apr 22 23:30:02 2017
(r317309)
@@ -161,13 +161,15 @@ foreach my $key (sort keys %steps) {
 $res =~ s/%dev%/$dev/g;
 
 if ($action =~ "^gctl") {
+   my $errmsg = "";
system("$cmd $verbose $args | tee $out 2>&1");
-   $st = `tail -1 $out`;
-   if ($st =~ "^$res") {
-   print "ok $nr \# gctl($key)\n";
-   } else {
-   print "not ok $nr \# gctl($key) - $st\n";
+   chomp($st = `tail -1 $out`);
+   if ($st ne $res) {
+   $errmsg = "\"$st\" (actual) != \"$res\" (expected)\n";
}
+   printf("%sok $nr \# gctl($key)%s\n",
+   ($errmsg eq "" ? "" : "not "),
+   ($errmsg eq "" ? "" : " - $errmsg"));
unlink $out;
 } elsif ($action =~ "^mdcfg") {
if ($args =~ "^create") {
@@ -194,10 +196,18 @@ foreach my $key (sort keys %steps) {
}
unlink $out;
 } elsif ($action =~ "^mount") {
-   system("mkdir $mntpt_prefix-$args");
-   system("newfs $args");
-   system("mount -t ufs /dev/$args $mntpt_prefix-$args");
-   print "ok $nr \# mount($key)\n";
+   my $errmsg = "";
+   mkdir("$mntpt_prefix-$args");
+   if (system("newfs /dev/$args") == 0) {
+   if (system("mount /dev/$args $mntpt_prefix-$args") != 0) {
+   $errmsg = "mount failed";
+   }
+   } else {
+   $errmsg = "newfs failed";
+   }
+   printf("%sok $nr # mount($key)%s\n",
+   ($errmsg eq "" ? "" : "not "),
+   ($errmsg eq "" ? "" : " - $errmsg"));
 } elsif ($action =~ "^umount") {
system("umount $mntpt_prefix-$args");
system("rmdir $mntpt_prefix-$args");
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2017-04-22 Thread Ngie Cooper
Author: ngie
Date: Sat Apr 22 23:27:40 2017
New Revision: 317308
URL: https://svnweb.freebsd.org/changeset/base/317308

Log:
  gctl_test.t: more tweaks to try and update the code and get it functional 
(again?)
  
  - Make the logfile for $out be built off the basename for $cmd, instead of 
$cmd.
(r317292 broke this assumption).
  - Rename $mntpt to $mntpt_prefix for clarity, as this variable is a prefix for
mountpoints.
  - Reindent the umount directive block while here to match the rest of the 
code.
  
  MFC after:5 weeks
  Sponsored by: Dell EMC Isilon

Modified:
  head/tools/regression/geom_gpt/gctl_test.t

Modified: head/tools/regression/geom_gpt/gctl_test.t
==
--- head/tools/regression/geom_gpt/gctl_test.t  Sat Apr 22 23:06:53 2017
(r317307)
+++ head/tools/regression/geom_gpt/gctl_test.t  Sat Apr 22 23:27:40 2017
(r317308)
@@ -29,8 +29,10 @@
 use strict;
 use warnings;
 
+use File::Basename;
+
 my $disk = "/tmp/disk-$$";
-my $mntpt = "/tmp/mount-$$";
+my $mntpt_prefix = "/tmp/mount-$$";
 
 my %steps = (
 "000" => "gctl",
@@ -137,7 +139,7 @@ if ($st != 0) {
 }
 chomp(my $cmd = `make '-V\${.OBJDIR}/\${PROG}'`);
 
-my $out = "/tmp/$cmd.out";
+my $out = basename($cmd) . ".out";
 
 # Make sure we have permission to use gctl...
 if (`$cmd` =~ "^FAIL Permission denied") {
@@ -192,14 +194,14 @@ foreach my $key (sort keys %steps) {
}
unlink $out;
 } elsif ($action =~ "^mount") {
-   system("mkdir $mntpt-$args");
+   system("mkdir $mntpt_prefix-$args");
system("newfs $args");
-   system("mount -t ufs /dev/$args $mntpt-$args");
+   system("mount -t ufs /dev/$args $mntpt_prefix-$args");
print "ok $nr \# mount($key)\n";
 } elsif ($action =~ "^umount") {
-   system("umount $mntpt-$args");
-   system("rmdir $mntpt-$args");
-   print "ok $nr \# umount($key)\n";
+   system("umount $mntpt_prefix-$args");
+   system("rmdir $mntpt_prefix-$args");
+   print "ok $nr \# umount($key)\n";
 }
 $nr += 1;
 }
___
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: r316978 - in head: contrib/zstd etc/mtree lib lib/libzstd share/mk usr.bin usr.bin/zstd

2017-04-22 Thread Baptiste Daroussin
On Sat, Apr 22, 2017 at 04:05:28PM -0600, Ian Lepore wrote:
> On Sun, 2017-04-16 at 09:35 +0200, Baptiste Daroussin wrote:
> > On Sat, Apr 15, 2017 at 04:37:02PM -0700, Rodney W. Grimes wrote:
> > > 
> > > And we need this in base for what great purpose???
> > > 
> > zstandard is the successor to lz4, there are attempts to integrate
> > zstandard in
> > ZFS, Allan Jude is working on that, I am working on integrating in
> > libstand to
> > allow to boot a kernel compressed with zstandard or a mfsroot with
> > zstandard,
> > which would benefit lots of pxe users.
> > 
> > I have also added it to newsyslog(8) so users can benefit zstandard
> > compression
> > for the log files, which will consume less CPUs for greater
> > compression that
> > bzip2. On low ended boxes with low storage this is actually very
> > useful as well.
> > 
> > I haven't checked yet the performances on my armv6 boxes, but on the
> > low ended
> > recent atom laptops I can tell this is already very useful.
> > 
> > Bapt
> 
> Does it also need to be added to the toolkit in /rescue?  The other
> major compression tools in base are there.

I'm not sure it is worth it, is it?

Bapt


signature.asc
Description: PGP signature


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

2017-04-22 Thread Ngie Cooper
Author: ngie
Date: Sat Apr 22 23:06:53 2017
New Revision: 317307
URL: https://svnweb.freebsd.org/changeset/base/317307

Log:
  Use verb=delete not verb=remove
  
  The `remove` verb hasn't been present in geom_part*(4) for well
  over a decade, if ever. I couldn't find any references to it in
  ^/stable/5 at least, which is around the timeframe that this test
  was written.
  
  MFC after:5 weeks
  Sponsored by: Dell EMC Isilon

Modified:
  head/tools/regression/geom_gpt/gctl_test.t

Modified: head/tools/regression/geom_gpt/gctl_test.t
==
--- head/tools/regression/geom_gpt/gctl_test.t  Sat Apr 22 22:40:39 2017
(r317306)
+++ head/tools/regression/geom_gpt/gctl_test.t  Sat Apr 22 23:06:53 2017
(r317307)
@@ -68,9 +68,9 @@ my %steps = (
 "054" => "conf",
 "060" => "gctl verb=add geom=%dev% 
type=516e7cb6-6ecf-11d6-8ff8-00022d09712b start=34 end=546 entry:8=1",
 "061" => "mount %dev%p1",
-"062" => "gctl verb=remove geom=%dev% entry=1",
+"062" => "gctl verb=delete geom=%dev% entry=1",
 "063" => "umount %dev%p1",
-"064" => "gctl verb=remove geom=%dev% entry=1",
+"064" => "gctl verb=delete geom=%dev% entry=1",
 "065" => "conf",
 "100" => "mdcfg destroy",
 "110" => "mdcfg create corrupted",
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2017-04-22 Thread Ngie Cooper
Author: ngie
Date: Sat Apr 22 22:40:39 2017
New Revision: 317306
URL: https://svnweb.freebsd.org/changeset/base/317306

Log:
  gctl_test.t: minor tweaks
  
  - Declare $count with the `my` scope operator to permit `use strict`.
  - Add `use strict`.
  - Use `use warnings` instead of using `-w` in the shebang.
  - Don't unlink $cmd when done (prevents unnecessary rebuilding).
  - Improve the error message when running with insufficient permissions, e.g.,
non-root.
  
  MFC after:5 weeks
  Sponsored by: Dell EMC Isilon

Modified:
  head/tools/regression/geom_gpt/gctl_test.t

Modified: head/tools/regression/geom_gpt/gctl_test.t
==
--- head/tools/regression/geom_gpt/gctl_test.t  Sat Apr 22 22:37:44 2017
(r317305)
+++ head/tools/regression/geom_gpt/gctl_test.t  Sat Apr 22 22:40:39 2017
(r317306)
@@ -1,4 +1,4 @@
-#!/usr/bin/env perl -w
+#!/usr/bin/env perl
 #
 # Copyright (c) 2005, 2006 Marcel Moolenaar
 # All rights reserved.
@@ -26,6 +26,9 @@
 #
 # $FreeBSD$
 
+use strict;
+use warnings;
+
 my $disk = "/tmp/disk-$$";
 my $mntpt = "/tmp/mount-$$";
 
@@ -138,12 +141,12 @@ my $out = "/tmp/$cmd.out";
 
 # Make sure we have permission to use gctl...
 if (`$cmd` =~ "^FAIL Permission denied") {
-print "1..0 # SKIP not enough permission\n";
+print "1..0 # SKIP insufficient permissions\n";
 unlink $cmd;
 exit 0;
 }
 
-$count = keys (%steps);
+my $count = keys (%steps);
 print "1..$count\n";
 
 my $nr = 1;
@@ -200,6 +203,4 @@ foreach my $key (sort keys %steps) {
 }
 $nr += 1;
 }
-
-unlink $cmd;
 exit 0;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r317305 - head/sys/fs/nfsclient

2017-04-22 Thread Rick Macklem
Author: rmacklem
Date: Sat Apr 22 22:37:44 2017
New Revision: 317305
URL: https://svnweb.freebsd.org/changeset/base/317305

Log:
  Fix the NFSv4.1/pNFS client return layout on close.
  
  The "return layout on close" case in the pNFS client was badly broken.
  Fortunately, extant pNFS servers that I have tested against do not
  do this. This patch fixes it. It also changes the way the layout stateid.seqid
  is set for LayoutReturn. I think this change is correct w.r.t. the RFC,
  but I am not 100% sure.
  This was found during recent testing of the pNFS server under development.
  
  MFC after:2 weeks

Modified:
  head/sys/fs/nfsclient/nfs_clstate.c

Modified: head/sys/fs/nfsclient/nfs_clstate.c
==
--- head/sys/fs/nfsclient/nfs_clstate.c Sat Apr 22 22:34:45 2017
(r317304)
+++ head/sys/fs/nfsclient/nfs_clstate.c Sat Apr 22 22:37:44 2017
(r317305)
@@ -88,6 +88,8 @@ extern struct nfsstatsv1 nfsstatsv1;
 extern struct nfsreqhead nfsd_reqq;
 extern u_int32_t newnfs_false, newnfs_true;
 extern int nfscl_debuglevel;
+extern int nfscl_enablecallb;
+extern int nfs_numnfscbd;
 NFSREQSPINLOCK;
 NFSCLSTATEMUTEX;
 int nfscl_inited = 0;
@@ -118,7 +120,8 @@ static struct nfsclclient *nfscl_getclnt
 static struct nfsclclient *nfscl_getclntsess(uint8_t *);
 static struct nfscldeleg *nfscl_finddeleg(struct nfsclclient *, u_int8_t *,
 int);
-static void nfscl_retoncloselayout(struct nfsclclient *, uint8_t *, int);
+static void nfscl_retoncloselayout(vnode_t, struct nfsclclient *, uint8_t *,
+int, struct nfsclrecalllayout **);
 static void nfscl_reldevinfo_locked(struct nfscldevinfo *);
 static struct nfscllayout *nfscl_findlayout(struct nfsclclient *, u_int8_t *,
 int);
@@ -3121,6 +3124,7 @@ nfscl_doclose(vnode_t vp, struct nfsclcl
struct nfsclopen *op;
struct nfscldeleg *dp;
struct nfsfh *nfhp;
+   struct nfsclrecalllayout *recallp;
int error;
 
error = nfscl_getcl(vnode_mount(vp), NULL, NULL, 1, );
@@ -3129,6 +3133,7 @@ nfscl_doclose(vnode_t vp, struct nfsclcl
*clpp = clp;
 
nfhp = VTONFS(vp)->n_fhp;
+   recallp = malloc(sizeof(*recallp), M_NFSLAYRECALL, M_WAITOK);
NFSLOCKCLSTATE();
/*
 * First get rid of the local Open structures, which should be no
@@ -3148,7 +3153,7 @@ nfscl_doclose(vnode_t vp, struct nfsclcl
}
 
/* Return any layouts marked return on close. */
-   nfscl_retoncloselayout(clp, nfhp->nfh_fh, nfhp->nfh_len);
+   nfscl_retoncloselayout(vp, clp, nfhp->nfh_fh, nfhp->nfh_len, );
 
/* Now process the opens against the server. */
 lookformore:
@@ -3171,6 +3176,11 @@ lookformore:
}
}
NFSUNLOCKCLSTATE();
+   /*
+* recallp has been set NULL by nfscl_retoncloselayout() if it was
+* used by the function, but calling free() with a NULL pointer is ok.
+*/
+   free(recallp, M_NFSLAYRECALL);
return (0);
 }
 
@@ -4890,28 +4900,32 @@ nfscl_getlayout(struct nfsclclient *clp,
 }
 
 /*
- * Search for a layout by MDS file handle. If one is found that is marked
- * "return on close", delete it, since it should now be forgotten.
+ * Search for a layout by MDS file handle. If one is found, mark in to be
+ * recalled, if it already marked "return on close".
  */
 static void
-nfscl_retoncloselayout(struct nfsclclient *clp, uint8_t *fhp, int fhlen)
+nfscl_retoncloselayout(vnode_t vp, struct nfsclclient *clp, uint8_t *fhp,
+int fhlen, struct nfsclrecalllayout **recallpp)
 {
struct nfscllayout *lyp;
+   uint32_t iomode;
 
-tryagain:
+   if (vp->v_type != VREG || !NFSHASPNFS(VFSTONFS(vnode_mount(vp))) ||
+   nfscl_enablecallb == 0 || nfs_numnfscbd == 0 ||
+   (VTONFS(vp)->n_flag & NNOLAYOUT) != 0)
+   return;
lyp = nfscl_findlayout(clp, fhp, fhlen);
-   if (lyp != NULL && (lyp->nfsly_flags & NFSLY_RETONCLOSE) != 0) {
-   /*
-* Wait for outstanding I/O ops to be done.
-*/
-   if (lyp->nfsly_lock.nfslock_usecnt != 0 ||
-   lyp->nfsly_lock.nfslock_lock != 0) {
-   lyp->nfsly_lock.nfslock_lock |= NFSV4LOCK_WANTED;
-   (void)mtx_sleep(>nfsly_lock,
-   NFSCLSTATEMUTEXPTR, PZERO, "nfslyc", 0);
-   goto tryagain;
-   }
-   nfscl_freelayout(lyp);
+   if (lyp != NULL && (lyp->nfsly_flags & (NFSLY_RETONCLOSE |
+   NFSLY_RECALL)) == NFSLY_RETONCLOSE) {
+   iomode = 0;
+   if (!LIST_EMPTY(>nfsly_flayread))
+   iomode |= NFSLAYOUTIOMODE_READ;
+   if (!LIST_EMPTY(>nfsly_flayrw))
+   iomode |= NFSLAYOUTIOMODE_RW;
+   (void)nfscl_layoutrecall(NFSLAYOUTRETURN_FILE, lyp, iomode,
+   0, UINT64_MAX, 

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

2017-04-22 Thread Ngie Cooper
Author: ngie
Date: Sat Apr 22 22:34:45 2017
New Revision: 317304
URL: https://svnweb.freebsd.org/changeset/base/317304

Log:
  gctl_test_helper: add diagnostic output for parse_retval(..)
  
  This will help end-users better diagnose issues with the function.
  
  MFC after:5 weeks
  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 Apr 22 22:05:23 
2017(r317303)
+++ head/tools/regression/geom_gpt/gctl_test_helper.c   Sat Apr 22 22:34:45 
2017(r317304)
@@ -29,6 +29,7 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -113,7 +114,7 @@ main(int argc, char *argv[])
struct gctl_req *req;
char *param, *value;
const char *s;
-   int c, len;
+   int c, len, parse_retval;
 
req = gctl_get_handle();
assert(req != NULL);
@@ -132,8 +133,9 @@ main(int argc, char *argv[])
}
}
 
-   while (optind < argc) {
-   if (!parse(argv[optind++], , , )) {
+   for (; optind < argc; optind++) {
+   parse_retval = parse(argv[optind], , , );
+   if (parse_retval == 0) {
if (len > 0) {
rv = malloc(sizeof(struct retval));
assert(rv != NULL);
@@ -144,7 +146,9 @@ main(int argc, char *argv[])
gctl_rw_param(req, param, len, value);
} else
gctl_ro_param(req, param, -1, value);
-   }
+   } else
+   warnc(parse_retval, "failed to parse argument (%s)",
+   argv[optind]);
}
 
if (verbose)
___
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: r316978 - in head: contrib/zstd etc/mtree lib lib/libzstd share/mk usr.bin usr.bin/zstd

2017-04-22 Thread Ian Lepore
On Sun, 2017-04-16 at 09:35 +0200, Baptiste Daroussin wrote:
> On Sat, Apr 15, 2017 at 04:37:02PM -0700, Rodney W. Grimes wrote:
> > 
> > And we need this in base for what great purpose???
> > 
> zstandard is the successor to lz4, there are attempts to integrate
> zstandard in
> ZFS, Allan Jude is working on that, I am working on integrating in
> libstand to
> allow to boot a kernel compressed with zstandard or a mfsroot with
> zstandard,
> which would benefit lots of pxe users.
> 
> I have also added it to newsyslog(8) so users can benefit zstandard
> compression
> for the log files, which will consume less CPUs for greater
> compression that
> bzip2. On low ended boxes with low storage this is actually very
> useful as well.
> 
> I haven't checked yet the performances on my armv6 boxes, but on the
> low ended
> recent atom laptops I can tell this is already very useful.
> 
> Bapt

Does it also need to be added to the toolkit in /rescue?  The other
major compression tools in base are there.

-- Ian

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


svn commit: r317303 - in stable: 10/share/examples/bhyve 11/share/examples/bhyve

2017-04-22 Thread Rodney W. Grimes
Author: rgrimes
Date: Sat Apr 22 22:05:23 2017
New Revision: 317303
URL: https://svnweb.freebsd.org/changeset/base/317303

Log:
  MFC: r314694
  
Make vmrun.sh passthrough -u and -w to bhybe
  
  PR:   214273
  Submitted by: Martin Birgmeier 
  Approved by:  grehan (mentor)

Modified:
  stable/11/share/examples/bhyve/vmrun.sh
Directory Properties:
  stable/11/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/10/share/examples/bhyve/vmrun.sh
Directory Properties:
  stable/10/   (props changed)

Modified: stable/11/share/examples/bhyve/vmrun.sh
==
--- stable/11/share/examples/bhyve/vmrun.sh Sat Apr 22 21:57:26 2017
(r317302)
+++ stable/11/share/examples/bhyve/vmrun.sh Sat Apr 22 22:05:23 2017
(r317303)
@@ -65,6 +65,8 @@ usage() {
echo "   -m: memory size (default is ${DEFAULT_MEMSIZE})"
echo "   -p: pass-through a host PCI device at bus/slot/func (e.g. 
10/0/0)"
echo "   -t: tap device for virtio-net (default is $DEFAULT_TAPDEV)"
+   echo "   -u: RTC keeps UTC time"
+   echo "   -w: ignore unimplemented MSRs"
echo ""
[ -n "$msg" ] && errmsg "$msg"
exit 1
@@ -93,7 +95,7 @@ loader_opt=""
 bhyverun_opt="-H -A -P"
 pass_total=0
 
-while getopts ac:C:d:e:g:hH:iI:l:m:p:t: c ; do
+while getopts ac:C:d:e:g:hH:iI:l:m:p:t:uw c ; do
case $c in
a)
bhyverun_opt="${bhyverun_opt} -a"
@@ -140,6 +142,12 @@ while getopts ac:C:d:e:g:hH:iI:l:m:p:t: 
eval "tap_dev${tap_total}=\"${OPTARG}\""
tap_total=$(($tap_total + 1))
;;
+   u)  
+   bhyverun_opt="${bhyverun_opt} -u"
+   ;;
+   w)
+   bhyverun_opt="${bhyverun_opt} -w"
+   ;;
*)
usage
;;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r317303 - in stable: 10/share/examples/bhyve 11/share/examples/bhyve

2017-04-22 Thread Rodney W. Grimes
Author: rgrimes
Date: Sat Apr 22 22:05:23 2017
New Revision: 317303
URL: https://svnweb.freebsd.org/changeset/base/317303

Log:
  MFC: r314694
  
Make vmrun.sh passthrough -u and -w to bhybe
  
  PR:   214273
  Submitted by: Martin Birgmeier 
  Approved by:  grehan (mentor)

Modified:
  stable/10/share/examples/bhyve/vmrun.sh
Directory Properties:
  stable/10/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/11/share/examples/bhyve/vmrun.sh
Directory Properties:
  stable/11/   (props changed)

Modified: stable/10/share/examples/bhyve/vmrun.sh
==
--- stable/10/share/examples/bhyve/vmrun.sh Sat Apr 22 21:57:26 2017
(r317302)
+++ stable/10/share/examples/bhyve/vmrun.sh Sat Apr 22 22:05:23 2017
(r317303)
@@ -65,6 +65,8 @@ usage() {
echo "   -m: memory size (default is ${DEFAULT_MEMSIZE})"
echo "   -p: pass-through a host PCI device at bus/slot/func (e.g. 
10/0/0)"
echo "   -t: tap device for virtio-net (default is $DEFAULT_TAPDEV)"
+   echo "   -u: RTC keeps UTC time"
+   echo "   -w: ignore unimplemented MSRs"
echo ""
[ -n "$msg" ] && errmsg "$msg"
exit 1
@@ -93,7 +95,7 @@ loader_opt=""
 bhyverun_opt="-H -A -P"
 pass_total=0
 
-while getopts ac:C:d:e:g:hH:iI:l:m:p:t: c ; do
+while getopts ac:C:d:e:g:hH:iI:l:m:p:t:uw c ; do
case $c in
a)
bhyverun_opt="${bhyverun_opt} -a"
@@ -140,6 +142,12 @@ while getopts ac:C:d:e:g:hH:iI:l:m:p:t: 
eval "tap_dev${tap_total}=\"${OPTARG}\""
tap_total=$(($tap_total + 1))
;;
+   u)  
+   bhyverun_opt="${bhyverun_opt} -u"
+   ;;
+   w)
+   bhyverun_opt="${bhyverun_opt} -w"
+   ;;
*)
usage
;;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r317302 - stable/10/share/man/man7

2017-04-22 Thread Rodney W. Grimes
Author: rgrimes
Date: Sat Apr 22 21:57:26 2017
New Revision: 317302
URL: https://svnweb.freebsd.org/changeset/base/317302

Log:
  MFC: r314691
  
  Document 3 more src/ directories
  
  Approved by:  grehan (mentor)

Modified:
  stable/10/share/man/man7/hier.7
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/share/man/man7/hier.7
==
--- stable/10/share/man/man7/hier.7 Sat Apr 22 21:49:59 2017
(r317301)
+++ stable/10/share/man/man7/hier.7 Sat Apr 22 21:57:26 2017
(r317302)
@@ -714,6 +714,9 @@ source code for files in
 files required to produce a
 .Fx
 release
+.It Pa rescue/
+source code for files in
+.Pa /rescue
 .It Pa sbin/
 source code for files in
 .Pa /sbin
@@ -725,6 +728,11 @@ source for files in
 .Pa /usr/share
 .It Pa sys/
 kernel source code
+.It Pa targets/
+support for experimental DIRDEPS_BUILD
+.It Pa tests/
+source code for files in
+.Pa /usr/tests
 .It Pa tools/
 tools used for maintenance and testing of
 .Fx
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r317301 - stable/11/share/man/man7

2017-04-22 Thread Rodney W. Grimes
Author: rgrimes
Date: Sat Apr 22 21:49:59 2017
New Revision: 317301
URL: https://svnweb.freebsd.org/changeset/base/317301

Log:
  MFC r314691:
  
  Document 3 more src/ directories
  
  Approved by:  grehan (mentor)

Modified:
  stable/11/share/man/man7/hier.7
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/share/man/man7/hier.7
==
--- stable/11/share/man/man7/hier.7 Sat Apr 22 21:40:31 2017
(r317300)
+++ stable/11/share/man/man7/hier.7 Sat Apr 22 21:49:59 2017
(r317301)
@@ -702,6 +702,9 @@ source code for files in
 files required to produce a
 .Fx
 release
+.It Pa rescue/
+source code for files in
+.Pa /rescue
 .It Pa sbin/
 source code for files in
 .Pa /sbin
@@ -713,6 +716,11 @@ source for files in
 .Pa /usr/share
 .It Pa sys/
 kernel source code
+.It Pa targets/
+support for experimental DIRDEPS_BUILD
+.It Pa tests/
+source code for files in
+.Pa /usr/tests
 .It Pa tools/
 tools used for maintenance and testing of
 .Fx
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2017-04-22 Thread Ngie Cooper
Author: ngie
Date: Sat Apr 22 21:40:31 2017
New Revision: 317300
URL: https://svnweb.freebsd.org/changeset/base/317300

Log:
  Only expect :grep_r_implied to pass with bsdgrep(1)
  
  The test fails with gnu grep from base and 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 Apr 22 21:40:10 
2017(r317299)
+++ head/usr.bin/grep/tests/grep_freebsd_test.shSat Apr 22 21:40:31 
2017(r317300)
@@ -25,11 +25,45 @@
 #
 # $FreeBSD$
 
+# What grep(1) are we working with?
+# - 0 : bsdgrep
+# - 1 : gnu grep 2.51 (base)
+# - 2 : gnu grep (ports)
+GREP_TYPE_BSD=0
+GREP_TYPE_GNU_FREEBSD=1
+GREP_TYPE_GNU=2
+GREP_TYPE_UNKNOWN=3
+
+grep_type()
+{
+   local grep_version=$(grep --version)
+
+   case "$grep_version" in
+   *"BSD grep"*)
+   return $GREP_TYPE_BSD
+   ;;
+   *"GNU grep"*)
+   case "$grep_version" in
+   *2.5.1-FreeBSD*)
+   return $GREP_TYPE_GNU_FREEBSD
+   ;;
+   *)
+   return $GREP_TYPE_GNU
+   ;;
+   esac
+   ;;
+   esac
+   atf_fail "unknown grep type: $grep_version"
+}
+
 atf_test_case grep_r_implied
 grep_r_implied_body()
 {
-   (cd "$(atf_get_srcdir)" && grep -r -e "test" < /dev/null) ||
-   atf_skip "Implied working directory is not supported with your 
version of grep(1)"
+   grep_type
+   if [ $? -ne $GREP_TYPE_BSD ]; then
+   atf_skip "this test only works with bsdgrep(1)"
+   fi
+
(cd "$(atf_get_srcdir)" && grep -r --exclude="*.out" -e "test" .) > 
d_grep_r_implied.out
 
atf_check -s exit:0 -x \
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r317299 - head/contrib/netbsd-tests/usr.bin/grep

2017-04-22 Thread Ngie Cooper
Author: ngie
Date: Sat Apr 22 21:40:10 2017
New Revision: 317299
URL: https://svnweb.freebsd.org/changeset/base/317299

Log:
  Add more sanity tests for grep, egrep, and fgrep
  
  The test suite currently lacks basic sanity checks to ensure that egrep,
  fgrep, and grep are actually matching the right expression types, i.e. passing
  the right flags to regcomp(3). Amend the test suite to make sure that not only
  are the individual versions doing the right thing, but also that we don't 
have some
  kind of frankenregex situation happening where egrep is accepting a BRE or
  grep an ERE.
  
  I've chosen to not expand the 'basic' test but to add the 'grep_sanity' checks
  to their own test case since this is testing for more than just 'grep matches 
things',
  but actual expression types.
  
  Differential Revision:D10444
  Reviewed by:  emaste, ngie
  Submitted by: Kyle Evans 
  Tested with:  bsdgrep, gnu grep (base, ports)
  Sponsored by: Dell EMC Isilon

Modified:
  head/contrib/netbsd-tests/usr.bin/grep/t_grep.sh

Modified: head/contrib/netbsd-tests/usr.bin/grep/t_grep.sh
==
--- head/contrib/netbsd-tests/usr.bin/grep/t_grep.shSat Apr 22 21:31:37 
2017(r317298)
+++ head/contrib/netbsd-tests/usr.bin/grep/t_grep.shSat Apr 22 21:40:10 
2017(r317299)
@@ -379,6 +379,66 @@ zerolen_body()
 
atf_check -o inline:"Eggs\nCheese\n" grep -v -e "^$" test1
 }
+
+atf_test_case fgrep_sanity
+fgrep_sanity_head()
+{
+   atf_set "descr" "Check for fgrep sanity, literal expressions only"
+}
+fgrep_sanity_body()
+{
+   printf "Foo" > test1
+
+   atf_check -o inline:"Foo\n" fgrep -e "Foo" test1
+
+   atf_check -s exit:1 -o empty fgrep -e "Fo." test1
+}
+
+atf_test_case egrep_sanity
+egrep_sanity_head()
+{
+   atf_set "descr" "Check for egrep sanity, EREs only"
+}
+egrep_sanity_body()
+{
+   printf "Foobar(ed)" > test1
+   printf "M{1}" > test2
+
+   atf_check -o inline:"Foo\n" egrep -o -e "F.." test1
+
+   atf_check -o inline:"Foobar\n" egrep -o -e "F[a-z]*" test1
+
+   atf_check -o inline:"Fo\n" egrep -o -e "F(o|p)" test1
+
+   atf_check -o inline:"(ed)\n" egrep -o -e "\(ed\)" test1
+
+   atf_check -o inline:"M\n" egrep -o -e "M{1}" test2
+
+   atf_check -o inline:"M{1}\n" egrep -o -e "M\{1\}" test2
+}
+
+atf_test_case grep_sanity
+grep_sanity_head()
+{
+   atf_set "descr" "Check for basic grep sanity, BREs only"
+}
+grep_sanity_body()
+{
+   printf "Foobar(ed)" > test1
+   printf "M{1}" > test2
+
+   atf_check -o inline:"Foo\n" grep -o -e "F.." test1
+
+   atf_check -o inline:"Foobar\n" grep -o -e "F[a-z]*" test1
+
+   atf_check -o inline:"Fo\n" grep -o -e "F\(o\)" test1
+
+   atf_check -o inline:"(ed)\n" grep -o -e "(ed)" test1
+
+   atf_check -o inline:"M{1}\n" grep -o -e "M{1}" test2
+
+   atf_check -o inline:"M\n" grep -o -e "M\{1\}" test2
+}
 # End FreeBSD
 
 atf_init_test_cases()
@@ -407,5 +467,8 @@ atf_init_test_cases()
atf_add_test_case escmap
atf_add_test_case egrep_empty_invalid
atf_add_test_case zerolen
+   atf_add_test_case fgrep_sanity
+   atf_add_test_case egrep_sanity
+   atf_add_test_case grep_sanity
 # End FreeBSD
 }
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r317298 - head/bin/sh

2017-04-22 Thread Jilles Tjoelker
Author: jilles
Date: Sat Apr 22 21:31:37 2017
New Revision: 317298
URL: https://svnweb.freebsd.org/changeset/base/317298

Log:
  sh: Simplify setinteractive().
  
  setsignal() does nothing if the signal disposition is already set correctly.

Modified:
  head/bin/sh/options.c
  head/bin/sh/trap.c
  head/bin/sh/trap.h

Modified: head/bin/sh/options.c
==
--- head/bin/sh/options.c   Sat Apr 22 21:26:15 2017(r317297)
+++ head/bin/sh/options.c   Sat Apr 22 21:31:37 2017(r317298)
@@ -131,7 +131,7 @@ procargs(int argc, char **argv)
 void
 optschanged(void)
 {
-   setinteractive(iflag);
+   setinteractive();
 #ifndef NO_HISTORY
histedit();
 #endif

Modified: head/bin/sh/trap.c
==
--- head/bin/sh/trap.c  Sat Apr 22 21:26:15 2017(r317297)
+++ head/bin/sh/trap.c  Sat Apr 22 21:31:37 2017(r317298)
@@ -478,19 +478,14 @@ dotrap(void)
 
 
 /*
- * Controls whether the shell is interactive or not.
+ * Controls whether the shell is interactive or not based on iflag.
  */
 void
-setinteractive(int on)
+setinteractive(void)
 {
-   static int is_interactive = -1;
-
-   if (on == is_interactive)
-   return;
setsignal(SIGINT);
setsignal(SIGQUIT);
setsignal(SIGTERM);
-   is_interactive = on;
 }
 
 

Modified: head/bin/sh/trap.h
==
--- head/bin/sh/trap.h  Sat Apr 22 21:26:15 2017(r317297)
+++ head/bin/sh/trap.h  Sat Apr 22 21:31:37 2017(r317298)
@@ -43,6 +43,6 @@ void ignoresig(int);
 int issigchldtrapped(void);
 void onsig(int);
 void dotrap(void);
-void setinteractive(int);
+void setinteractive(void);
 void exitshell(int) __dead2;
 void exitshell_savedstatus(void) __dead2;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r317297 - head/contrib/netbsd-tests/usr.bin/grep

2017-04-22 Thread Ngie Cooper
Author: ngie
Date: Sat Apr 22 21:26:15 2017
New Revision: 317297
URL: https://svnweb.freebsd.org/changeset/base/317297

Log:
  Remove the expected failures for :context and :context2 with bsdgrep(1)
  
  They're no longer needed after recent fixes made to bsdgrep(1).
  
  Submitted by: Kyle Evans  (via a previous diff in D10433)
  Sponsored by: Dell EMC Isilon

Modified:
  head/contrib/netbsd-tests/usr.bin/grep/t_grep.sh

Modified: head/contrib/netbsd-tests/usr.bin/grep/t_grep.sh
==
--- head/contrib/netbsd-tests/usr.bin/grep/t_grep.shSat Apr 22 20:55:39 
2017(r317296)
+++ head/contrib/netbsd-tests/usr.bin/grep/t_grep.shSat Apr 22 21:26:15 
2017(r317297)
@@ -159,12 +159,6 @@ context_head()
 }
 context_body()
 {
-   # Begin FreeBSD
-   grep_type
-   if [ $? -eq $GREP_TYPE_BSD ]; then
-   atf_expect_fail "this test doesn't pass with BSD grep yet"
-   fi
-   # End FreeBSD
cp $(atf_get_srcdir)/d_context_*.* .
 
atf_check -o file:d_context_a.out grep -C2 bamboo d_context_a.in
@@ -226,12 +220,6 @@ context2_head()
 }
 context2_body()
 {
-   # Begin FreeBSD
-   grep_type
-   if [ $? -eq $GREP_TYPE_BSD ]; then
-   atf_expect_fail "this test doesn't pass with BSD grep yet"
-   fi
-   # End FreeBSD
printf "haddock\000cod\000plaice\000" > test1
printf "mackeral\000cod\000crab\000" > test2
 
___
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: r317290 - head/tools/regression/geom_gpt

2017-04-22 Thread Ngie Cooper (yaneurabeya)

> On Apr 22, 2017, at 14:09, Rodney W. Grimes  
> wrote:

…

> I had seen that already when I made my post, that docuement is not going
> to stop someone from going "Oh, these are out of order I am going to sort
> them since I am here"  They well then probably have issues due to your next
> statement about WARNS and go hum, what is that all about.  And either
> investigate and hopefully find the right thing, or do more wrong things.
> 
> When #includes are out of order for good reason the source code file should
> be market as such and not dependend on the near 0 likelyhood someone
> is going to go read a man page to find out why.


The issue you’re noting is no different from someone removing/shuffling around 
another header in the C file. If someone does that, the least they need to do 
is build test their changes, and ideally they should runtime test the changes 
as well.

WARNS is insurance against someone sorting headers and things breaking again, 
because gctl_dump will not be defined (per the compiler message noted in the 
PR). At which point the party should do “man gctl_dump” and see the comment 
about stdio.h being required for it:

$ man gctl_dump
...
SYNOPSIS
 /* stdio.h is only required for `gctl_dump` */
 #include 
 #include 
…

Put differently, this is no different of an issue than anything else and I 
really don’t see the value in adding a comment stating that the order is such 
because of gctl_dump needing stdio.h to be #include’d first.

Thanks,
-Ngie


signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: svn commit: r317290 - head/tools/regression/geom_gpt

2017-04-22 Thread Rodney W. Grimes
-- Start of PGP signed section.
[ Charset UTF-8 unsupported, converting... ]
> 
> > On Apr 22, 2017, at 13:06, Rodney W. Grimes 
> >  wrote:
> > 
> >> Author: ngie
> >> Date: Sat Apr 22 20:00:52 2017
> >> New Revision: 317290
> >> URL: https://svnweb.freebsd.org/changeset/base/317290
> >> 
> >> Log:
> >>  Fix -Wimplicit-function-declaration compilation warning by moving 
> >> libgeom.h
> >>  #include below the stdio.h #include.
> >> 
> >>  gctl_dump(3) needs stdio.h, per reasoning noted in r317289.
> >> 
> >>  MFC after:5 weeks
> >>  PR:   218809
> >>  Submitted by: Chang-Hsien Tsai 
> >>  Sponsored by: Dell EMC Isilon
> >> 
> >> Modified:
> >>  head/tools/regression/geom_gpt/test.c
> >> 
> >> Modified: head/tools/regression/geom_gpt/test.c
> >> ==
> >> --- head/tools/regression/geom_gpt/test.c  Sat Apr 22 19:32:23 2017
> >> (r317289)
> >> +++ head/tools/regression/geom_gpt/test.c  Sat Apr 22 20:00:52 2017
> >> (r317290)
> >> @@ -29,12 +29,12 @@ __FBSDID("$FreeBSD$");
> >> 
> >> #include 
> >> #include 
> >> -#include 
> >> #include 
> >> #include 
> >> #include 
> >> #include 
> >> #include 
> >> +#include 
> > #include /* This is not in alphabetic order per r317289 
> > */
> >> 
> >> struct retval {
> >>struct retval *retval;
> > 
> > Might it be a good idea to mark this in the test.c file as to why
> > these are not sorted in order to prevent regressions of this in
> > the future?
> 
> Please see r317289. There was an omission in the documentation that allowed 
> this to happen.

I had seen that already when I made my post, that docuement is not going
to stop someone from going "Oh, these are out of order I am going to sort
them since I am here"  They well then probably have issues due to your next
statement about WARNS and go hum, what is that all about.  And either 
investigate and hopefully find the right thing, or do more wrong things.

When #includes are out of order for good reason the source code file should
be market as such and not dependend on the near 0 likelyhood someone
is going to go read a man page to find out why.

> 
> This also won?t happen again given that the test is now being compiled with 
> WARNS?= 6 :).
> 
> -Ngie
-- End of PGP section, PGP failed!

-- 
Rod Grimes rgri...@freebsd.org
___
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: r317290 - head/tools/regression/geom_gpt

2017-04-22 Thread Ngie Cooper (yaneurabeya)

> On Apr 22, 2017, at 13:06, Rodney W. Grimes  
> wrote:
> 
>> Author: ngie
>> Date: Sat Apr 22 20:00:52 2017
>> New Revision: 317290
>> URL: https://svnweb.freebsd.org/changeset/base/317290
>> 
>> Log:
>>  Fix -Wimplicit-function-declaration compilation warning by moving libgeom.h
>>  #include below the stdio.h #include.
>> 
>>  gctl_dump(3) needs stdio.h, per reasoning noted in r317289.
>> 
>>  MFC after:  5 weeks
>>  PR: 218809
>>  Submitted by:   Chang-Hsien Tsai 
>>  Sponsored by:   Dell EMC Isilon
>> 
>> Modified:
>>  head/tools/regression/geom_gpt/test.c
>> 
>> Modified: head/tools/regression/geom_gpt/test.c
>> ==
>> --- head/tools/regression/geom_gpt/test.cSat Apr 22 19:32:23 2017
>> (r317289)
>> +++ head/tools/regression/geom_gpt/test.cSat Apr 22 20:00:52 2017
>> (r317290)
>> @@ -29,12 +29,12 @@ __FBSDID("$FreeBSD$");
>> 
>> #include 
>> #include 
>> -#include 
>> #include 
>> #include 
>> #include 
>> #include 
>> #include 
>> +#include 
> #include   /* This is not in alphabetic order per r317289 */
>> 
>> struct retval {
>>  struct retval *retval;
> 
> Might it be a good idea to mark this in the test.c file as to why
> these are not sorted in order to prevent regressions of this in
> the future?

Please see r317289. There was an omission in the documentation that allowed 
this to happen.

This also won’t happen again given that the test is now being compiled with 
WARNS?= 6 :).

-Ngie


signature.asc
Description: Message signed with OpenPGP using GPGMail


svn commit: r317296 - head/sys/fs/nfsclient

2017-04-22 Thread Rick Macklem
Author: rmacklem
Date: Sat Apr 22 20:55:39 2017
New Revision: 317296
URL: https://svnweb.freebsd.org/changeset/base/317296

Log:
  Fix some krpc leaks for the NFSv4.1/pNFS client.
  
  The NFSv4.1/pNFS client wasn't doing a newnfs_disconnect() call for the
  connection to the Data Server (DS) under some circumstances. The main
  effect of this was a leak of malloc'd structures in the krpc. This patch
  adds the newnfs_disconnect() calls to fix this.
  Detected during recent testing against the pNFS server under development.
  
  MFC after:2 weeks

Modified:
  head/sys/fs/nfsclient/nfs_clrpcops.c
  head/sys/fs/nfsclient/nfs_clvfsops.c

Modified: head/sys/fs/nfsclient/nfs_clrpcops.c
==
--- head/sys/fs/nfsclient/nfs_clrpcops.cSat Apr 22 20:51:54 2017
(r317295)
+++ head/sys/fs/nfsclient/nfs_clrpcops.cSat Apr 22 20:55:39 2017
(r317296)
@@ -5399,10 +5399,13 @@ nfsrpc_fillsa(struct nfsmount *nmp, stru
NFSCL_DEBUG(3, "DS connect=%d\n", error);
 
/* Now, do the exchangeid and create session. */
-   if (error == 0)
+   if (error == 0) {
error = nfsrpc_exchangeid(nmp, clp, nrp, NFSV4EXCH_USEPNFSDS,
, nrp->nr_cred, p);
-   NFSCL_DEBUG(3, "DS exchangeid=%d\n", error);
+   NFSCL_DEBUG(3, "DS exchangeid=%d\n", error);
+   if (error != 0)
+   newnfs_disconnect(nrp);
+   }
if (error == 0) {
dsp->nfsclds_sockp = nrp;
NFSLOCKMNT(nmp);
@@ -5445,8 +5448,10 @@ nfsrpc_fillsa(struct nfsmount *nmp, stru
TAILQ_INSERT_TAIL(>nm_sess, dsp, nfsclds_list);
NFSUNLOCKMNT(nmp);
*dspp = dsp;
-   } else if (dsp != NULL)
+   } else if (dsp != NULL) {
+   newnfs_disconnect(nrp);
nfscl_freenfsclds(dsp);
+   }
return (error);
 }
 

Modified: head/sys/fs/nfsclient/nfs_clvfsops.c
==
--- head/sys/fs/nfsclient/nfs_clvfsops.cSat Apr 22 20:51:54 2017
(r317295)
+++ head/sys/fs/nfsclient/nfs_clvfsops.cSat Apr 22 20:55:39 2017
(r317296)
@@ -1643,8 +1643,12 @@ bad:
NFSUNLOCKCLSTATE();
free(nmp->nm_clp, M_NFSCLCLIENT);
}
-   TAILQ_FOREACH_SAFE(dsp, >nm_sess, nfsclds_list, tdsp)
+   TAILQ_FOREACH_SAFE(dsp, >nm_sess, nfsclds_list, tdsp) {
+   if (dsp != TAILQ_FIRST(>nm_sess) &&
+   dsp->nfsclds_sockp != NULL)
+   newnfs_disconnect(dsp->nfsclds_sockp);
nfscl_freenfsclds(dsp);
+   }
FREE(nmp, M_NEWNFSMNT);
FREE(nam, M_SONAME);
return (error);
@@ -1709,8 +1713,12 @@ nfs_unmount(struct mount *mp, int mntfla
AUTH_DESTROY(nmp->nm_sockreq.nr_auth);
mtx_destroy(>nm_sockreq.nr_mtx);
mtx_destroy(>nm_mtx);
-   TAILQ_FOREACH_SAFE(dsp, >nm_sess, nfsclds_list, tdsp)
+   TAILQ_FOREACH_SAFE(dsp, >nm_sess, nfsclds_list, tdsp) {
+   if (dsp != TAILQ_FIRST(>nm_sess) &&
+   dsp->nfsclds_sockp != NULL)
+   newnfs_disconnect(dsp->nfsclds_sockp);
nfscl_freenfsclds(dsp);
+   }
FREE(nmp, M_NEWNFSMNT);
 out:
return (error);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2017-04-22 Thread Ngie Cooper
Author: ngie
Date: Sat Apr 22 20:51:54 2017
New Revision: 317295
URL: https://svnweb.freebsd.org/changeset/base/317295

Log:
  The GPT class no longer exists; use the PART class instead
  
  MFC after:5 weeks
  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 Apr 22 20:29:56 
2017(r317294)
+++ head/tools/regression/geom_gpt/gctl_test_helper.c   Sat Apr 22 20:51:54 
2017(r317295)
@@ -117,7 +117,7 @@ main(int argc, char *argv[])
 
req = gctl_get_handle();
assert(req != NULL);
-   gctl_ro_param(req, "class", -1, "GPT");
+   gctl_ro_param(req, "class", -1, "PART");
 
while ((c = getopt(argc, argv, "v")) != -1) {
switch (c) {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2017-04-22 Thread Ngie Cooper
Author: ngie
Date: Sat Apr 22 20:29:56 2017
New Revision: 317294
URL: https://svnweb.freebsd.org/changeset/base/317294

Log:
  Bump WARNS to 6 per previous commits which fixed warnings
  
  MFC after:5 weeks
  Tested with:  clang (4.0), gcc (4.2.1, 6.3.0)
  Sponsored by: Dell EMC Isilon

Modified:
  head/tools/regression/geom_gpt/Makefile

Modified: head/tools/regression/geom_gpt/Makefile
==
--- head/tools/regression/geom_gpt/Makefile Sat Apr 22 20:27:46 2017
(r317293)
+++ head/tools/regression/geom_gpt/Makefile Sat Apr 22 20:29:56 2017
(r317294)
@@ -5,4 +5,6 @@ MAN=
 
 LIBADD+=   geom
 
+WARNS?=6
+
 .include 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2017-04-22 Thread Ngie Cooper
Author: ngie
Date: Sat Apr 22 20:27:46 2017
New Revision: 317293
URL: https://svnweb.freebsd.org/changeset/base/317293

Log:
  gctl_test_helper: apply polish
  
  - Staticize variables to fix warnings.
  - Sprinkle asserts around for calls that can fail
  - Apply style(9) for main(..) definition.
  - ANSIify usage(..) definition.
  
  MFC after:5 weeks
  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 Apr 22 20:15:47 
2017(r317292)
+++ head/tools/regression/geom_gpt/gctl_test_helper.c   Sat Apr 22 20:27:46 
2017(r317293)
@@ -28,6 +28,7 @@
 __FBSDID("$FreeBSD$");
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -42,11 +43,11 @@ struct retval {
char *value;
 };
 
-struct retval *retval;
-int verbose;
+static struct retval *retval;
+static int verbose;
 
 static void
-usage()
+usage(void)
 {
fprintf(stdout, "usage: %s [-v] param[:len][=value] ...\n",
getprogname());
@@ -105,7 +106,8 @@ parse(char *arg, char **param, char **va
return (0);
 }
 
-int main(int argc, char *argv[])
+int
+main(int argc, char *argv[])
 {
struct retval *rv;
struct gctl_req *req;
@@ -114,6 +116,7 @@ int main(int argc, char *argv[])
int c, len;
 
req = gctl_get_handle();
+   assert(req != NULL);
gctl_ro_param(req, "class", -1, "GPT");
 
while ((c = getopt(argc, argv, "v")) != -1) {
@@ -133,6 +136,7 @@ int main(int argc, char *argv[])
if (!parse(argv[optind++], , , )) {
if (len > 0) {
rv = malloc(sizeof(struct retval));
+   assert(rv != NULL);
rv->param = param;
rv->value = value;
rv->retval = retval;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2017-04-22 Thread Ngie Cooper
Author: ngie
Date: Sat Apr 22 20:15:47 2017
New Revision: 317292
URL: https://svnweb.freebsd.org/changeset/base/317292

Log:
  gctl_test.t: use make to compile gctl_test_helper instead of calling cc 
directly
  
  MFC after:5 weeks
  Sponsored by: Dell EMC Isilon

Added:
  head/tools/regression/geom_gpt/Makefile   (contents, props changed)
Modified:
  head/tools/regression/geom_gpt/gctl_test.t

Added: head/tools/regression/geom_gpt/Makefile
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tools/regression/geom_gpt/Makefile Sat Apr 22 20:15:47 2017
(r317292)
@@ -0,0 +1,8 @@
+# $FreeBSD$
+
+PROG=  gctl_test_helper
+MAN=
+
+LIBADD+=   geom
+
+.include 

Modified: head/tools/regression/geom_gpt/gctl_test.t
==
--- head/tools/regression/geom_gpt/gctl_test.t  Sat Apr 22 20:06:11 2017
(r317291)
+++ head/tools/regression/geom_gpt/gctl_test.t  Sat Apr 22 20:15:47 2017
(r317292)
@@ -26,11 +26,6 @@
 #
 # $FreeBSD$
 
-my $srcdir = `dirname $0`;
-chomp $srcdir;
-
-my $cmd = "/tmp/gctl-$$";
-my $out = "$cmd.out";
 my $disk = "/tmp/disk-$$";
 my $mntpt = "/tmp/mount-$$";
 
@@ -132,11 +127,14 @@ if (exists $ENV{'TEST_VERBOSE'}) {
 }
 
 # Compile the driver...
-my $st = system("cc -o $cmd -g $srcdir/gctl_test_helper.c -lgeom");
+my $st = system("make obj && make all");
 if ($st != 0) {
 print "1..0 # SKIP error compiling test.c\n";
 exit 0;
 }
+chomp(my $cmd = `make '-V\${.OBJDIR}/\${PROG}'`);
+
+my $out = "/tmp/$cmd.out";
 
 # Make sure we have permission to use gctl...
 if (`$cmd` =~ "^FAIL Permission denied") {
___
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: r317290 - head/tools/regression/geom_gpt

2017-04-22 Thread Rodney W. Grimes
> Author: ngie
> Date: Sat Apr 22 20:00:52 2017
> New Revision: 317290
> URL: https://svnweb.freebsd.org/changeset/base/317290
> 
> Log:
>   Fix -Wimplicit-function-declaration compilation warning by moving libgeom.h
>   #include below the stdio.h #include.
>   
>   gctl_dump(3) needs stdio.h, per reasoning noted in r317289.
>   
>   MFC after:  5 weeks
>   PR: 218809
>   Submitted by:   Chang-Hsien Tsai 
>   Sponsored by:   Dell EMC Isilon
> 
> Modified:
>   head/tools/regression/geom_gpt/test.c
> 
> Modified: head/tools/regression/geom_gpt/test.c
> ==
> --- head/tools/regression/geom_gpt/test.c Sat Apr 22 19:32:23 2017
> (r317289)
> +++ head/tools/regression/geom_gpt/test.c Sat Apr 22 20:00:52 2017
> (r317290)
> @@ -29,12 +29,12 @@ __FBSDID("$FreeBSD$");
>  
>  #include 
>  #include 
> -#include 
>  #include 
>  #include 
>  #include 
>  #include 
>  #include 
> +#include 
#include /* This is not in alphabetic order per r317289 */
>  
>  struct retval {
>   struct retval *retval;

Might it be a good idea to mark this in the test.c file as to why
these are not sorted in order to prevent regressions of this in
the future?


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


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

2017-04-22 Thread Ngie Cooper
Author: ngie
Date: Sat Apr 22 20:06:11 2017
New Revision: 317291
URL: https://svnweb.freebsd.org/changeset/base/317291

Log:
  Rename gctl.t to gctl_test.t and test.c to gctl_test_helper.c
  
  This is being done to reduce ambiguity and to make the tests more portable
  in the future to other locations in the source tree.
  
  MFC after:5 weeks
  Sponsored by: Dell EMC Isilon

Added:
  head/tools/regression/geom_gpt/gctl_test.t
 - copied, changed from r317290, head/tools/regression/geom_gpt/gctl.t
  head/tools/regression/geom_gpt/gctl_test_helper.c
 - copied unchanged from r317290, head/tools/regression/geom_gpt/test.c
Deleted:
  head/tools/regression/geom_gpt/gctl.t
  head/tools/regression/geom_gpt/test.c

Copied and modified: head/tools/regression/geom_gpt/gctl_test.t (from r317290, 
head/tools/regression/geom_gpt/gctl.t)
==
--- head/tools/regression/geom_gpt/gctl.t   Sat Apr 22 20:00:52 2017
(r317290, copy source)
+++ head/tools/regression/geom_gpt/gctl_test.t  Sat Apr 22 20:06:11 2017
(r317291)
@@ -132,7 +132,7 @@ if (exists $ENV{'TEST_VERBOSE'}) {
 }
 
 # Compile the driver...
-my $st = system("cc -o $cmd -g $srcdir/test.c -lgeom");
+my $st = system("cc -o $cmd -g $srcdir/gctl_test_helper.c -lgeom");
 if ($st != 0) {
 print "1..0 # SKIP error compiling test.c\n";
 exit 0;

Copied: head/tools/regression/geom_gpt/gctl_test_helper.c (from r317290, 
head/tools/regression/geom_gpt/test.c)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tools/regression/geom_gpt/gctl_test_helper.c   Sat Apr 22 20:06:11 
2017(r317291, copy of r317290, head/tools/regression/geom_gpt/test.c)
@@ -0,0 +1,165 @@
+/*-
+ * Copyright (c) 2005, 2006 Marcel Moolenaar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+struct retval {
+   struct retval *retval;
+   const char *param;
+   char *value;
+};
+
+struct retval *retval;
+int verbose;
+
+static void
+usage()
+{
+   fprintf(stdout, "usage: %s [-v] param[:len][=value] ...\n",
+   getprogname());
+   exit(1);
+}
+
+static int
+parse(char *arg, char **param, char **value, int *len)
+{
+   char *e, *colon, *equal;
+
+   if (*arg == '\0')
+   return (EINVAL);
+
+   colon = strchr(arg, ':');
+   equal = strchr(arg, '=');
+   if (colon == NULL && equal == NULL)
+   return (EINVAL);
+   if (colon == arg || equal == arg)
+   return (EINVAL);
+   if (colon != NULL && equal != NULL && equal < colon)
+   return (EINVAL);
+
+   if (colon != NULL)
+   *colon++ = '\0';
+   if (equal != NULL)
+   *equal++ = '\0';
+
+   *param = arg;
+   if (colon != NULL) {
+   /* Length specification. This parameter is RW. */
+   if (*colon == '\0')
+   return (EINVAL);
+   *len = strtol(colon, , 0);
+   if (*e != '\0')
+   return (EINVAL);
+   if (*len <= 0 || *len > PATH_MAX)
+   return (EINVAL);
+   *value = malloc(*len);
+   if (*value == NULL)
+   return (ENOMEM);
+   memset(*value, 0, *len);
+   if (equal != NULL) {
+   if (strlen(equal) >= PATH_MAX)
+   return (ENOMEM);
+   strcpy(*value, equal);
+   }
+   } 

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

2017-04-22 Thread Ngie Cooper
Author: ngie
Date: Sat Apr 22 20:00:52 2017
New Revision: 317290
URL: https://svnweb.freebsd.org/changeset/base/317290

Log:
  Fix -Wimplicit-function-declaration compilation warning by moving libgeom.h
  #include below the stdio.h #include.
  
  gctl_dump(3) needs stdio.h, per reasoning noted in r317289.
  
  MFC after:5 weeks
  PR:   218809
  Submitted by: Chang-Hsien Tsai 
  Sponsored by: Dell EMC Isilon

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

Modified: head/tools/regression/geom_gpt/test.c
==
--- head/tools/regression/geom_gpt/test.c   Sat Apr 22 19:32:23 2017
(r317289)
+++ head/tools/regression/geom_gpt/test.c   Sat Apr 22 20:00:52 2017
(r317290)
@@ -29,12 +29,12 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
 #include 
 #include 
+#include 
 
 struct retval {
struct retval *retval;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r317289 - head/lib/libgeom

2017-04-22 Thread Ngie Cooper
Author: ngie
Date: Sat Apr 22 19:32:23 2017
New Revision: 317289
URL: https://svnweb.freebsd.org/changeset/base/317289

Log:
  libgeom(3): note that stdio.h is required when referencing gctl_dump(3)
  
  gctl_dump(3) is only exposed when stdio.h is #include'd first, per its
  addition in r112510. The reasoning noted for the conditional "exposure"
  of the function was to "limit #include pollution".
  
  This addresses an issue I found with the documentation when looking at
  bug 218809, which in turn addresses a -Wimplicit-function-declaration
  compiler warning in `tools/regression/geom_gpt/test.c` (it uses
  gctl_dump(3)).
  
  MFC after:5 weeks
  Sponsored by: Dell EMC Isilon

Modified:
  head/lib/libgeom/libgeom.3

Modified: head/lib/libgeom/libgeom.3
==
--- head/lib/libgeom/libgeom.3  Sat Apr 22 19:11:37 2017(r317288)
+++ head/lib/libgeom/libgeom.3  Sat Apr 22 19:32:23 2017(r317289)
@@ -63,6 +63,10 @@
 .Sh LIBRARY
 .Lb libgeom
 .Sh SYNOPSIS
+.Bd -literal
+/* stdio.h is only required for `gctl_dump` */
+.Ed
+.In stdio.h
 .In libgeom.h
 .Ss "Statistics Functions"
 .Ft void
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r317288 - head/lib/libgeom

2017-04-22 Thread Ngie Cooper
Author: ngie
Date: Sat Apr 22 19:11:37 2017
New Revision: 317288
URL: https://svnweb.freebsd.org/changeset/base/317288

Log:
  libgeom(3): apply minor polish
  
  - Use .Dv when mentioning NULL per mdoc(7).
  - Reword `g_device_path`, `g_open_by_ident`, and `g_providername`'s 
descriptions
so they're less wordy.
  - Fix a typo in `g_device_path` (can not -> cannot).
  
  MFC after:5 weeks
  Tested with:  igor, make manlint
  Sponsored by: Dell EMC Isilon

Modified:
  head/lib/libgeom/libgeom.3

Modified: head/lib/libgeom/libgeom.3
==
--- head/lib/libgeom/libgeom.3  Sat Apr 22 18:59:50 2017(r317287)
+++ head/lib/libgeom/libgeom.3  Sat Apr 22 19:11:37 2017(r317288)
@@ -28,7 +28,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd December 4, 2010
+.Dd April 22, 2017
 .Dt LIBGEOM 3
 .Os
 .Sh NAME
@@ -324,8 +324,8 @@ The
 .Fn g_device_path
 function returns the full path to a provider given a partial or full path to 
the
 device node.
-If the device can not be found or is not a valid geom provider, NULL is
-returned.
+.Dv NULL
+is returned if the device cannot be found or is not a valid geom provider.
 .Pp
 The
 .Fn g_get_ident
@@ -344,20 +344,19 @@ string.
 .Pp
 The
 .Fn g_open_by_ident
-function opens provider using its ident, unlike
+function opens provider using its identification, unlike
 .Fn g_open
-which uses provider's name.
-If the
+which uses the provider's name.
+The function will store the provider's name in the
 .Fa name
-argument is not
-.Dv NULL ,
-the function will store provider's name there.
+parameter if it is not
+.Dv NULL .
 .Pp
 The
 .Fn g_providername
 function returns the provider name of an open file descriptor.
-If the file descriptor does not point to a valid geom provider, NULL is
-returned.
+.Dv NULL
+is returned the file descriptor does not point to a valid geom provider.
 .Pp
 All functions except
 .Fn g_providername
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r317286 - stable/11/sys/netinet

2017-04-22 Thread Mike Karels
Author: karels
Date: Sat Apr 22 18:55:25 2017
New Revision: 317286
URL: https://svnweb.freebsd.org/changeset/base/317286

Log:
  MFC r316065: Enable route and LLE (ndp) caching in TCP/IPv6
  
  tcp_output.c was using a route on the stack for IPv6, which does not
  allow route caching or LLE/ndp caching. Switch to using the route
  (v6 flavor) in the in_pcb, which was already present, which caches
  both L3 and L2 lookups.
  
  Reviewed by:  gnn hiren

Modified:
  stable/11/sys/netinet/tcp_output.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/netinet/tcp_output.c
==
--- stable/11/sys/netinet/tcp_output.c  Sat Apr 22 18:43:15 2017
(r317285)
+++ stable/11/sys/netinet/tcp_output.c  Sat Apr 22 18:55:25 2017
(r317286)
@@ -1365,9 +1365,6 @@ send:
 */
 #ifdef INET6
if (isipv6) {
-   struct route_in6 ro;
-
-   bzero(, sizeof(ro));
/*
 * we separately set hoplimit for every segment, since the
 * user might want to change the value via setsockopt.
@@ -1399,13 +1396,13 @@ send:
 #endif
 
/* TODO: IPv6 IP6TOS_ECT bit on */
-   error = ip6_output(m, tp->t_inpcb->in6p_outputopts, ,
+   error = ip6_output(m, tp->t_inpcb->in6p_outputopts,
+   >t_inpcb->inp_route6,
((so->so_options & SO_DONTROUTE) ?  IP_ROUTETOIF : 0),
NULL, NULL, tp->t_inpcb);
 
-   if (error == EMSGSIZE && ro.ro_rt != NULL)
-   mtu = ro.ro_rt->rt_mtu;
-   RO_RTFREE();
+   if (error == EMSGSIZE && tp->t_inpcb->inp_route6.ro_rt != NULL)
+   mtu = tp->t_inpcb->inp_route6.ro_rt->rt_mtu;
}
 #endif /* INET6 */
 #if defined(INET) && defined(INET6)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r317284 - head/usr.sbin/pmcstat

2017-04-22 Thread Pedro F. Giffuni
Author: pfg
Date: Sat Apr 22 16:02:40 2017
New Revision: 317284
URL: https://svnweb.freebsd.org/changeset/base/317284

Log:
  pmcstat(8); unsign some allocation variables and use reallocarray(3).
  
  Use unsigned values in some internal variables that will be used during
  allocation. The variables are used in reduced scope and have no chance of
  becoming negative.
  
  Provide bounds checking through reallocarray(3).
  
  MFC after:2 weeks

Modified:
  head/usr.sbin/pmcstat/pmcpl_calltree.c
  head/usr.sbin/pmcstat/pmcstat_log.c

Modified: head/usr.sbin/pmcstat/pmcpl_calltree.c
==
--- head/usr.sbin/pmcstat/pmcpl_calltree.c  Sat Apr 22 14:50:11 2017
(r317283)
+++ head/usr.sbin/pmcstat/pmcpl_calltree.c  Sat Apr 22 16:02:40 2017
(r317284)
@@ -185,7 +185,7 @@ pmcpl_ct_samples_free(struct pmcpl_ct_sa
 static void
 pmcpl_ct_samples_grow(struct pmcpl_ct_sample *samples)
 {
-   int npmcs;
+   unsigned int npmcs;
 
/* Enough storage. */
if (pmcstat_npmcs <= samples->npmcs)
@@ -193,7 +193,7 @@ pmcpl_ct_samples_grow(struct pmcpl_ct_sa
 
npmcs = samples->npmcs +
max(pmcstat_npmcs - samples->npmcs, PMCPL_CT_GROWSIZE);
-   samples->sb = realloc(samples->sb, npmcs * sizeof(unsigned));
+   samples->sb = reallocarray(samples->sb, npmcs, sizeof(unsigned));
if (samples->sb == NULL)
errx(EX_SOFTWARE, "ERROR: out of memory");
bzero((char *)samples->sb + samples->npmcs * sizeof(unsigned),
@@ -226,13 +226,13 @@ pmcpl_ct_samples_root(struct pmcpl_ct_sa
 static void
 pmcpl_ct_arc_grow(int cursize, int *maxsize, struct pmcpl_ct_arc **items)
 {
-   int nmaxsize;
+   unsigned int nmaxsize;
 
if (cursize < *maxsize)
return;
 
nmaxsize = *maxsize + max(cursize + 1 - *maxsize, PMCPL_CT_GROWSIZE);
-   *items = realloc(*items, nmaxsize * sizeof(struct pmcpl_ct_arc));
+   *items = reallocarray(*items, nmaxsize, sizeof(struct pmcpl_ct_arc));
if (*items == NULL)
errx(EX_SOFTWARE, "ERROR: out of memory");
bzero((char *)*items + *maxsize * sizeof(struct pmcpl_ct_arc),
@@ -247,13 +247,13 @@ pmcpl_ct_arc_grow(int cursize, int *maxs
 static void
 pmcpl_ct_instr_grow(int cursize, int *maxsize, struct pmcpl_ct_instr **items)
 {
-   int nmaxsize;
+   unsigned int nmaxsize;
 
if (cursize < *maxsize)
return;
 
nmaxsize = *maxsize + max(cursize + 1 - *maxsize, PMCPL_CT_GROWSIZE);
-   *items = realloc(*items, nmaxsize * sizeof(struct pmcpl_ct_instr));
+   *items = reallocarray(*items, nmaxsize, sizeof(struct pmcpl_ct_instr));
if (*items == NULL)
errx(EX_SOFTWARE, "ERROR: out of memory");
bzero((char *)*items + *maxsize * sizeof(struct pmcpl_ct_instr),

Modified: head/usr.sbin/pmcstat/pmcstat_log.c
==
--- head/usr.sbin/pmcstat/pmcstat_log.c Sat Apr 22 14:50:11 2017
(r317283)
+++ head/usr.sbin/pmcstat/pmcstat_log.c Sat Apr 22 16:02:40 2017
(r317284)
@@ -535,8 +535,8 @@ pmcstat_image_add_symbols(struct pmcstat
 * Allocate space for the new entries.
 */
firsttime = image->pi_symbols == NULL;
-   symptr = realloc(image->pi_symbols,
-   sizeof(*symptr) * (image->pi_symcount + nfuncsyms));
+   symptr = reallocarray(image->pi_symbols,
+   image->pi_symcount + nfuncsyms, sizeof(*symptr));
if (symptr == image->pi_symbols) /* realloc() failed. */
return;
image->pi_symbols = symptr;
@@ -587,8 +587,8 @@ pmcstat_image_add_symbols(struct pmcstat
 * Return space to the system if there were duplicates.
 */
if (newsyms < nfuncsyms)
-   image->pi_symbols = realloc(image->pi_symbols,
-   sizeof(*symptr) * image->pi_symcount);
+   image->pi_symbols = reallocarray(image->pi_symbols,
+   image->pi_symcount, sizeof(*symptr));
 
/*
 * Keep the list of symbols sorted.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r317283 - head/sbin/fsck_ffs

2017-04-22 Thread Pedro F. Giffuni
Author: pfg
Date: Sat Apr 22 14:50:11 2017
New Revision: 317283
URL: https://svnweb.freebsd.org/changeset/base/317283

Log:
  fsck_ffs: Unsign some variables and make use of reallocarray(3).
  
  Instead of casting listmax and numdirs to unsigned values just define
  them as unsigned and avoid the casts. Use reallocarray(3).
  
  While here, fs_ncg is already unsigned so the cast is unnecessary.
  
  Reviewed by:  mckusick
  MFC after:2 weeks

Modified:
  head/sbin/fsck_ffs/fsck.h
  head/sbin/fsck_ffs/globs.c
  head/sbin/fsck_ffs/inode.c
  head/sbin/fsck_ffs/setup.c

Modified: head/sbin/fsck_ffs/fsck.h
==
--- head/sbin/fsck_ffs/fsck.h   Sat Apr 22 13:04:36 2017(r317282)
+++ head/sbin/fsck_ffs/fsck.h   Sat Apr 22 14:50:11 2017(r317283)
@@ -282,7 +282,8 @@ struct inoinfo {
u_int   i_numblks;  /* size of block array in bytes */
ufs2_daddr_t i_blks[1]; /* actually longer */
 } **inphead, **inpsort;
-extern long numdirs, dirhash, listmax, inplast;
+extern long dirhash, inplast;
+extern unsigned long numdirs, listmax;
 extern long countdirs; /* number of directories we actually found */
 
 #define MIBSIZE3   /* size of fsck sysctl MIBs */

Modified: head/sbin/fsck_ffs/globs.c
==
--- head/sbin/fsck_ffs/globs.c  Sat Apr 22 13:04:36 2017(r317282)
+++ head/sbin/fsck_ffs/globs.c  Sat Apr 22 14:50:11 2017(r317283)
@@ -56,7 +56,8 @@ struct bufarea sblk;  /* file system sup
 struct bufarea *pdirbp;/* current directory contents */
 struct bufarea *pbp;   /* current inode block */
 ino_t cursnapshot;
-long numdirs, dirhash, listmax, inplast;
+long  dirhash, inplast;
+unsigned long  numdirs, listmax;
 long countdirs;/* number of directories we actually found */
 intadjrefcnt[MIBSIZE]; /* MIB command to adjust inode reference cnt */
 intadjblkcnt[MIBSIZE]; /* MIB command to adjust inode block count */
@@ -123,7 +124,7 @@ fsckinit(void)
pdirbp = NULL;
pbp = NULL;
cursnapshot = 0;
-   numdirs = dirhash = listmax = inplast = 0;
+   listmax = numdirs = dirhash = inplast = 0;
countdirs = 0;
bzero(adjrefcnt, sizeof(int) * MIBSIZE);
bzero(adjblkcnt, sizeof(int) * MIBSIZE);

Modified: head/sbin/fsck_ffs/inode.c
==
--- head/sbin/fsck_ffs/inode.c  Sat Apr 22 13:04:36 2017(r317282)
+++ head/sbin/fsck_ffs/inode.c  Sat Apr 22 14:50:11 2017(r317283)
@@ -472,8 +472,8 @@ cacheino(union dinode *dp, ino_t inumber
inp->i_blks[UFS_NDADDR + i] = DIP(dp, di_ib[i]);
if (inplast == listmax) {
listmax += 100;
-   inpsort = (struct inoinfo **)realloc((char *)inpsort,
-   (unsigned)listmax * sizeof(struct inoinfo *));
+   inpsort = (struct inoinfo **)reallocarray((char *)inpsort,
+   listmax, sizeof(struct inoinfo *));
if (inpsort == NULL)
errx(EEXIT, "cannot increase directory list");
}

Modified: head/sbin/fsck_ffs/setup.c
==
--- head/sbin/fsck_ffs/setup.c  Sat Apr 22 13:04:36 2017(r317282)
+++ head/sbin/fsck_ffs/setup.c  Sat Apr 22 14:50:11 2017(r317283)
@@ -268,8 +268,7 @@ setup(char *dev)
(unsigned)bmapsize);
goto badsb;
}
-   inostathead = Calloc((unsigned)(sblock.fs_ncg),
-   sizeof(struct inostatlist));
+   inostathead = Calloc(sblock.fs_ncg, sizeof(struct inostatlist));
if (inostathead == NULL) {
printf("cannot alloc %u bytes for inostathead\n",
(unsigned)(sizeof(struct inostatlist) * (sblock.fs_ncg)));
@@ -279,10 +278,8 @@ setup(char *dev)
dirhash = numdirs;
inplast = 0;
listmax = numdirs + 10;
-   inpsort = (struct inoinfo **)Calloc((unsigned)listmax,
-   sizeof(struct inoinfo *));
-   inphead = (struct inoinfo **)Calloc((unsigned)numdirs,
-   sizeof(struct inoinfo *));
+   inpsort = (struct inoinfo **)Calloc(listmax, sizeof(struct inoinfo *));
+   inphead = (struct inoinfo **)Calloc(numdirs, sizeof(struct inoinfo *));
if (inpsort == NULL || inphead == NULL) {
printf("cannot alloc %ju bytes for inphead\n",
(uintmax_t)numdirs * sizeof(struct inoinfo *));
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r317282 - head/sys/netinet6

2017-04-22 Thread Kristof Provost
Author: kp
Date: Sat Apr 22 13:04:36 2017
New Revision: 317282
URL: https://svnweb.freebsd.org/changeset/base/317282

Log:
  Rename variable for clarity
  
  Rename the mtu variable in ip6_fragment(), because mtu is misleading. The
  variable actually holds the fragment length.
  No functional change.
  
  Suggested by: ae

Modified:
  head/sys/netinet6/ip6_output.c

Modified: head/sys/netinet6/ip6_output.c
==
--- head/sys/netinet6/ip6_output.c  Sat Apr 22 11:30:07 2017
(r317281)
+++ head/sys/netinet6/ip6_output.c  Sat Apr 22 13:04:36 2017
(r317282)
@@ -217,7 +217,7 @@ in6_delayed_cksum(struct mbuf *m, uint32
 
 int
 ip6_fragment(struct ifnet *ifp, struct mbuf *m0, int hlen, u_char nextproto,
-int mtu, uint32_t id)
+int fraglen , uint32_t id)
 {
struct mbuf *m, **mnext, *m_frgpart;
struct ip6_hdr *ip6, *mhip6;
@@ -226,13 +226,13 @@ ip6_fragment(struct ifnet *ifp, struct m
int error;
int tlen = m0->m_pkthdr.len;
 
-   KASSERT(( mtu % 8 == 0), ("Fragment length must be a multiple of 8"));
+   KASSERT((fraglen % 8 == 0), ("Fragment length must be a multiple of 
8"));
 
m = m0;
ip6 = mtod(m, struct ip6_hdr *);
mnext = >m_nextpkt;
 
-   for (off = hlen; off < tlen; off += mtu) {
+   for (off = hlen; off < tlen; off += fraglen) {
m = m_gethdr(M_NOWAIT, MT_DATA);
if (!m) {
IP6STAT_INC(ip6s_odropped);
@@ -251,18 +251,18 @@ ip6_fragment(struct ifnet *ifp, struct m
return (error);
}
ip6f->ip6f_offlg = htons((u_short)((off - hlen) & ~7));
-   if (off + mtu >= tlen)
-   mtu = tlen - off;
+   if (off + fraglen >= tlen)
+   fraglen = tlen - off;
else
ip6f->ip6f_offlg |= IP6F_MORE_FRAG;
-   mhip6->ip6_plen = htons((u_short)(mtu + hlen +
+   mhip6->ip6_plen = htons((u_short)(fraglen + hlen +
sizeof(*ip6f) - sizeof(struct ip6_hdr)));
-   if ((m_frgpart = m_copym(m0, off, mtu, M_NOWAIT)) == NULL) {
+   if ((m_frgpart = m_copym(m0, off, fraglen, M_NOWAIT)) == NULL) {
IP6STAT_INC(ip6s_odropped);
return (ENOBUFS);
}
m_cat(m, m_frgpart);
-   m->m_pkthdr.len = mtu + hlen + sizeof(*ip6f);
+   m->m_pkthdr.len = fraglen + hlen + sizeof(*ip6f);
m->m_pkthdr.fibnum = m0->m_pkthdr.fibnum;
m->m_pkthdr.rcvif = NULL;
ip6f->ip6f_reserved = 0;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r317280 - head/usr.bin/tip/tip

2017-04-22 Thread Edward Tomasz Napierala
Author: trasz
Date: Sat Apr 22 09:38:43 2017
New Revision: 317280
URL: https://svnweb.freebsd.org/changeset/base/317280

Log:
  Add basic example to the cu(1) man page.  Srsly, folks, you don't
  need to install minicom for this...
  
  MFC after:2 weeks

Modified:
  head/usr.bin/tip/tip/cu.1

Modified: head/usr.bin/tip/tip/cu.1
==
--- head/usr.bin/tip/tip/cu.1   Sat Apr 22 08:38:49 2017(r317279)
+++ head/usr.bin/tip/tip/cu.1   Sat Apr 22 09:38:43 2017(r317280)
@@ -30,7 +30,7 @@
 .\"@(#)tip.1   8.4 (Berkeley) 4/18/94
 .\" $FreeBSD$
 .\"
-.Dd September 1, 2006
+.Dd April 22, 2017
 .Dt CU 1
 .Os
 .Sh NAME
@@ -494,6 +494,11 @@ line access log
 lock file to avoid conflicts with
 .Xr uucp 1 Pq Pa ports/net/freebsd-uucp
 .El
+.Sh EXAMPLES
+Connect to the first USB serial port at the speed of 115200 baud:
+.Bd -literal -offset indent
+cu -s 115200 -l /dev/cuaU0
+.Ed
 .Sh SEE ALSO
 .Xr tip 1
 .Sh HISTORY
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r317279 - head/sys/net

2017-04-22 Thread Alexander Motin
Author: mav
Date: Sat Apr 22 08:38:49 2017
New Revision: 317279
URL: https://svnweb.freebsd.org/changeset/base/317279

Log:
  Remove unneeded conditions.
  
  MFC after:2 weeks

Modified:
  head/sys/net/if_lagg.c

Modified: head/sys/net/if_lagg.c
==
--- head/sys/net/if_lagg.c  Sat Apr 22 02:12:07 2017(r317278)
+++ head/sys/net/if_lagg.c  Sat Apr 22 08:38:49 2017(r317279)
@@ -439,10 +439,8 @@ lagg_register_vlan(void *arg, struct ifn
return;
 
LAGG_RLOCK(sc, );
-   if (!SLIST_EMPTY(>sc_ports)) {
-   SLIST_FOREACH(lp, >sc_ports, lp_entries)
-   EVENTHANDLER_INVOKE(vlan_config, lp->lp_ifp, vtag);
-   }
+   SLIST_FOREACH(lp, >sc_ports, lp_entries)
+   EVENTHANDLER_INVOKE(vlan_config, lp->lp_ifp, vtag);
LAGG_RUNLOCK(sc, );
 }
 
@@ -461,10 +459,8 @@ lagg_unregister_vlan(void *arg, struct i
return;
 
LAGG_RLOCK(sc, );
-   if (!SLIST_EMPTY(>sc_ports)) {
-   SLIST_FOREACH(lp, >sc_ports, lp_entries)
-   EVENTHANDLER_INVOKE(vlan_unconfig, lp->lp_ifp, vtag);
-   }
+   SLIST_FOREACH(lp, >sc_ports, lp_entries)
+   EVENTHANDLER_INVOKE(vlan_unconfig, lp->lp_ifp, vtag);
LAGG_RUNLOCK(sc, );
 }
 
___
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"