svn commit: r349288 - head/sys/ddb

2019-06-21 Thread Ryan Libby
Author: rlibby
Date: Sat Jun 22 05:35:23 2019
New Revision: 349288
URL: https://svnweb.freebsd.org/changeset/base/349288

Log:
  ddb show proc typo

Modified:
  head/sys/ddb/db_ps.c

Modified: head/sys/ddb/db_ps.c
==
--- head/sys/ddb/db_ps.cSat Jun 22 03:50:43 2019(r349287)
+++ head/sys/ddb/db_ps.cSat Jun 22 05:35:23 2019(r349288)
@@ -481,7 +481,7 @@ DB_SHOW_COMMAND(proc, db_show_proc)
dump_args(p);
db_printf("\n");
}
-   db_printf(" repear: %p reapsubtree: %d\n",
+   db_printf(" reaper: %p reapsubtree: %d\n",
p->p_reaper, p->p_reapsubtree);
db_printf(" sigparent: %d\n", p->p_sigparent);
db_printf(" vmspace: %p\n", p->p_vmspace);
___
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: r349287 - head/sys/cam/scsi

2019-06-21 Thread Alexander Motin
Author: mav
Date: Sat Jun 22 03:50:43 2019
New Revision: 349287
URL: https://svnweb.freebsd.org/changeset/base/349287

Log:
  Remove ancient SCSI-2/3 mentioning.
  
  MFC after:2 weeks

Modified:
  head/sys/cam/scsi/scsi_enc.c
  head/sys/cam/scsi/scsi_enc_internal.h

Modified: head/sys/cam/scsi/scsi_enc.c
==
--- head/sys/cam/scsi/scsi_enc.cSat Jun 22 03:16:01 2019
(r349286)
+++ head/sys/cam/scsi/scsi_enc.cSat Jun 22 03:50:43 2019
(r349287)
@@ -684,14 +684,8 @@ enc_type(struct ccb_getdev *cgd)
buflen = min(sizeof(cgd->inq_data),
SID_ADDITIONAL_LENGTH(>inq_data));
 
-   if ((iqd[0] & 0x1f) == T_ENCLOSURE) {
-   if ((iqd[2] & 0x7) > 2) {
-   return (ENC_SES);
-   } else {
-   return (ENC_SES_SCSI2);
-   }
-   return (ENC_NONE);
-   }
+   if ((iqd[0] & 0x1f) == T_ENCLOSURE)
+   return (ENC_SES);
 
 #ifdef SES_ENABLE_PASSTHROUGH
if ((iqd[6] & 0x40) && (iqd[2] & 0x7) >= 2) {
@@ -928,7 +922,6 @@ enc_ctor(struct cam_periph *periph, void *arg)
 
switch (enc->enc_type) {
case ENC_SES:
-   case ENC_SES_SCSI2:
case ENC_SES_PASSTHROUGH:
case ENC_SEMB_SES:
err = ses_softc_init(enc);
@@ -1017,17 +1010,14 @@ enc_ctor(struct cam_periph *periph, void *arg)
case ENC_NONE:
tname = "No ENC device";
break;
-   case ENC_SES_SCSI2:
-   tname = "SCSI-2 ENC Device";
-   break;
case ENC_SES:
-   tname = "SCSI-3 ENC Device";
+   tname = "SES Device";
break;
 case ENC_SES_PASSTHROUGH:
-   tname = "ENC Passthrough Device";
+   tname = "SES Passthrough Device";
break;
 case ENC_SAFT:
-   tname = "SAF-TE Compliant Device";
+   tname = "SAF-TE Device";
break;
case ENC_SEMB_SES:
tname = "SEMB SES Device";

Modified: head/sys/cam/scsi/scsi_enc_internal.h
==
--- head/sys/cam/scsi/scsi_enc_internal.h   Sat Jun 22 03:16:01 2019
(r349286)
+++ head/sys/cam/scsi/scsi_enc_internal.h   Sat Jun 22 03:50:43 2019
(r349287)
@@ -55,10 +55,8 @@ typedef struct enc_element {
 
 typedef enum {
ENC_NONE,
-   ENC_SES_SCSI2,
ENC_SES,
ENC_SES_PASSTHROUGH,
-   ENC_SEN,
ENC_SAFT,
ENC_SEMB_SES,
ENC_SEMB_SAFT
___
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: r349286 - in head: sbin/swapon share/man/man5

2019-06-21 Thread Doug Moore
Author: dougm
Date: Sat Jun 22 03:16:01 2019
New Revision: 349286
URL: https://svnweb.freebsd.org/changeset/base/349286

Log:
  Modify swapon(8) to invoke BIO_DELETE to trim swap devices, either if
  '-E' appears on the swapon command line, or if "trimonce" appears as
  an fstab option.
  
  Discussed at: BSDCAN
  Tested by: markj
  Reviewed by: markj
  Approved by: markj (mentor)
  Differential Revision:https://reviews.freebsd.org/D20599

Modified:
  head/sbin/swapon/swapon.8
  head/sbin/swapon/swapon.c
  head/share/man/man5/fstab.5

Modified: head/sbin/swapon/swapon.8
==
--- head/sbin/swapon/swapon.8   Sat Jun 22 01:20:45 2019(r349285)
+++ head/sbin/swapon/swapon.8   Sat Jun 22 03:16:01 2019(r349286)
@@ -28,7 +28,7 @@
 .\" @(#)swapon.8   8.1 (Berkeley) 6/5/93
 .\" $FreeBSD$
 .\"
-.Dd October 21, 2016
+.Dd June 21, 2019
 .Dt SWAPON 8
 .Os
 .Sh NAME
@@ -38,7 +38,7 @@
 .Nm swapon
 .Oo Fl F Ar fstab
 .Oc
-.Fl aLq | Ar
+.Fl aLq | E Ar
 .Nm swapoff
 .Oo Fl F Ar fstab
 .Oc
@@ -86,6 +86,11 @@ If the
 option is used,
 informational messages will not be
 written to standard output when a swap device is added.
+The
+.Fl E
+option causes each of following devices to receive a
+.Dv BIO_DELETE
+command to mark all blocks as unused.
 .Pp
 The
 .Nm swapoff

Modified: head/sbin/swapon/swapon.c
==
--- head/sbin/swapon/swapon.c   Sat Jun 22 01:20:45 2019(r349285)
+++ head/sbin/swapon/swapon.c   Sat Jun 22 03:16:01 2019(r349286)
@@ -43,6 +43,7 @@ static char sccsid[] = "@(#)swapon.c  8.1 (Berkeley) 6/
 #include 
 __FBSDID("$FreeBSD$");
 
+#include 
 #include 
 #include 
 #include 
@@ -77,7 +78,7 @@ static int run_cmd(int *, const char *, ...) __printfl
 
 static enum { SWAPON, SWAPOFF, SWAPCTL } orig_prog, which_prog = SWAPCTL;
 
-static int qflag;
+static int Eflag, qflag;
 
 int
 main(int argc, char **argv)
@@ -100,7 +101,7 @@ main(int argc, char **argv)

doall = 0;
etc_fstab = NULL;
-   while ((ch = getopt(argc, argv, "AadghklLmqsUF:")) != -1) {
+   while ((ch = getopt(argc, argv, "AadEghklLmqsUF:")) != -1) {
switch(ch) {
case 'A':
if (which_prog == SWAPCTL) {
@@ -121,6 +122,12 @@ main(int argc, char **argv)
else
usage();
break;
+   case 'E':
+   if (which_prog == SWAPON)
+   Eflag = 2;
+   else
+   usage();
+   break;
case 'g':
hflag = 'G';
break;
@@ -182,8 +189,10 @@ main(int argc, char **argv)
strstr(fsp->fs_mntops, "late") == NULL &&
late != 0)
continue;
+   Eflag |= (strstr(fsp->fs_mntops, "trimonce") != 
NULL);
swfile = swap_on_off(fsp->fs_spec, 1,
fsp->fs_mntops);
+   Eflag &= ~1;
if (swfile == NULL) {
ret = 1;
continue;
@@ -378,12 +387,22 @@ swap_on_geli_args(const char *mntops)
return (NULL);
}
} else if (strcmp(token, "notrim") == 0) {
+   if (Eflag) {
+   warn("Options \"notrim\" and "
+   "\"trimonce\" conflict");
+   free(ops);
+   return (NULL);
+   }
Tflag = " -T ";
} else if (strcmp(token, "late") == 0) {
/* ignore known option */
} else if (strcmp(token, "noauto") == 0) {
/* ignore known option */
-   } else if (strcmp(token, "sw") != 0) {
+   } else if (strcmp(token, "sw") == 0) {
+   /* ignore known option */
+   } else if (strcmp(token, "trimonce") == 0) {
+   /* ignore known option */
+   } else {
warnx("Invalid option: %s", token);
free(ops);
return (NULL);
@@ -721,14 +740,42 @@ run_cmd(int *ofd, const char *cmdline, ...)
return (WEXITSTATUS(status));
 }
 
+static void
+swap_trim(const char *name)
+{
+   struct stat sb;
+   off_t ioarg[2], 

svn commit: r349285 - head/sys/dev/virtio/scsi

2019-06-21 Thread Eric van Gyzen
Author: vangyzen
Date: Sat Jun 22 01:20:45 2019
New Revision: 349285
URL: https://svnweb.freebsd.org/changeset/base/349285

Log:
  VirtIO SCSI:  validate seg_max on attach
  
  Until r349278, bhyve presented a seg_max to the guest that was too large.
  Detect this case and clamp it to the virtqueue size.  Otherwise, we would
  fail the "too many segments to enqueue" assertion in virtqueue_enqueue().
  
  I hit this by running a guest with a MAXPHYS of 256 KB.
  
  Reviewed by:  bryanv cem
  MFC after:1 week
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D20703

Modified:
  head/sys/dev/virtio/scsi/virtio_scsi.c

Modified: head/sys/dev/virtio/scsi/virtio_scsi.c
==
--- head/sys/dev/virtio/scsi/virtio_scsi.c  Sat Jun 22 01:06:41 2019
(r349284)
+++ head/sys/dev/virtio/scsi/virtio_scsi.c  Sat Jun 22 01:20:45 2019
(r349285)
@@ -81,6 +81,7 @@ static void   vtscsi_read_config(struct vtscsi_softc *,
struct virtio_scsi_config *);
 static int vtscsi_maximum_segments(struct vtscsi_softc *, int);
 static int vtscsi_alloc_virtqueues(struct vtscsi_softc *);
+static voidvtscsi_check_sizes(struct vtscsi_softc *);
 static voidvtscsi_write_device_config(struct vtscsi_softc *);
 static int vtscsi_reinit(struct vtscsi_softc *);
 
@@ -311,6 +312,8 @@ vtscsi_attach(device_t dev)
goto fail;
}
 
+   vtscsi_check_sizes(sc);
+
error = vtscsi_init_event_vq(sc);
if (error) {
device_printf(dev, "cannot populate the eventvq\n");
@@ -475,6 +478,26 @@ vtscsi_alloc_virtqueues(struct vtscsi_softc *sc)
"%s request", device_get_nameunit(dev));
 
return (virtio_alloc_virtqueues(dev, 0, nvqs, vq_info));
+}
+
+static void
+vtscsi_check_sizes(struct vtscsi_softc *sc)
+{
+   int rqsize;
+
+   if ((sc->vtscsi_flags & VTSCSI_FLAG_INDIRECT) == 0) {
+   /*
+* Ensure the assertions in virtqueue_enqueue(),
+* even if the hypervisor reports a bad seg_max.
+*/
+   rqsize = virtqueue_size(sc->vtscsi_request_vq);
+   if (sc->vtscsi_max_nsegs > rqsize) {
+   device_printf(sc->vtscsi_dev,
+   "clamping seg_max (%d %d)\n", sc->vtscsi_max_nsegs,
+   rqsize);
+   sc->vtscsi_max_nsegs = rqsize;
+   }
+   }
 }
 
 static 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: r349284 - head/sys/cam/scsi

2019-06-21 Thread Alexander Motin
Author: mav
Date: Sat Jun 22 01:06:41 2019
New Revision: 349284
URL: https://svnweb.freebsd.org/changeset/base/349284

Log:
  Make ELEMENT INDEX validation more strict.
  
  SES specifications tell: "The Additional Element Status descriptors shall
  be in the same order as the status elements in the Enclosure Status
  diagnostic page".  It allows us to question ELEMENT INDEX that is lower
  then values we already processed.  There are many SAS2 enclosures with
  this kind of problem.
  
  While there, add more specific error messages for cases when ELEMENT INDEX
  is obviously wrong.  Also skip elements with INVALID bit set.
  
  MFC after:2 weeks

Modified:
  head/sys/cam/scsi/scsi_enc_ses.c

Modified: head/sys/cam/scsi/scsi_enc_ses.c
==
--- head/sys/cam/scsi/scsi_enc_ses.cFri Jun 21 23:40:26 2019
(r349283)
+++ head/sys/cam/scsi/scsi_enc_ses.cSat Jun 22 01:06:41 2019
(r349284)
@@ -1681,7 +1681,6 @@ ses_process_elm_addlstatus(enc_softc_t *enc, struct en
struct ses_iterator iter, titer;
int eip;
int err;
-   int ignore_index = 0;
int length;
int offset;
enc_cache_t *enc_cache;
@@ -1752,7 +1751,7 @@ ses_process_elm_addlstatus(enc_softc_t *enc, struct en
 
elm_hdr = (struct ses_elm_addlstatus_base_hdr *)[offset];
eip = ses_elm_addlstatus_eip(elm_hdr);
-   if (eip && !ignore_index) {
+   if (eip) {
struct ses_elm_addlstatus_eip_hdr *eip_hdr;
int expected_index, index;
ses_elem_index_type_t index_type;
@@ -1765,17 +1764,44 @@ ses_process_elm_addlstatus(enc_softc_t *enc, struct en
index_type = SES_ELEM_INDEX_INDIVIDUAL;
expected_index = iter.individual_element_index;
}
+   if (eip_hdr->element_index < expected_index) {
+   ENC_VLOG(enc, "%s: provided %selement index "
+   "%d is lower then expected %d\n",
+   __func__, (eip_hdr->byte2 &
+   SES_ADDL_EIP_EIIOE) ? "global " : "",
+   eip_hdr->element_index, expected_index);
+   goto badindex;
+   }
titer = iter;
telement = ses_iter_seek_to(,
eip_hdr->element_index, index_type);
-   if (telement != NULL &&
-   (ses_typehasaddlstatus(enc, titer.type_index) !=
-TYPE_ADDLSTATUS_NONE ||
-titer.type_index > ELMTYP_SAS_CONN)) {
+   if (telement == NULL) {
+   ENC_VLOG(enc, "%s: provided %selement index "
+   "%d does not exist\n", __func__,
+   (eip_hdr->byte2 & SES_ADDL_EIP_EIIOE) ?
+   "global " : "", eip_hdr->element_index);
+   goto badindex;
+   }
+   if (ses_typehasaddlstatus(enc, titer.type_index) ==
+   TYPE_ADDLSTATUS_NONE) {
+   ENC_VLOG(enc, "%s: provided %selement index "
+   "%d can't have additional status\n",
+   __func__,
+   (eip_hdr->byte2 & SES_ADDL_EIP_EIIOE) ?
+   "global " : "", eip_hdr->element_index);
+badindex:
+   /*
+* If we expected mandatory element, we may
+* guess it was just a wrong index and we may
+* use the status.  If element was optional,
+* then we have no idea where status belongs.
+*/
+   if (status_type == TYPE_ADDLSTATUS_OPTIONAL)
+   break;
+   } else {
iter = titer;
element = telement;
-   } else
-   ignore_index = 1;
+   }
 
if (eip_hdr->byte2 & SES_ADDL_EIP_EIIOE)
index = iter.global_element_index;
@@ -1797,35 +1823,41 @@ ses_process_elm_addlstatus(enc_softc_t *enc, struct en
"type element index=%d, offset=0x%x, "
"byte0=0x%x, length=0x%x\n", __func__,
iter.global_element_index, iter.type_index,
-   iter.type_element_index, offset, elmpriv->addl.hdr->byte0,

Re: svn commit: r349256 - head/libexec/rc/rc.d

2019-06-21 Thread Rodney W. Grimes
> On 21 Jun, Xin LI wrote:
> 
> > But ultimately, I think the real design question here that needs to be
> > solved would probably be "Why are piling up multiple layers of workarounds
> > around motd? Does it even need to be located in /etc?"  The contents is
> > meant to be updated every time when there is a kernel change, and to that
> > extent it seems to be more appropriate for /var/run and generated at boot
> > from a template located somewhere in /etc.  The benefit of this approach is
> > that you would have one less file to merge for each etcupdate/mergemaster
> > (or at least only need to do it when some customization is made), and there
> > is no need to worry about write durability.
> 
> +1
> 
> This is something that has bothered me for a long time.  It should be
> possible to run with a read-only /etc (obviously with some functional
> limitations).

The updating of the kernel string in /etc/motd is what should go,
that was done before the days of uname, so was more important,
but now it is rather pointless to have the kernel name and
version in motd.

Just go back to earlier days and leave motd as it was intended,
the Message of The Day from the system administrator(s).

If you want readonly / you do:
cd /etc
mkdir ../var/etc
mv motd ../var/etc
ln -s ../var/etc/motd

If your head hurts from the .. it is from decades of me doing chrooted
stuff, sorry, just how my brain fires.  You need to do the above
to a fistfull of other files too, and iirc there are some issues
with passwd as it unlinks the symlinks.  For simpler readonly /
you do:
cd /
mv etc var
ln -s var/etc
this one works very well and is what I use in my nfs diskless setups
to share a readonly / as each node has its own /var file system, /
and /usr are shared.  /tmp varies depending on what i am doing, but
most often a tmpfs.

I do not use the standard freebsd diskless /var tar ball, my /var's
are persistant accross reboots and are per node.

-- 
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: r349283 - head/sys/cam

2019-06-21 Thread Scott Long
Author: scottl
Date: Fri Jun 21 23:40:26 2019
New Revision: 349283
URL: https://svnweb.freebsd.org/changeset/base/349283

Log:
  Refactor xpt_getattr() to make it more readable.  No outwardly
  visible functional changes, though code flow was modified a bit
  internally to lessen the need for goto jumps and chained if
  conditionals.

Modified:
  head/sys/cam/cam_xpt.c

Modified: head/sys/cam/cam_xpt.c
==
--- head/sys/cam/cam_xpt.c  Fri Jun 21 23:29:29 2019(r349282)
+++ head/sys/cam/cam_xpt.c  Fri Jun 21 23:40:26 2019(r349283)
@@ -1244,6 +1244,7 @@ xpt_getattr(char *buf, size_t len, const char *attr, s
 {
int ret = -1, l, o;
struct ccb_dev_advinfo cdai;
+   struct scsi_vpd_device_id *did;
struct scsi_vpd_id_descriptor *idd;
 
xpt_path_assert(path, MA_OWNED);
@@ -1276,31 +1277,36 @@ xpt_getattr(char *buf, size_t len, const char *attr, s
cam_release_devq(cdai.ccb_h.path, 0, 0, 0, FALSE);
if (cdai.provsiz == 0)
goto out;
-   if (cdai.buftype == CDAI_TYPE_SCSI_DEVID) {
+   switch(cdai.buftype) {
+   case CDAI_TYPE_SCSI_DEVID:
+   did = (struct scsi_vpd_device_id *)cdai.buf;
if (strcmp(attr, "GEOM::lunid") == 0) {
-   idd = scsi_get_devid((struct scsi_vpd_device_id 
*)cdai.buf,
-   cdai.provsiz, scsi_devid_is_lun_naa);
+   idd = scsi_get_devid(did, cdai.provsiz,
+   scsi_devid_is_lun_naa);
if (idd == NULL)
-   idd = scsi_get_devid((struct scsi_vpd_device_id 
*)cdai.buf,
-   cdai.provsiz, scsi_devid_is_lun_eui64);
+   idd = scsi_get_devid(did, cdai.provsiz,
+   scsi_devid_is_lun_eui64);
if (idd == NULL)
-   idd = scsi_get_devid((struct scsi_vpd_device_id 
*)cdai.buf,
-   cdai.provsiz, scsi_devid_is_lun_uuid);
+   idd = scsi_get_devid(did, cdai.provsiz,
+   scsi_devid_is_lun_uuid);
if (idd == NULL)
-   idd = scsi_get_devid((struct scsi_vpd_device_id 
*)cdai.buf,
-   cdai.provsiz, scsi_devid_is_lun_md5);
+   idd = scsi_get_devid(did, cdai.provsiz,
+   scsi_devid_is_lun_md5);
} else
idd = NULL;
+
if (idd == NULL)
-   idd = scsi_get_devid((struct scsi_vpd_device_id 
*)cdai.buf,
-   cdai.provsiz, scsi_devid_is_lun_t10);
+   idd = scsi_get_devid(did, cdai.provsiz,
+   scsi_devid_is_lun_t10);
if (idd == NULL)
-   idd = scsi_get_devid((struct scsi_vpd_device_id 
*)cdai.buf,
-   cdai.provsiz, scsi_devid_is_lun_name);
+   idd = scsi_get_devid(did, cdai.provsiz,
+   scsi_devid_is_lun_name);
if (idd == NULL)
-   goto out;
+   break;
+
ret = 0;
-   if ((idd->proto_codeset & SVPD_ID_CODESET_MASK) == 
SVPD_ID_CODESET_ASCII) {
+   if ((idd->proto_codeset & SVPD_ID_CODESET_MASK) ==
+   SVPD_ID_CODESET_ASCII) {
if (idd->length < len) {
for (l = 0; l < idd->length; l++)
buf[l] = idd->identifier[l] ?
@@ -1308,38 +1314,46 @@ xpt_getattr(char *buf, size_t len, const char *attr, s
buf[l] = 0;
} else
ret = EFAULT;
-   } else if ((idd->proto_codeset & SVPD_ID_CODESET_MASK) == 
SVPD_ID_CODESET_UTF8) {
+   break;
+   }
+   if ((idd->proto_codeset & SVPD_ID_CODESET_MASK) ==
+   SVPD_ID_CODESET_UTF8) {
l = strnlen(idd->identifier, idd->length);
if (l < len) {
bcopy(idd->identifier, buf, l);
buf[l] = 0;
} else
ret = EFAULT;
-   } else if ((idd->id_type & SVPD_ID_TYPE_MASK) == 
SVPD_ID_TYPE_UUID
-   && idd->identifier[0] == 0x10) {
-   if ((idd->length - 2) * 2 + 4 < len) {
-   for (l = 2, o = 0; l < idd->length; l++) {
-   if (l == 6 || l == 8 || l == 10 || l == 
12)
-   o += sprintf(buf + o, "-");
-  

svn commit: r349281 - head/sys/cam/scsi

2019-06-21 Thread Alexander Motin
Author: mav
Date: Fri Jun 21 23:29:16 2019
New Revision: 349281
URL: https://svnweb.freebsd.org/changeset/base/349281

Log:
  Fix individual_element_index when some type has 0 elements.
  
  When some type has 0 elements, saved_individual_element_index was set
  to -1 on second type bump, since individual_element_index was not
  restored after the first.  To me it looks easier just to increment
  saved_individual_element_index separately than think when to save it.
  
  MFC after:2 weeks

Modified:
  head/sys/cam/scsi/scsi_enc_ses.c

Modified: head/sys/cam/scsi/scsi_enc_ses.c
==
--- head/sys/cam/scsi/scsi_enc_ses.cFri Jun 21 21:50:14 2019
(r349280)
+++ head/sys/cam/scsi/scsi_enc_ses.cFri Jun 21 23:29:16 2019
(r349281)
@@ -444,6 +444,7 @@ ses_iter_next(struct ses_iterator *iter)
iter->type_element_index   = ITERATOR_INDEX_END;
iter->global_element_index = ITERATOR_INDEX_END;
iter->individual_element_index = ITERATOR_INDEX_END;
+   iter->saved_individual_element_index = ITERATOR_INDEX_END;
return (NULL);
}
 
@@ -468,17 +469,12 @@ ses_iter_next(struct ses_iterator *iter)
 */
iter->type_index++;
iter->type_element_index = 0;
-   iter->saved_individual_element_index
-   = iter->individual_element_index;
iter->individual_element_index = ITERATOR_INDEX_INVALID;
}
 
if (iter->type_element_index > 0) {
-   if (iter->type_element_index == 1) {
-   iter->individual_element_index
-   = iter->saved_individual_element_index;
-   }
-   iter->individual_element_index++;
+   iter->individual_element_index =
+   ++iter->saved_individual_element_index;
}
 
return (>cache->elm_map[iter->global_element_index]);
___
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: r349280 - head/sys/sys

2019-06-21 Thread Alan Somers
Author: asomers
Date: Fri Jun 21 21:50:14 2019
New Revision: 349280
URL: https://svnweb.freebsd.org/changeset/base/349280

Log:
  Reduce namespace pollution from r349233
  
  Define __daddr_t in _types.h and use it in filio.h
  
  Reported by:  ian, bde
  Reviewed by:  ian, imp, cem
  MFC after:2 weeks
  MFC-With: 349233
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D20715

Modified:
  head/sys/sys/_types.h
  head/sys/sys/filio.h
  head/sys/sys/types.h

Modified: head/sys/sys/_types.h
==
--- head/sys/sys/_types.h   Fri Jun 21 21:44:31 2019(r349279)
+++ head/sys/sys/_types.h   Fri Jun 21 21:50:14 2019(r349280)
@@ -68,6 +68,7 @@ typedef   unsigned int__useconds_t;   /* microseconds 
(un
 typedefint __cpuwhich_t;   /* which parameter for cpuset. 
*/
 typedefint __cpulevel_t;   /* level parameter for cpuset. 
*/
 typedef int__cpusetid_t;   /* cpuset identifier. */
+typedef __int64_t  __daddr_t;  /* bwrite(3), FIOBMAP2, etc */
 
 /*
  * Unusual type definitions.

Modified: head/sys/sys/filio.h
==
--- head/sys/sys/filio.hFri Jun 21 21:44:31 2019(r349279)
+++ head/sys/sys/filio.hFri Jun 21 21:50:14 2019(r349280)
@@ -40,7 +40,7 @@
 #ifndef_SYS_FILIO_H_
 #define_SYS_FILIO_H_
 
-#include 
+#include 
 #include 
 
 /* Generic file-descriptor ioctl's. */
@@ -64,12 +64,12 @@ struct fiodgname_arg {
 #defineFIOSEEKDATA _IOWR('f', 97, off_t)   /* SEEK_DATA */
 #defineFIOSEEKHOLE _IOWR('f', 98, off_t)   /* SEEK_HOLE */
 struct fiobmap2_arg {
-   int64_t bn;
-   int runp;
-   int runb;
+   __daddr_t   bn;
+   int runp;
+   int runb;
 };
-/* Get the file's bmap info for the logical block bn */
-#define FIOBMAP2   _IOWR('f', 99, struct fiobmap2_arg)
+/* Get the file's bmap info for the logical block bn. */
+#defineFIOBMAP2_IOWR('f', 99, struct fiobmap2_arg)
 
 #ifdef _KERNEL
 #ifdef COMPAT_FREEBSD32

Modified: head/sys/sys/types.h
==
--- head/sys/sys/types.hFri Jun 21 21:44:31 2019(r349279)
+++ head/sys/sys/types.hFri Jun 21 21:50:14 2019(r349280)
@@ -101,7 +101,7 @@ typedef __clockid_t clockid_t;
 #endif
 
 typedef__critical_tcritical_t; /* Critical section value */
-typedef__int64_t   daddr_t;/* disk address */
+typedef__daddr_t   daddr_t;/* disk address */
 
 #ifndef _DEV_T_DECLARED
 typedef__dev_t dev_t;  /* device number or struct cdev 
*/
___
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: r349256 - head/libexec/rc/rc.d

2019-06-21 Thread Don Lewis
On 21 Jun, Xin LI wrote:

> But ultimately, I think the real design question here that needs to be
> solved would probably be "Why are piling up multiple layers of workarounds
> around motd? Does it even need to be located in /etc?"  The contents is
> meant to be updated every time when there is a kernel change, and to that
> extent it seems to be more appropriate for /var/run and generated at boot
> from a template located somewhere in /etc.  The benefit of this approach is
> that you would have one less file to merge for each etcupdate/mergemaster
> (or at least only need to do it when some customization is made), and there
> is no need to worry about write durability.

+1

This is something that has bothered me for a long time.  It should be
possible to run with a read-only /etc (obviously with some functional
limitations).

___
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: r349243 - head/sys/cam

2019-06-21 Thread Alexander Motin
On 21.06.2019 16:02, Scott Long wrote:
> Hi Alexander,
> 
> Thanks for the explanation, sorry I didn’t realize sooner that it’s
> not used as a copyout buffer anymore.  FWIW, that code is really
> hard to read on an 80 column window, would you be ok if it was
> refactored for better readability?

Sure, why not.

>> On Jun 20, 2019, at 6:04 PM, Alexander Motin  wrote:
>>
>> Hi Scott,
>>
>> You may see this buffer content is not returned directly to user any
>> more.  It is used only as temporary storage to pull
>> CDAI_TYPE_SCSI_DEVID, which is then converted into readable form,
>> returned to user.  And the code is explicitly made to not read outside
>> the range that was copied to the buffer with simple and dumb memcpy().
>>
>> The effect is clearly visible in profiler when GEOM confxml calls it 3
>> times for each disk, taking about 25% of the sysctl's CPU time.  With
>> hundreds of disks it is not so small.
>>
>> On 20.06.2019 18:59, Scott Long wrote:
>>> Hi Alexander,
>>>
>>> I’m not a fan of removing the M_ZERO.  I understand your argument that
>>> lengths are provided elsewhere, but having the buffer be zero’d is defensive
>>> against future bugs that might leak buffer contents.  GETATTR isn’t 
>>> typically
>>> in a performance path, is there any measurable benefit to this?
>>>
>>> Thanks,
>>> Scott
>>>
>>>
 On Jun 20, 2019, at 2:29 PM, Alexander Motin  wrote:

 Author: mav
 Date: Thu Jun 20 20:29:42 2019
 New Revision: 349243
 URL: https://svnweb.freebsd.org/changeset/base/349243

 Log:
 Optimize xpt_getattr().

 Do not allocate temporary buffer for attributes we are going to return
 as-is, just make sure to NUL-terminate them.  Do not zero temporary 64KB
 buffer for CDAI_TYPE_SCSI_DEVID, XPT tells us how much data it filled
 and there are also length fields inside the returned data also.

 MFC after: 2 weeks
 Sponsored by:  iXsystems, Inc.

 Modified:
 head/sys/cam/cam_xpt.c

 Modified: head/sys/cam/cam_xpt.c
 ==
 --- head/sys/cam/cam_xpt.c Thu Jun 20 20:06:19 2019(r349242)
 +++ head/sys/cam/cam_xpt.c Thu Jun 20 20:29:42 2019(r349243)
 @@ -1253,6 +1253,7 @@ xpt_getattr(char *buf, size_t len, const char *attr, 
 s
cdai.ccb_h.func_code = XPT_DEV_ADVINFO;
cdai.flags = CDAI_FLAG_NONE;
cdai.bufsiz = len;
 +  cdai.buf = buf;

if (!strcmp(attr, "GEOM::ident"))
cdai.buftype = CDAI_TYPE_SERIAL_NUM;
 @@ -1262,14 +1263,14 @@ xpt_getattr(char *buf, size_t len, const char 
 *attr, s
 strcmp(attr, "GEOM::lunname") == 0) {
cdai.buftype = CDAI_TYPE_SCSI_DEVID;
cdai.bufsiz = CAM_SCSI_DEVID_MAXLEN;
 +  cdai.buf = malloc(cdai.bufsiz, M_CAMXPT, M_NOWAIT);
 +  if (cdai.buf == NULL) {
 +  ret = ENOMEM;
 +  goto out;
 +  }
} else
goto out;

 -  cdai.buf = malloc(cdai.bufsiz, M_CAMXPT, M_NOWAIT|M_ZERO);
 -  if (cdai.buf == NULL) {
 -  ret = ENOMEM;
 -  goto out;
 -  }
xpt_action((union ccb *)); /* can only be synchronous */
if ((cdai.ccb_h.status & CAM_DEV_QFRZN) != 0)
cam_release_devq(cdai.ccb_h.path, 0, 0, 0, FALSE);
 @@ -1334,13 +1335,15 @@ xpt_getattr(char *buf, size_t len, const char 
 *attr, s
ret = EFAULT;
}
} else {
 -  ret = 0;
 -  if (strlcpy(buf, cdai.buf, len) >= len)
 +  if (cdai.provsiz < len) {
 +  cdai.buf[cdai.provsiz] = 0;
 +  ret = 0;
 +  } else
ret = EFAULT;
}

 out:
 -  if (cdai.buf != NULL)
 +  if ((char *)cdai.buf != buf)
free(cdai.buf, M_CAMXPT);
return ret;
 }

>>>
>>
>> -- 
>> Alexander Motin
> 

-- 
Alexander Motin
___
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: r349243 - head/sys/cam

2019-06-21 Thread Scott Long
Hi Alexander,

Thanks for the explanation, sorry I didn’t realize sooner that it’s
not used as a copyout buffer anymore.  FWIW, that code is really
hard to read on an 80 column window, would you be ok if it was
refactored for better readability?

Thanks,
Scott


> On Jun 20, 2019, at 6:04 PM, Alexander Motin  wrote:
> 
> Hi Scott,
> 
> You may see this buffer content is not returned directly to user any
> more.  It is used only as temporary storage to pull
> CDAI_TYPE_SCSI_DEVID, which is then converted into readable form,
> returned to user.  And the code is explicitly made to not read outside
> the range that was copied to the buffer with simple and dumb memcpy().
> 
> The effect is clearly visible in profiler when GEOM confxml calls it 3
> times for each disk, taking about 25% of the sysctl's CPU time.  With
> hundreds of disks it is not so small.
> 
> On 20.06.2019 18:59, Scott Long wrote:
>> Hi Alexander,
>> 
>> I’m not a fan of removing the M_ZERO.  I understand your argument that
>> lengths are provided elsewhere, but having the buffer be zero’d is defensive
>> against future bugs that might leak buffer contents.  GETATTR isn’t typically
>> in a performance path, is there any measurable benefit to this?
>> 
>> Thanks,
>> Scott
>> 
>> 
>>> On Jun 20, 2019, at 2:29 PM, Alexander Motin  wrote:
>>> 
>>> Author: mav
>>> Date: Thu Jun 20 20:29:42 2019
>>> New Revision: 349243
>>> URL: https://svnweb.freebsd.org/changeset/base/349243
>>> 
>>> Log:
>>> Optimize xpt_getattr().
>>> 
>>> Do not allocate temporary buffer for attributes we are going to return
>>> as-is, just make sure to NUL-terminate them.  Do not zero temporary 64KB
>>> buffer for CDAI_TYPE_SCSI_DEVID, XPT tells us how much data it filled
>>> and there are also length fields inside the returned data also.
>>> 
>>> MFC after:  2 weeks
>>> Sponsored by:   iXsystems, Inc.
>>> 
>>> Modified:
>>> head/sys/cam/cam_xpt.c
>>> 
>>> Modified: head/sys/cam/cam_xpt.c
>>> ==
>>> --- head/sys/cam/cam_xpt.c  Thu Jun 20 20:06:19 2019(r349242)
>>> +++ head/sys/cam/cam_xpt.c  Thu Jun 20 20:29:42 2019(r349243)
>>> @@ -1253,6 +1253,7 @@ xpt_getattr(char *buf, size_t len, const char *attr, s
>>> cdai.ccb_h.func_code = XPT_DEV_ADVINFO;
>>> cdai.flags = CDAI_FLAG_NONE;
>>> cdai.bufsiz = len;
>>> +   cdai.buf = buf;
>>> 
>>> if (!strcmp(attr, "GEOM::ident"))
>>> cdai.buftype = CDAI_TYPE_SERIAL_NUM;
>>> @@ -1262,14 +1263,14 @@ xpt_getattr(char *buf, size_t len, const char 
>>> *attr, s
>>>  strcmp(attr, "GEOM::lunname") == 0) {
>>> cdai.buftype = CDAI_TYPE_SCSI_DEVID;
>>> cdai.bufsiz = CAM_SCSI_DEVID_MAXLEN;
>>> +   cdai.buf = malloc(cdai.bufsiz, M_CAMXPT, M_NOWAIT);
>>> +   if (cdai.buf == NULL) {
>>> +   ret = ENOMEM;
>>> +   goto out;
>>> +   }
>>> } else
>>> goto out;
>>> 
>>> -   cdai.buf = malloc(cdai.bufsiz, M_CAMXPT, M_NOWAIT|M_ZERO);
>>> -   if (cdai.buf == NULL) {
>>> -   ret = ENOMEM;
>>> -   goto out;
>>> -   }
>>> xpt_action((union ccb *)); /* can only be synchronous */
>>> if ((cdai.ccb_h.status & CAM_DEV_QFRZN) != 0)
>>> cam_release_devq(cdai.ccb_h.path, 0, 0, 0, FALSE);
>>> @@ -1334,13 +1335,15 @@ xpt_getattr(char *buf, size_t len, const char 
>>> *attr, s
>>> ret = EFAULT;
>>> }
>>> } else {
>>> -   ret = 0;
>>> -   if (strlcpy(buf, cdai.buf, len) >= len)
>>> +   if (cdai.provsiz < len) {
>>> +   cdai.buf[cdai.provsiz] = 0;
>>> +   ret = 0;
>>> +   } else
>>> ret = EFAULT;
>>> }
>>> 
>>> out:
>>> -   if (cdai.buf != NULL)
>>> +   if ((char *)cdai.buf != buf)
>>> free(cdai.buf, M_CAMXPT);
>>> return ret;
>>> }
>>> 
>> 
> 
> -- 
> Alexander Motin

___
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: r349256 - head/libexec/rc/rc.d

2019-06-21 Thread Enji Cooper

> On Jun 21, 2019, at 12:32, Xin LI  wrote:
> 
> 
>> On Thu, Jun 20, 2019 at 7:38 PM Conrad Meyer  wrote:
>> Author: cem
>> Date: Fri Jun 21 02:37:54 2019
>> New Revision: 349256
>> URL: https://svnweb.freebsd.org/changeset/base/349256
>> 
>> Log:
>>   rc.d/motd: Update motd more robustly
>> 
>>   Use appropriate fsyncs to persist the rewritten /etc/motd file, when a
>>   rewrite is performed.
> 
> Why is /etc/motd so important to deserve this kind of construct?  The worst 
> that could happen to /etc/motd with previous code is that you might end up 
> with an empty or non-existent /etc/motd, and the change have introduced more 
> problems than it intended to solve.
>  
>> 
>>   Reported by:  Jonathan Walton 
>>   Reviewed by:  allanjude, vangyzen
>>   Sponsored by: Dell EMC Isilon
>>   Differential Revision:https://reviews.freebsd.org/D20701
>> 
>> Modified:
>>   head/libexec/rc/rc.d/motd
>> 
>> Modified: head/libexec/rc/rc.d/motd
>> ==
>> --- head/libexec/rc/rc.d/motd   Fri Jun 21 00:52:30 2019(r349255)
>> +++ head/libexec/rc/rc.d/motd   Fri Jun 21 02:37:54 2019(r349256)
>> @@ -37,11 +37,15 @@ motd_start()
>> uname -v | sed -e 's,^\([^#]*\) #\(.* 
>> [1-2][0-9][0-9][0-9]\).*/\([^\]*\) $,\1 (\3) #\2,' > ${T}
>> awk '{if (NR == 1) {if ($1 == "FreeBSD") {next} else {print "\n"$0}} 
>> else {print}}' < /etc/motd >> ${T}
>> 
>> -   cmp -s $T /etc/motd || {
>> -   cp $T /etc/motd
>> +   if ! cmp -s $T /etc/motd; then
>> +   mv -f $T /etc/.motd.tmp
> 
> This have partially defeated the benefit of doing mktemp in the code above.  
> The old code tries to avoid excessive writes to /, which is preserved, but it 
> is not safe to assume /etc/.motd.tmp is a non-existent plain file: mv would 
> happily proceed when .motd.tmp is a preexisting directory, for instance (and 
> subsequent mv -f would fail).  A malicious system administrator can now plant 
> a timing bomb which will fill / eventually.
> 
> You can do a TMPDIR=/etc/ mktemp .motd.tmp. and use that to mitigate 
> the attack above, but then if the system crash in the middle you would still 
> end up with a dangling .motd.tmp. file in /etc.
> 
> Also note that $T is on /tmp which is likely to be a different filesystem, 
> internally this is mostly equivalent to cp + rm.  You can simplify the code 
> by reverting to previous cp and keep the rm -f below as an unconditional 
> remove like before.
> 
>> +   fsync /etc/.motd.tmp
>> +   mv -f /etc/.motd.tmp /etc/motd
>> chmod ${PERMS} /etc/motd
>> -   }
>> -   rm -f $T
>> +   fsync /etc
> 
> There is absolutely no reason to fsync /etc here.  mv'ing on the same file 
> system is performed with rename(2) which is required to be atomic by POSIX.  
> /etc/motd will be pointing to either the old one or the new one in the event 
> of a crash, and both are acceptable.
>  
> So, in my opinion the new code would have made the situation worse than the 
> old code.
> 
> But ultimately, I think the real design question here that needs to be solved 
> would probably be "Why are piling up multiple layers of workarounds around 
> motd? Does it even need to be located in /etc?"  The contents is meant to be 
> updated every time when there is a kernel change, and to that extent it seems 
> to be more appropriate for /var/run and generated at boot from a template 
> located somewhere in /etc.  The benefit of this approach is that you would 
> have one less file to merge for each etcupdate/mergemaster (or at least only 
> need to do it when some customization is made), and there is no need to worry 
> about write durability.

I don’t know the exact reasoning today, but once upon a time, there used to 
be a number of things hooked to /etc/motd generation that could influence 
information provided to downstream callers/systems.
Thank you,
-Enji
___
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: r349256 - head/libexec/rc/rc.d

2019-06-21 Thread Xin LI
On Thu, Jun 20, 2019 at 7:38 PM Conrad Meyer  wrote:

> Author: cem
> Date: Fri Jun 21 02:37:54 2019
> New Revision: 349256
> URL: https://svnweb.freebsd.org/changeset/base/349256
>
> Log:
>   rc.d/motd: Update motd more robustly
>
>   Use appropriate fsyncs to persist the rewritten /etc/motd file, when a
>   rewrite is performed.
>

Why is /etc/motd so important to deserve this kind of construct?  The worst
that could happen to /etc/motd with previous code is that you might end up
with an empty or non-existent /etc/motd, and the change have introduced
more problems than it intended to solve.


>
>   Reported by:  Jonathan Walton 
>   Reviewed by:  allanjude, vangyzen
>   Sponsored by: Dell EMC Isilon
>   Differential Revision:https://reviews.freebsd.org/D20701
>
> Modified:
>   head/libexec/rc/rc.d/motd
>
> Modified: head/libexec/rc/rc.d/motd
>
> ==
> --- head/libexec/rc/rc.d/motd   Fri Jun 21 00:52:30 2019(r349255)
> +++ head/libexec/rc/rc.d/motd   Fri Jun 21 02:37:54 2019(r349256)
> @@ -37,11 +37,15 @@ motd_start()
> uname -v | sed -e 's,^\([^#]*\) #\(.*
> [1-2][0-9][0-9][0-9]\).*/\([^\]*\) $,\1 (\3) #\2,' > ${T}
> awk '{if (NR == 1) {if ($1 == "FreeBSD") {next} else {print
> "\n"$0}} else {print}}' < /etc/motd >> ${T}
>
> -   cmp -s $T /etc/motd || {
> -   cp $T /etc/motd
> +   if ! cmp -s $T /etc/motd; then
> +   mv -f $T /etc/.motd.tmp
>

This have partially defeated the benefit of doing mktemp in the code
above.  The old code tries to avoid excessive writes to /, which is
preserved, but it is not safe to assume /etc/.motd.tmp is a non-existent
plain file: mv would happily proceed when .motd.tmp is a preexisting
directory, for instance (and subsequent mv -f would fail).  A malicious
system administrator can now plant a timing bomb which will fill /
eventually.

You can do a TMPDIR=/etc/ mktemp .motd.tmp. and use that to
mitigate the attack above, but then if the system crash in the middle you
would still end up with a dangling .motd.tmp. file in /etc.

Also note that $T is on /tmp which is likely to be a different filesystem,
internally this is mostly equivalent to cp + rm.  You can simplify the code
by reverting to previous cp and keep the rm -f below as an unconditional
remove like before.

+   fsync /etc/.motd.tmp
>
+   mv -f /etc/.motd.tmp /etc/motd
> chmod ${PERMS} /etc/motd
> -   }
> -   rm -f $T
> +   fsync /etc
>

There is absolutely no reason to fsync /etc here.  mv'ing on the same file
system is performed with rename(2) which is required to be atomic by
POSIX.  /etc/motd will be pointing to either the old one or the new one in
the event of a crash, and both are acceptable.

So, in my opinion the new code would have made the situation worse than the
old code.

But ultimately, I think the real design question here that needs to be
solved would probably be "Why are piling up multiple layers of workarounds
around motd? Does it even need to be located in /etc?"  The contents is
meant to be updated every time when there is a kernel change, and to that
extent it seems to be more appropriate for /var/run and generated at boot
from a template located somewhere in /etc.  The benefit of this approach is
that you would have one less file to merge for each etcupdate/mergemaster
(or at least only need to do it when some customization is made), and there
is no need to worry about write durability.
___
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: r349278 - head/usr.sbin/bhyve

2019-06-21 Thread Eric van Gyzen
Author: vangyzen
Date: Fri Jun 21 18:57:33 2019
New Revision: 349278
URL: https://svnweb.freebsd.org/changeset/base/349278

Log:
  bhyve: Fix vtscsi maximum segment config
  
  The seg_max value reported to the guest should be two less than the
  host's maximum, in order to leave room for the request and the
  response.  This is analogous to r347033 for virtio_block.
  
  We hit the "too many segments to enqueue" assertion on OneFS because
  we increase MAXPHYS to 256 KB.
  
  Reviewed by:  bryanv
  Discussed with:   cem jhb rgrimes
  MFC after:1 week
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D20529

Modified:
  head/usr.sbin/bhyve/pci_virtio_scsi.c

Modified: head/usr.sbin/bhyve/pci_virtio_scsi.c
==
--- head/usr.sbin/bhyve/pci_virtio_scsi.c   Fri Jun 21 18:48:07 2019
(r349277)
+++ head/usr.sbin/bhyve/pci_virtio_scsi.c   Fri Jun 21 18:57:33 2019
(r349278)
@@ -309,7 +309,8 @@ pci_vtscsi_reset(void *vsc)
/* initialize config structure */
sc->vss_config = (struct pci_vtscsi_config){
.num_queues = VTSCSI_REQUESTQ,
-   .seg_max = VTSCSI_MAXSEG,
+   /* Leave room for the request and the response. */
+   .seg_max = VTSCSI_MAXSEG - 2,
.max_sectors = 2,
.cmd_per_lun = 1,
.event_info_size = sizeof(struct pci_vtscsi_event),
___
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: r349277 - in head/sys: compat/linuxkpi/common/include/linux sys

2019-06-21 Thread Johannes Lundberg
Author: johalun
Date: Fri Jun 21 18:48:07 2019
New Revision: 349277
URL: https://svnweb.freebsd.org/changeset/base/349277

Log:
  LinuxKPI: Additions to rcu list.
  
  - Add rcu list functions.
  - Make rcu hlist's foreach macro use rcu calls instead of the non-rcu macro.
  - Bump FreeBSD version so we have a checkpoint for the vboxvideo drm driver.
  
  Reviewed by:  hps
  Approved by:  imp (mentor), hps
  MFC after:1 week
  Differential Revision:D20719

Modified:
  head/sys/compat/linuxkpi/common/include/linux/rculist.h
  head/sys/sys/param.h

Modified: head/sys/compat/linuxkpi/common/include/linux/rculist.h
==
--- head/sys/compat/linuxkpi/common/include/linux/rculist.h Fri Jun 21 
16:43:16 2019(r349276)
+++ head/sys/compat/linuxkpi/common/include/linux/rculist.h Fri Jun 21 
18:48:07 2019(r349277)
@@ -33,6 +33,25 @@
 #include 
 #include 
 
+#definelist_entry_rcu(ptr, type, member) \
+   container_of(READ_ONCE(ptr), type, member)
+
+#definelist_next_rcu(head) (*((struct list_head 
**)(&(head)->next)))
+
+#definelist_for_each_entry_rcu(pos, head, member) \
+   for (pos = list_entry_rcu((head)->next, typeof(*(pos)), member); \
+&(pos)->member != (head);  \
+pos = list_entry_rcu((pos)->member.next, typeof(*(pos)), member))
+
+static inline void
+list_add_rcu(struct list_head *new, struct list_head *prev)
+{
+   new->next = prev->next;
+   new->prev = prev;
+   rcu_assign_pointer(list_next_rcu(prev), new);
+   prev->prev = new;
+}
+
 #definehlist_first_rcu(head)   (*((struct hlist_node 
**)(&(head)->first)))
 #definehlist_next_rcu(node)(*((struct hlist_node 
**)(&(node)->next)))
 #definehlist_pprev_rcu(node)   (*((struct hlist_node 
**)((node)->pprev)))
@@ -47,8 +66,12 @@ hlist_add_behind_rcu(struct hlist_node *n, struct hlis
n->next->pprev = >next;
 }
 
-#definehlist_for_each_entry_rcu(pos, head, member) \
-   hlist_for_each_entry(pos, head, member)
+#definehlist_for_each_entry_rcu(pos, head, member) 
\
+   for (pos = hlist_entry_safe 
(rcu_dereference_raw(hlist_first_rcu(head)),\
+   typeof(*(pos)), member);\
+(pos); \
+pos = hlist_entry_safe(rcu_dereference_raw(hlist_next_rcu( \
+   &(pos)->member)), typeof(*(pos)), member))
 
 static inline void
 hlist_del_rcu(struct hlist_node *n)

Modified: head/sys/sys/param.h
==
--- head/sys/sys/param.hFri Jun 21 16:43:16 2019(r349276)
+++ head/sys/sys/param.hFri Jun 21 18:48:07 2019(r349277)
@@ -60,7 +60,7 @@
  * in the range 5 to 9.
  */
 #undef __FreeBSD_version
-#define __FreeBSD_version 1300032  /* Master, propagated to newvers */
+#define __FreeBSD_version 1300033  /* Master, propagated to newvers */
 
 /*
  * __FreeBSD_kernel__ indicates that this system uses the kernel of 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: r349276 - head/sys/compat/linuxkpi/common/include/asm

2019-06-21 Thread Johannes Lundberg
Author: johalun
Date: Fri Jun 21 16:43:16 2019
New Revision: 349276
URL: https://svnweb.freebsd.org/changeset/base/349276

Log:
  LinuxKPI: Add atomic_long_sub macro.
  
  Reviewed by:  imp (mentor), hps
  Approved by:  imp (mentor), hps
  MFC after:1 week
  Differential Revision:D20718

Modified:
  head/sys/compat/linuxkpi/common/include/asm/atomic-long.h

Modified: head/sys/compat/linuxkpi/common/include/asm/atomic-long.h
==
--- head/sys/compat/linuxkpi/common/include/asm/atomic-long.h   Fri Jun 21 
16:02:26 2019(r349275)
+++ head/sys/compat/linuxkpi/common/include/asm/atomic-long.h   Fri Jun 21 
16:43:16 2019(r349276)
@@ -42,6 +42,7 @@ typedef struct {
 } atomic_long_t;
 
 #defineatomic_long_add(i, v)   atomic_long_add_return((i), (v))
+#defineatomic_long_sub(i, v)   atomic_long_add_return(-(i), 
(v))
 #defineatomic_long_inc_return(v)   atomic_long_add_return(1, (v))
 #defineatomic_long_inc_not_zero(v) atomic_long_add_unless((v), 1, 
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: r349275 - svnadmin/conf

2019-06-21 Thread Warner Losh
Author: imp
Date: Fri Jun 21 16:02:26 2019
New Revision: 349275
URL: https://svnweb.freebsd.org/changeset/base/349275

Log:
  I forgot to add Johannes Lundberg to mentors when I added him to the
  access file. Fix that.

Modified:
  svnadmin/conf/mentors

Modified: svnadmin/conf/mentors
==
--- svnadmin/conf/mentors   Fri Jun 21 15:56:28 2019(r349274)
+++ svnadmin/conf/mentors   Fri Jun 21 16:02:26 2019(r349275)
@@ -20,6 +20,7 @@ dougm kib Co-mentor: markj
 gordon delphij Co-mentor: emaste
 jceel  trasz
 jkhrwatson
+johalunimp
 kadesaiken Co-mentor: scottl, ambrisko
 leitao jhibbitsCo-mentor: nwhitehorn
 mahrensmckusick
___
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: r349273 - head/sys/arm/conf

2019-06-21 Thread Ian Lepore
Author: ian
Date: Fri Jun 21 15:44:58 2019
New Revision: 349273
URL: https://svnweb.freebsd.org/changeset/base/349273

Log:
  Add pwm to the armv7 GENERIC kernel, it's now used by TI and Allwinner.

Modified:
  head/sys/arm/conf/GENERIC

Modified: head/sys/arm/conf/GENERIC
==
--- head/sys/arm/conf/GENERIC   Fri Jun 21 15:12:17 2019(r349272)
+++ head/sys/arm/conf/GENERIC   Fri Jun 21 15:44:58 2019(r349273)
@@ -174,6 +174,9 @@ device  ti_spi
 # ADC support
 device ti_adc
 
+# PWM
+device pwm
+
 # Watchdog support
 # If we don't enable the watchdog driver, the BealeBone could potentially
 # reboot automatically because the boot loader might have enabled the
___
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: r349272 - head/share/man/man9

2019-06-21 Thread Ian Lepore
Author: ian
Date: Fri Jun 21 15:12:17 2019
New Revision: 349272
URL: https://svnweb.freebsd.org/changeset/base/349272

Log:
  Do some general cleanup and light wordsmithing.
  
  Sort methods alphabetically.  Wrap long lines.  Start sentences on a new
  line.  Remove contractions (not because it's a good idea, just to silence
  igor).  Add some explanation of the units for the period and duty arguments
  and the convention for channel numbers.

Modified:
  head/share/man/man9/pwmbus.9

Modified: head/share/man/man9/pwmbus.9
==
--- head/share/man/man9/pwmbus.9Fri Jun 21 14:46:43 2019
(r349271)
+++ head/share/man/man9/pwmbus.9Fri Jun 21 15:12:17 2019
(r349272)
@@ -27,14 +27,14 @@
 .Os
 .Sh NAME
 .Nm pwmbus ,
-.Nm PWMBUS_GET_BUS ,
 .Nm PWMBUS_CHANNEL_CONFIG ,
+.Nm PWMBUS_CHANNEL_COUNT ,
+.Nm PWMBUS_CHANNEL_ENABLE ,
 .Nm PWMBUS_CHANNEL_GET_CONFIG ,
-.Nm PWMBUS_CHANNEL_SET_FLAGS ,
 .Nm PWMBUS_CHANNEL_GET_FLAGS ,
-.Nm PWMBUS_CHANNEL_ENABLE ,
 .Nm PWMBUS_CHANNEL_IS_ENABLED ,
-.Nm PWMBUS_CHANNEL_MAX
+.Nm PWMBUS_CHANNEL_SET_FLAGS ,
+.Nm PWMBUS_GET_BUS
 .Nd PWMBUS methods
 .Sh SYNOPSIS
 .Cd "device pwm"
@@ -42,45 +42,65 @@
 .Ft int
 .Fn PWMBUS_CHANNEL_CONFIG "device_t bus" "int channel" "uint64_t period" 
"uint64_t duty"
 .Ft int
-.Fn PWMBUS_CHANNEL_GET_CONFIG "device_t bus" "int channel" "uint64_t *period" 
"uint64_t *duty"
+.Fn PWMBUS_CHANNEL_COUNT "device_t bus" "int channel" "int *nchannel"
 .Ft int
-.Fn PWMBUS_CHANNEL_SET_FLAGS "device_t bus" "int channel" "uint32_t flags"
+.Fn PWMBUS_CHANNEL_ENABLE "device_t bus" "int channel" "bool enable"
 .Ft int
+.Fn PWMBUS_CHANNEL_GET_CONFIG "device_t bus" "int channel" "uint64_t *period" 
"uint64_t *duty"
+.Ft int
 .Fn PWMBUS_CHANNEL_GET_FLAGS "device_t bus" "int channel" "uint32_t *flags"
 .Ft int
-.Fn PWMBUS_CHANNEL_ENABLE "device_t bus" "int channel" "bool enable"
-.Ft int
 .Fn PWMBUS_CHANNEL_IS_ENABLED "device_t bus" "int channel" "bool *enabled"
 .Ft int
-.Fn PWMBUS_CHANNEL_COUNT "device_t bus" "int channel" "int *nchannel"
+.Fn PWMBUS_CHANNEL_SET_FLAGS "device_t bus" "int channel" "uint32_t flags"
 .Sh DESCRIPTION
-The PWMBUS (Pulse-Width Modulation) interface allows the device driver to 
register to a global
-bus so other devices in the kernel can use them in a generic way.
+The PWMBUS (Pulse-Width Modulation) interface allows a device driver to
+register to a global bus so other devices in the kernel can use them in a
+generic way.
+.Pp
+For all
+.Nm
+methods, the
+.Va period
+argument is the duration in nanoseconds of one complete on-off cycle, and the
+.Va duty
+argument is the duration in nanoseconds of the on portion of that cycle.
+.Pp
+Some PWM hardware is organized as a single controller with multiple channels.
+Channel numbers count up from zero.
+When multiple channels are present, they sometimes share a common clock or 
+other resources.
+In such cases, changing the period or duty cycle of any one channel may affect 
+other channels within the hardware which share the same resources.
+Consult the documentation for the underlying PWM hardware device driver for 
+details on channels that share resources.
 .Sh INTERFACE
 .Bl -tag -width indent
 .It Fn PWMBUS_CHANNEL_CONFIG "device_t bus" "int channel" "uint64_t period" 
"uint64_t duty"
-Configure the period and duty (in nanoseconds) in the PWM controller on the 
bus for the specified channel.
+Configure the period and duty (in nanoseconds) in the PWM controller on the bus
+for the specified channel.
 Returns 0 on success or
 .Er EINVAL
 if the values are not supported by the controller or
 .Er EBUSY
-if the PWMBUS controller is in use and doesn't support changing the value on 
the fly.
+if the PWMBUS controller is in use and does not support changing the value on
+the fly.
+.It Fn PWMBUS_CHANNEL_COUNT "device_t bus" "int *nchannel"
+Get the number of channels supported by the controller.
+.It Fn PWMBUS_CHANNEL_ENABLE "device_t bus" "int channel" "bool enable"
+Enable the PWM channel.
 .It Fn PWMBUS_CHANNEL_GET_CONFIG "device_t bus" "int channel" "uint64_t 
*period" "uint64_t *duty"
 Get the current configuration of the period and duty for the specified channel.
-.It Fn PWMBUS_CHANNEL_SET_FLAGS "device_t bus" "int channel" "uint32_t flags"
-Set the flags of the channel (such as inverted polarity), if the driver or 
controller
-doesn't support this a do-nothing default method is used.
 .It Fn PWMBUS_CHANNEL_GET_FLAGS "device_t bus" "int channel" "uint32_t *flags"
 Get the current flags for the channel.
 If the driver or controller
-doesn't support this, a default method returns a flags value of zero.
-.It Fn PWMBUS_CHANNEL_ENABLE "device_t bus" "int channel" "bool enable"
-Enable the PWM channel.
-.It Fn PWMBUS_CHANNEL_ISENABLED "device_t bus" "int channel" "bool *enable"
-Test if the PWM channel is enabled.
-.It PWMBUS_CHANNEL_COUNT "device_t bus" "int channel" "int *nchannel"
-Get the number of 

svn commit: r349271 - head/share/man/man9

2019-06-21 Thread Ian Lepore
Author: ian
Date: Fri Jun 21 14:46:43 2019
New Revision: 349271
URL: https://svnweb.freebsd.org/changeset/base/349271

Log:
  Catch up with recent changes in pwmbus(9).  The pwm(9) and pwmbus(9)
  interfaces were unified into pwmbus(9), and the PWMBUS_CHANNEL_MAX method
  was renamed PWMBUS_CHANNEL_COUNT.  The pwmbus_attach_bus() function just
  went away completely.  Also, fix a few typos such as s/is/if/.

Deleted:
  head/share/man/man9/pwm.9
Modified:
  head/share/man/man9/Makefile
  head/share/man/man9/pwmbus.9

Modified: head/share/man/man9/Makefile
==
--- head/share/man/man9/MakefileFri Jun 21 14:24:33 2019
(r349270)
+++ head/share/man/man9/MakefileFri Jun 21 14:46:43 2019
(r349271)
@@ -270,7 +270,6 @@ MAN=accept_filter.9 \
proc_rwmem.9 \
pseudofs.9 \
psignal.9 \
-   pwm.9 \
pwmbus.9 \
random.9 \
random_harvest.9 \
@@ -1670,6 +1669,7 @@ MLINKS+=proc_rwmem.9 proc_readmem.9 \
 MLINKS+=psignal.9 gsignal.9 \
psignal.9 pgsignal.9 \
psignal.9 tdsignal.9
+MLINKS+=pwmbus.9 pwm.9
 MLINKS+=random.9 arc4rand.9 \
random.9 arc4random.9 \
random.9 is_random_seeded.9 \

Modified: head/share/man/man9/pwmbus.9
==
--- head/share/man/man9/pwmbus.9Fri Jun 21 14:24:33 2019
(r349270)
+++ head/share/man/man9/pwmbus.9Fri Jun 21 14:46:43 2019
(r349271)
@@ -22,12 +22,11 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd November 12, 2018
+.Dd June 21, 2019
 .Dt PWMBUS 9
 .Os
 .Sh NAME
 .Nm pwmbus ,
-.Nm pwmbus_attach_bus ,
 .Nm PWMBUS_GET_BUS ,
 .Nm PWMBUS_CHANNEL_CONFIG ,
 .Nm PWMBUS_CHANNEL_GET_CONFIG ,
@@ -40,8 +39,6 @@
 .Sh SYNOPSIS
 .Cd "device pwm"
 .In "pwmbus_if.h"
-.Ft device_t
-.Fn pwmbus_attach_bus "device_t dev"
 .Ft int
 .Fn PWMBUS_CHANNEL_CONFIG "device_t bus" "int channel" "uint64_t period" 
"uint64_t duty"
 .Ft int
@@ -55,37 +52,35 @@
 .Ft int
 .Fn PWMBUS_CHANNEL_IS_ENABLED "device_t bus" "int channel" "bool *enabled"
 .Ft int
-.Fn PWMBUS_CHANNEL_MAX "device_t bus" "int channel" "int *nchannel"
+.Fn PWMBUS_CHANNEL_COUNT "device_t bus" "int channel" "int *nchannel"
 .Sh DESCRIPTION
 The PWMBUS (Pulse-Width Modulation) interface allows the device driver to 
register to a global
-bus so other devices in the kernel can use them in a generic way
+bus so other devices in the kernel can use them in a generic way.
 .Sh INTERFACE
 .Bl -tag -width indent
-.It Fn pwmbus_attach_bus "device_t dev"
-Attach the
-.Nm pwmbus
-to the device driver
 .It Fn PWMBUS_CHANNEL_CONFIG "device_t bus" "int channel" "uint64_t period" 
"uint64_t duty"
 Configure the period and duty (in nanoseconds) in the PWM controller on the 
bus for the specified channel.
 Returns 0 on success or
 .Er EINVAL
-is the values are not supported by the controller or
+if the values are not supported by the controller or
 .Er EBUSY
-is the PWMBUS controller is in use and doesn't support changing the value on 
the fly.
+if the PWMBUS controller is in use and doesn't support changing the value on 
the fly.
 .It Fn PWMBUS_CHANNEL_GET_CONFIG "device_t bus" "int channel" "uint64_t 
*period" "uint64_t *duty"
 Get the current configuration of the period and duty for the specified channel.
 .It Fn PWMBUS_CHANNEL_SET_FLAGS "device_t bus" "int channel" "uint32_t flags"
-Set the flags of the channel (like inverted polarity), if the driver or 
controller
-doesn't support this a default method is used.
+Set the flags of the channel (such as inverted polarity), if the driver or 
controller
+doesn't support this a do-nothing default method is used.
 .It Fn PWMBUS_CHANNEL_GET_FLAGS "device_t bus" "int channel" "uint32_t *flags"
-Get the current flags for the channel, if the driver or controller
-doesn't support this, a default method is used.
+Get the current flags for the channel.
+If the driver or controller
+doesn't support this, a default method returns a flags value of zero.
 .It Fn PWMBUS_CHANNEL_ENABLE "device_t bus" "int channel" "bool enable"
 Enable the PWM channel.
 .It Fn PWMBUS_CHANNEL_ISENABLED "device_t bus" "int channel" "bool *enable"
 Test if the PWM channel is enabled.
-.It PWMBUS_CHANNEL_MAX "device_t bus" "int channel" "int *nchannel"
-Get the maximum number of channel supported by the controller.
+.It PWMBUS_CHANNEL_COUNT "device_t bus" "int channel" "int *nchannel"
+Get the number of channels supported by the controller.
+Channel numbers count up from zero.
 .El
 .Sh HISTORY
 The
___
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: r349270 - head/sys/arm/ti/am335x

2019-06-21 Thread Ian Lepore
Author: ian
Date: Fri Jun 21 14:24:33 2019
New Revision: 349270
URL: https://svnweb.freebsd.org/changeset/base/349270

Log:
  Add support for the PWM(9) API.  This allows configuring the pwm output using
  pwm(9), but also maintains the historical sysctl config interface for
  compatiblity with existing apps.  The two config systems are not compatible
  with each other; if you use both interfaces to change configurations you're
  likely to end up with incorrect output or none at all.

Modified:
  head/sys/arm/ti/am335x/am335x_ehrpwm.c

Modified: head/sys/arm/ti/am335x/am335x_ehrpwm.c
==
--- head/sys/arm/ti/am335x/am335x_ehrpwm.c  Fri Jun 21 14:01:02 2019
(r349269)
+++ head/sys/arm/ti/am335x/am335x_ehrpwm.c  Fri Jun 21 14:24:33 2019
(r349270)
@@ -45,12 +45,33 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#include "pwmbus_if.h"
+
 #include "am335x_pwm.h"
 
+/***
+ * Enhanced resolution PWM driver.  Many of the advanced featues of the 
hardware
+ * are not supported by this driver.  What is implemented here is simple
+ * variable-duty-cycle PWM output.
+ *
+ * Note that this driver was historically configured using a set of sysctl
+ * variables/procs, and later gained support for the PWM(9) API.  The sysctl
+ * code is still present to support existing apps, but that interface is
+ * considered deprecated.
+ *
+ * An important caveat is that the original sysctl interface and the new PWM 
API
+ * cannot both be used at once.  If both interfaces are used to change
+ * configuration, it's quite likely you won't get the expected results.  Also,
+ * reading the sysctl values after configuring via PWM will not return the 
right
+ * results.
+ 
**/
+
 /* In ticks */
 #defineDEFAULT_PWM_PERIOD  1000
 #definePWM_CLOCK   1UL
 
+#defineNS_PER_SEC  10
+
 #definePWM_LOCK(_sc)   mtx_lock(&(_sc)->sc_mtx)
 #definePWM_UNLOCK(_sc) mtx_unlock(&(_sc)->sc_mtx)
 #definePWM_LOCK_ASSERT(_sc)mtx_assert(&(_sc)->sc_mtx, MA_OWNED)
@@ -120,6 +141,11 @@ __FBSDID("$FreeBSD$");
 #defineAQCTL_ZRO_TOGGLE(3 << 0)
 #defineEPWM_AQSFRC 0x1a
 #defineEPWM_AQCSFRC0x1c
+#defineAQCSFRC_OFF 0
+#defineAQCSFRC_LO  1
+#defineAQCSFRC_HI  2
+#defineAQCSFRC_MASK3
+#defineAQCSFRC(chan, hilo) ((hilo) << (2 * chan))
 
 /* Trip-Zone module */
 #defineEPWM_TZCTL  0x28
@@ -136,8 +162,16 @@ static device_detach_t am335x_ehrpwm_detach;
 
 static int am335x_ehrpwm_clkdiv[8] = { 1, 2, 4, 8, 16, 32, 64, 128 };
 
+struct ehrpwm_channel {
+   u_int   duty;   /* on duration, in ns */
+   boolenabled;/* channel enabled? */
+   boolinverted;   /* signal inverted? */
+};
+#defineNUM_CHANNELS2
+
 struct am335x_ehrpwm_softc {
device_tsc_dev;
+   device_tsc_busdev;
struct mtx  sc_mtx;
struct resource *sc_mem_res;
int sc_mem_rid;
@@ -153,6 +187,12 @@ struct am335x_ehrpwm_softc {
uint32_tsc_pwm_period;
uint32_tsc_pwm_dutyA;
uint32_tsc_pwm_dutyB;
+
+   /* Things used for configuration via pwm(9) api. */
+   u_int   sc_clkfreq; /* frequency in Hz */
+   u_int   sc_clktick; /* duration in ns */
+   u_int   sc_period;  /* duration in ns */
+   struct ehrpwm_channel   sc_channels[NUM_CHANNELS];
 };
 
 static struct ofw_compat_data compat_data[] = {
@@ -161,8 +201,118 @@ static struct ofw_compat_data compat_data[] = {
 };
 SIMPLEBUS_PNP_INFO(compat_data);
 
+static void
+am335x_ehrpwm_cfg_duty(struct am335x_ehrpwm_softc *sc, u_int chan, u_int duty)
+{
+   u_int tbcmp;
 
+   if (duty == 0)
+   tbcmp = 0;
+   else
+   tbcmp = max(1, duty / sc->sc_clktick);
+
+   sc->sc_channels[chan].duty = tbcmp * sc->sc_clktick;
+
+   PWM_LOCK_ASSERT(sc);
+   EPWM_WRITE2(sc, (chan == 0) ? EPWM_CMPA : EPWM_CMPB, tbcmp);
+}
+
 static void
+am335x_ehrpwm_cfg_enable(struct am335x_ehrpwm_softc *sc, u_int chan, bool 
enable)
+{
+   uint16_t regval;
+
+   sc->sc_channels[chan].enabled = enable;
+
+   /*
+* Turn off any existing software-force of the channel, then force
+* it in the right direction (high or low) if it's not being enabled.
+*/
+   PWM_LOCK_ASSERT(sc);
+   regval = EPWM_READ2(sc, EPWM_AQCSFRC);
+   regval &= ~AQCSFRC(chan, 

Re: svn commit: r346976 - head/usr.sbin/mountd

2019-06-21 Thread Harry Schmalzbauer

Am 30.04.2019 um 23:38 schrieb Alexander Motin:

Author: mav
Date: Tue Apr 30 21:38:38 2019
New Revision: 346976
URL: https://svnweb.freebsd.org/changeset/base/346976

Log:
   Respect quotes and escapes when splitting exports fields.
   
   Without this r293305 was still unable to handle names with spaces.
   
   MFC after:	1 week


Hi Alexander,

could you please have a look into
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=238725

This commit breaks -maproot for :groupX definition in exports(5).

Since this was also MFCd to stable/11 (in r347341), I hope this can be 
fixed quickly and RE approves the fix for 11.3.


Thanks,

-harry

___
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: r349269 - head/sys/arm/ti/am335x

2019-06-21 Thread Ian Lepore
Author: ian
Date: Fri Jun 21 14:01:02 2019
New Revision: 349269
URL: https://svnweb.freebsd.org/changeset/base/349269

Log:
  Some mundane tweaks and cleanups to help de-clutter the diffs of some
  upcoming functional changes.
  
  Add an ofw_compat_data table for probing compat strings, and use it to add
  PNP data.  Remove some stray semicolons at the end of macro definitions,
  and add a PWM_LOCK_ASSERT macro to round out the usual suite.  Move the
  device_t and driver_methods structs to the end of the file.  Tweak comments.

Modified:
  head/sys/arm/ti/am335x/am335x_ehrpwm.c

Modified: head/sys/arm/ti/am335x/am335x_ehrpwm.c
==
--- head/sys/arm/ti/am335x/am335x_ehrpwm.c  Fri Jun 21 13:42:40 2019
(r349268)
+++ head/sys/arm/ti/am335x/am335x_ehrpwm.c  Fri Jun 21 14:01:02 2019
(r349269)
@@ -53,13 +53,14 @@ __FBSDID("$FreeBSD$");
 
 #definePWM_LOCK(_sc)   mtx_lock(&(_sc)->sc_mtx)
 #definePWM_UNLOCK(_sc) mtx_unlock(&(_sc)->sc_mtx)
+#definePWM_LOCK_ASSERT(_sc)mtx_assert(&(_sc)->sc_mtx, MA_OWNED)
 #definePWM_LOCK_INIT(_sc)  mtx_init(&(_sc)->sc_mtx, \
 device_get_nameunit(_sc->sc_dev), "am335x_ehrpwm softc", MTX_DEF)
 #definePWM_LOCK_DESTROY(_sc)   mtx_destroy(&(_sc)->sc_mtx)
 
-#defineEPWM_READ2(_sc, reg)bus_read_2((_sc)->sc_mem_res, reg);
+#defineEPWM_READ2(_sc, reg)bus_read_2((_sc)->sc_mem_res, reg)
 #defineEPWM_WRITE2(_sc, reg, value)\
-bus_write_2((_sc)->sc_mem_res, reg, value);
+bus_write_2((_sc)->sc_mem_res, reg, value)
 
 #defineEPWM_TBCTL  0x00
 #defineTBCTL_FREERUN   (2 << 14)
@@ -140,7 +141,8 @@ struct am335x_ehrpwm_softc {
struct mtx  sc_mtx;
struct resource *sc_mem_res;
int sc_mem_rid;
-   /* sysctl for configuration */
+
+   /* Things used for configuration via sysctl [deprecated]. */
int sc_pwm_clkdiv;
int sc_pwm_freq;
struct sysctl_oid   *sc_clkdiv_oid;
@@ -153,22 +155,13 @@ struct am335x_ehrpwm_softc {
uint32_tsc_pwm_dutyB;
 };
 
-static device_method_t am335x_ehrpwm_methods[] = {
-   DEVMETHOD(device_probe, am335x_ehrpwm_probe),
-   DEVMETHOD(device_attach,am335x_ehrpwm_attach),
-   DEVMETHOD(device_detach,am335x_ehrpwm_detach),
-
-   DEVMETHOD_END
+static struct ofw_compat_data compat_data[] = {
+   {"ti,am33xx-ehrpwm",true},
+   {NULL,  false},
 };
+SIMPLEBUS_PNP_INFO(compat_data);
 
-static driver_t am335x_ehrpwm_driver = {
-   "am335x_ehrpwm",
-   am335x_ehrpwm_methods,
-   sizeof(struct am335x_ehrpwm_softc),
-};
 
-static devclass_t am335x_ehrpwm_devclass;
-
 static void
 am335x_ehrpwm_freq(struct am335x_ehrpwm_softc *sc)
 {
@@ -337,7 +330,7 @@ am335x_ehrpwm_probe(device_t dev)
if (!ofw_bus_status_okay(dev))
return (ENXIO);
 
-   if (!ofw_bus_is_compatible(dev, "ti,am33xx-ehrpwm"))
+   if (!ofw_bus_search_compatible(dev, compat_data)->ocd_data)
return (ENXIO);
 
device_set_desc(dev, "AM335x EHRPWM");
@@ -365,7 +358,7 @@ am335x_ehrpwm_attach(device_t dev)
goto fail;
}
 
-   /* Init backlight interface */
+   /* Init sysctl interface */
ctx = device_get_sysctl_ctx(sc->sc_dev);
tree = device_get_sysctl_tree(sc->sc_dev);
 
@@ -441,6 +434,22 @@ am335x_ehrpwm_detach(device_t dev)
 
return (0);
 }
+
+static device_method_t am335x_ehrpwm_methods[] = {
+   DEVMETHOD(device_probe, am335x_ehrpwm_probe),
+   DEVMETHOD(device_attach,am335x_ehrpwm_attach),
+   DEVMETHOD(device_detach,am335x_ehrpwm_detach),
+
+   DEVMETHOD_END
+};
+
+static driver_t am335x_ehrpwm_driver = {
+   "pwm",
+   am335x_ehrpwm_methods,
+   sizeof(struct am335x_ehrpwm_softc),
+};
+
+static devclass_t am335x_ehrpwm_devclass;
 
 DRIVER_MODULE(am335x_ehrpwm, am335x_pwmss, am335x_ehrpwm_driver, 
am335x_ehrpwm_devclass, 0, 0);
 MODULE_VERSION(am335x_ehrpwm, 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: r348882 - head/sys/dev/sdhci

2019-06-21 Thread Luiz Otavio O Souza
On Fri, 14 Jun 2019 at 05:25, Bjoern A. Zeeb
 wrote:
>
> On 10 Jun 2019, at 21:50, Luiz Otavio O Souza wrote:
>
> > Author: loos
> > Date: Mon Jun 10 21:50:07 2019
> > New Revision: 348882
> > URL: https://svnweb.freebsd.org/changeset/base/348882
> >
> > Log:
> >   Add support for the GPIO SD Card VCC regulator/switch and the GPIO
> > SD Card
> >   detection pins to the Marvell Xenon SDHCI controller.
> >
> >   These features are enable by 'vqmmc-supply' and 'cd-gpios'
> > properties in the
> >   DTS.
> >
> >   This fixes the SD Card detection on espressobin.
>
> Do you have a copy or a reference to such a (working) dts file?

I'm using the in tree DTS for the espresso bin:
sys/gnu/dts/arm64/marvell/armada-3720-espressobin.dts

Now that it works, I think we could build it by default.

Luiz
___
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: r349268 - head/sys/dev/nand

2019-06-21 Thread Ed Maste
Author: emaste
Date: Fri Jun 21 13:42:40 2019
New Revision: 349268
URL: https://svnweb.freebsd.org/changeset/base/349268

Log:
  nandsim: correct test to avoid out-of-bounds access
  
  Previously nandsim_chip_status returned EINVAL iff both of user-provided
  chip->ctrl_num and chip->num were out of bounds.  If only one failed the
  bounds check arbitrary memory would be read and returned.
  
  The NAND framework is not built by default, nandsim is not intended for
  production use (it is a simulator), and the nandsim device has root-only
  permissions.
  
  admbugs:  827
  Reported by:  Daniel Hodson of elttam
  MFC after:3 days
  Security: kernel information leak or DoS
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/dev/nand/nandsim.c

Modified: head/sys/dev/nand/nandsim.c
==
--- head/sys/dev/nand/nandsim.c Fri Jun 21 10:54:51 2019(r349267)
+++ head/sys/dev/nand/nandsim.c Fri Jun 21 13:42:40 2019(r349268)
@@ -295,7 +295,7 @@ nandsim_chip_status(struct sim_chip *chip)
nand_debug(NDBG_SIM,"status for chip num:%d at ctrl:%d", chip->num,
chip->ctrl_num);
 
-   if (chip->ctrl_num >= MAX_SIM_DEV &&
+   if (chip->ctrl_num >= MAX_SIM_DEV ||
chip->num >= MAX_CTRL_CS)
return (EINVAL);
 
___
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: r349267 - in head: sbin/ipfw sys/netinet sys/netpfil/ipfw

2019-06-21 Thread Andrey V. Elsukov
Author: ae
Date: Fri Jun 21 10:54:51 2019
New Revision: 349267
URL: https://svnweb.freebsd.org/changeset/base/349267

Log:
  Add "tcpmss" opcode to match the TCP MSS value.
  
  With this opcode it is possible to match TCP packets with specified
  MSS option, whose value corresponds to configured in opcode value.
  It is allowed to specify single value, range of values, or array of
  specific values or ranges. E.g.
  
   # ipfw add deny log tcp from any to any tcpmss 0-500
  
  Reviewed by:  melifaro,bcr
  Obtained from:Yandex LLC
  MFC after:1 week
  Sponsored by: Yandex LLC

Modified:
  head/sbin/ipfw/ipfw.8
  head/sbin/ipfw/ipfw2.c
  head/sbin/ipfw/ipfw2.h
  head/sys/netinet/ip_fw.h
  head/sys/netpfil/ipfw/ip_fw2.c
  head/sys/netpfil/ipfw/ip_fw_sockopt.c

Modified: head/sbin/ipfw/ipfw.8
==
--- head/sbin/ipfw/ipfw.8   Fri Jun 21 07:58:08 2019(r349266)
+++ head/sbin/ipfw/ipfw.8   Fri Jun 21 10:54:51 2019(r349267)
@@ -1,7 +1,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd May 24, 2019
+.Dd June 21, 2019
 .Dt IPFW 8
 .Os
 .Sh NAME
@@ -1989,6 +1989,12 @@ a non-zero offset.
 See the
 .Cm frag
 option for details on matching fragmented packets.
+.It Cm tcpmss Ar tcpmss-list
+Matches TCP packets whose MSS (maximum segment size) value is set to
+.Ar tcpmss-list ,
+which is either a single value or a list of values or ranges
+specified in the same way as
+.Ar ports .
 .It Cm tcpseq Ar seq
 TCP packets only.
 Match if the TCP header sequence number field is set to

Modified: head/sbin/ipfw/ipfw2.c
==
--- head/sbin/ipfw/ipfw2.c  Fri Jun 21 07:58:08 2019(r349266)
+++ head/sbin/ipfw/ipfw2.c  Fri Jun 21 10:54:51 2019(r349267)
@@ -338,6 +338,7 @@ static struct _s_x rule_options[] = {
{ "tcpdatalen", TOK_TCPDATALEN },
{ "tcpflags",   TOK_TCPFLAGS },
{ "tcpflgs",TOK_TCPFLAGS },
+   { "tcpmss", TOK_TCPMSS },
{ "tcpoptions", TOK_TCPOPTS },
{ "tcpopts",TOK_TCPOPTS },
{ "tcpseq", TOK_TCPSEQ },
@@ -881,6 +882,7 @@ static struct _s_x _port_name[] = {
{"ipttl",   O_IPTTL},
{"mac-type",O_MAC_TYPE},
{"tcpdatalen",  O_TCPDATALEN},
+   {"tcpmss",  O_TCPMSS},
{"tcpwin",  O_TCPWIN},
{"tagged",  O_TAGGED},
{NULL,  0}
@@ -1588,6 +1590,7 @@ print_instruction(struct buf_pr *bp, const struct form
case O_IPTTL:
case O_IPLEN:
case O_TCPDATALEN:
+   case O_TCPMSS:
case O_TCPWIN:
if (F_LEN(cmd) == 1) {
switch (cmd->opcode) {
@@ -1603,6 +1606,9 @@ print_instruction(struct buf_pr *bp, const struct form
case O_TCPDATALEN:
s = "tcpdatalen";
break;
+   case O_TCPMSS:
+   s = "tcpmss";
+   break;
case O_TCPWIN:
s = "tcpwin";
break;
@@ -4709,14 +4715,18 @@ read_options:
av++;
break;
 
+   case TOK_TCPMSS:
case TOK_TCPWIN:
-   NEED1("tcpwin requires length");
+   NEED1("tcpmss/tcpwin requires size");
if (strpbrk(*av, "-,")) {
-   if (!add_ports(cmd, *av, 0, O_TCPWIN, cblen))
-   errx(EX_DATAERR, "invalid tcpwin len %s", *av);
+   if (add_ports(cmd, *av, 0,
+   i == TOK_TCPWIN ? O_TCPWIN : O_TCPMSS,
+   cblen) == NULL)
+   errx(EX_DATAERR, "invalid %s size %s",
+   s, *av);
} else
-   fill_cmd(cmd, O_TCPWIN, 0,
-   strtoul(*av, NULL, 0));
+   fill_cmd(cmd, i == TOK_TCPWIN ? O_TCPWIN :
+   O_TCPMSS, 0, strtoul(*av, NULL, 0));
av++;
break;
 

Modified: head/sbin/ipfw/ipfw2.h
==
--- head/sbin/ipfw/ipfw2.h  Fri Jun 21 07:58:08 2019(r349266)
+++ head/sbin/ipfw/ipfw2.h  Fri Jun 21 10:54:51 2019(r349267)
@@ -151,6 +151,7 @@ enum tokens {
TOK_TCPOPTS,
TOK_TCPSEQ,
TOK_TCPACK,
+   TOK_TCPMSS,
TOK_TCPWIN,
TOK_ICMPTYPES,
TOK_MAC,

Modified: head/sys/netinet/ip_fw.h
==
--- 

Re: svn commit: r349248 - in head/sys: fs/fifofs kern sys

2019-06-21 Thread Bruce Evans

On Thu, 20 Jun 2019, Alan Somers wrote:


Log:
 fcntl: fix overflow when setting F_READAHEAD

 VOP_READ and VOP_WRITE take the seqcount in blocks in a 16-bit field.
 However, fcntl allows you to set the seqcount in bytes to any nonnegative
 31-bit value. The result can be a 16-bit overflow, which will be
 sign-extended in functions like ffs_read. Fix this by sanitizing the
 argument in kern_fcntl. As a matter of policy, limit to IO_SEQMAX rather
 than INT16_MAX.
...
Modified: head/sys/kern/vfs_vnops.c
==
--- head/sys/kern/vfs_vnops.c   Thu Jun 20 22:21:42 2019(r349247)
+++ head/sys/kern/vfs_vnops.c   Thu Jun 20 23:07:20 2019(r349248)
@@ -499,7 +499,8 @@ sequential_heuristic(struct uio *uio, struct file *fp)
 * closely related to the best I/O size for real disks than
 * to any block size used by software.
 */
-   fp->f_seqcount += howmany(uio->uio_resid, 16384);
+   fp->f_seqcount += MIN(IO_SEQMAX,
+   howmany(uio->uio_resid, 16384));
if (fp->f_seqcount > IO_SEQMAX)
fp->f_seqcount = IO_SEQMAX;


This already limited the result to IO_SEQMAX.  Now it limits the result to
IO_SEQMAX twice.

Using MIN() is a style bug.  4.4BSD removed the MIN() macro from the kernel
and replaced it by *min() inline functions.  MIN() was restored because
too much contribed code used it, but it should not be used in core code.

However, *min() is not type-generic, so it is hard to use.  Using

f_seqcount = imin(IO_SEQMAX, howmany(uio->uio_resid, 16384));

would restore the overflow bug.  This code worked originally when uio_resid
had type int.  It was broken by changing uio_resid's type to ssize_t.
This makes howmany(uio->uio_resid, 16384) have type ssize_t too, and its
value overflows on assignment to "int f_seqcount" before the value is
clamped to IO_SEQMAX, whenever uio_resid is especially preposterously
large (2G * 16384) on 64-bit systems which pretend to support such silly
i/o sizes.

imin() is as bad as the blind assignment to an int, since its prototype
cause blind conversion to int.  I have some macros for *min() which
optionally detect such type errors or just do much the same as MIN()
(but using inline functions), but these are not quite of production
quality.  The case where one arg has a signed type and the other arg
has a signed type is hardest to handle.  This has sign extension or
unsign extension bugs in general.  MIN() blindly does the extension.


The overflow usually only causes negative f_seqcount which should be
treated as 0.


return (fp->f_seqcount << IO_SEQSHIFT);

Modified: head/sys/sys/file.h
==
--- head/sys/sys/file.h Thu Jun 20 22:21:42 2019(r349247)
+++ head/sys/sys/file.h Thu Jun 20 23:07:20 2019(r349248)
@@ -179,7 +179,10 @@ struct file {
/*
 *  DTYPE_VNODE specific fields.
 */
-   int f_seqcount; /* (a) Count of sequential accesses. */
+   union {
+   int16_t f_seqcount; /* (a) Count of sequential accesses. */
+   int f_pipegen;
+   };
off_t   f_nextoff;  /* next expected read/write offset. */
union {
struct cdev_privdata *fvn_cdevpriv;


f_seqcount should still have type int.  Conversion of any type smaller than
int to int just wastes time, and int16_t is a bogus type for holding values
limited to 0x7F.

int for f_seqcount costs no space, since f_pipegen still has the correct
type and the union is padded to at least the size of its largest member.

This struct has delicate ordering which usually minimizes padding,
although it violates style(9) for most integer members.  Before
f_seqcount, there are some pointers, then 2 shorts and 2 u_int's, so
64-bit alignment occurs after f_seqcount on 64-bit arches, just in
time for there to be no padding before the 64-bit f_offset.  style(9)
requires sorting all the 64-bit types first.

My macros look like:

XX #define __min(x, y)  \
XX (\
XX  (sizeof(x) == 8 || sizeof(y) == 8) ?\
XX  ((__typeof(x))-1 == -1 && (__typeof(y))-1 == -1) ?  \
XX  _qmin((x), (y)) \
XX  :   \
XX  _uqmin((x), (y))\
XX  :   \
XX  ((__typeof(x))-1 == -1 && (__typeof(y))-1 == -1) ?  \
XX  _imin((x), (y)) \
XX  :  

Re: svn commit: r349233 - head/sys/sys

2019-06-21 Thread Bruce Evans

On Thu, 20 Jun 2019, Warner Losh wrote:


On Thu, Jun 20, 2019, 11:44 AM Bruce Evans  wrote:


On Thu, 20 Jun 2019, Alan Somers wrote:


On Thu, Jun 20, 2019 at 10:43 AM Bruce Evans 

wrote:

Summary:  and the headers that it includes should declare
minimal types to compile (so __int64_t is enough).  Most uses of this
header require including domain-specific headers which declare the
relevant data structures.


Bruce, would you be satisfied by switching from  to
 and from int64_t to __int64_t?


Not quite.  The kernel block number type is daddr_t, and [__]int64_t is
a hard coding of that.  Hard-coding of typedefs is good for reducing
namespace pollution, but it is not done for the nearby use of off_t.

Unfortunately, daddr_t is only declared in .

[... related type/units errors in ffs and ext2fs]
Using a generic int64_t type in all interfaces would avoid some of these
bugs, so I don't mind using it for the API.  Just add a note that it must
be large enough to represent all useful values of daddr_t.


Maybe we should add a __daddr_t define to sys/_types.h? And the usual
reshuffling. That would also fix the namespace pollution.


OK.  ABI's should use only fixed-width types to be stable, and APIs should
use only basic types to be stable, but avoiding typedefs (except to fixed-
width types) would be a larger project, with few existing examples.

Bruce
___
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: r349266 - head/sys/netinet

2019-06-21 Thread Kristof Provost
Author: kp
Date: Fri Jun 21 07:58:08 2019
New Revision: 349266
URL: https://svnweb.freebsd.org/changeset/base/349266

Log:
  ip_output: pass PFIL_FWD in the slow path
  
  If we take the slow path for forwarding we should still tell our
  firewalls (hooked through pfil(9)) that we're forwarding. Pass the
  ip_output() flags to ip_output_pfil() so it can set the PFIL_FWD flag
  when we're forwarding.
  
  MFC after:1 week
  Sponsored by: Axiado

Modified:
  head/sys/netinet/ip_output.c

Modified: head/sys/netinet/ip_output.c
==
--- head/sys/netinet/ip_output.cFri Jun 21 07:45:58 2019
(r349265)
+++ head/sys/netinet/ip_output.cFri Jun 21 07:58:08 2019
(r349266)
@@ -109,20 +109,24 @@ extern int in_mcast_loop;
 extern struct protosw inetsw[];
 
 static inline int
-ip_output_pfil(struct mbuf **mp, struct ifnet *ifp, struct inpcb *inp,
-struct sockaddr_in *dst, int *fibnum, int *error)
+ip_output_pfil(struct mbuf **mp, struct ifnet *ifp, int flags,
+struct inpcb *inp, struct sockaddr_in *dst, int *fibnum, int *error)
 {
struct m_tag *fwd_tag = NULL;
struct mbuf *m;
struct in_addr odst;
struct ip *ip;
+   int pflags = PFIL_OUT;
 
+   if (flags & IP_FORWARDING)
+   pflags |= PFIL_FWD;
+
m = *mp;
ip = mtod(m, struct ip *);
 
/* Run through list of hooks for output packets. */
odst.s_addr = ip->ip_dst.s_addr;
-   switch (pfil_run_hooks(V_inet_pfil_head, mp, ifp, PFIL_OUT, inp)) {
+   switch (pfil_run_hooks(V_inet_pfil_head, mp, ifp, pflags, inp)) {
case PFIL_DROPPED:
*error = EPERM;
/* FALLTHROUGH */
@@ -653,7 +657,8 @@ sendit:
 
/* Jump over all PFIL processing if hooks are not active. */
if (PFIL_HOOKED_OUT(V_inet_pfil_head)) {
-   switch (ip_output_pfil(, ifp, inp, dst, , )) {
+   switch (ip_output_pfil(, ifp, flags, inp, dst, ,
+   )) {
case 1: /* Finished */
goto done;
 
___
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: r349265 - head/usr.sbin/bsnmpd/modules/snmp_lm75

2019-06-21 Thread Shteryana Shopova
Author: syrinx
Date: Fri Jun 21 07:45:58 2019
New Revision: 349265
URL: https://svnweb.freebsd.org/changeset/base/349265

Log:
  No need for each bsnmpd(1) module to open connection to syslog
  
  bsnmpd(1) main does that early on init and the connection is available
  to all loaded modules
  
  Event:Vienna Hackathon 2019
  PR:   233431 , 221487
  MFC after:2 weeks

Modified:
  head/usr.sbin/bsnmpd/modules/snmp_lm75/snmp_lm75.c

Modified: head/usr.sbin/bsnmpd/modules/snmp_lm75/snmp_lm75.c
==
--- head/usr.sbin/bsnmpd/modules/snmp_lm75/snmp_lm75.c  Fri Jun 21 07:29:02 
2019(r349264)
+++ head/usr.sbin/bsnmpd/modules/snmp_lm75/snmp_lm75.c  Fri Jun 21 07:45:58 
2019(r349265)
@@ -100,7 +100,6 @@ lm75_init(struct lmodule *mod, int argc __unused, char
module = mod;
 
lm75_sensors = 0;
-   openlog("snmp_lm75", LOG_NDELAY | LOG_PID, LOG_DAEMON);
 
return(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: r349264 - head/usr.sbin/bsnmpd/modules/snmp_pf

2019-06-21 Thread Shteryana Shopova
Author: syrinx
Date: Fri Jun 21 07:29:02 2019
New Revision: 349264
URL: https://svnweb.freebsd.org/changeset/base/349264

Log:
  Unbreak snmp_pf(3) after the changes introduced in r338209
  
  PR:   237011
  Event:Vienna Hackathon 2019
  MFC after:2 weeks

Modified:
  head/usr.sbin/bsnmpd/modules/snmp_pf/pf_snmp.c
  head/usr.sbin/bsnmpd/modules/snmp_pf/pf_tree.def

Modified: head/usr.sbin/bsnmpd/modules/snmp_pf/pf_snmp.c
==
--- head/usr.sbin/bsnmpd/modules/snmp_pf/pf_snmp.c  Fri Jun 21 04:57:23 
2019(r349263)
+++ head/usr.sbin/bsnmpd/modules/snmp_pf/pf_snmp.c  Fri Jun 21 07:29:02 
2019(r349264)
@@ -907,7 +907,7 @@ pf_tbladdr(struct snmp_context __unused *ctx, struct s
 }
 
 int
-pf_altq(struct snmp_context __unused *ctx, struct snmp_value *val,
+pf_altq_num(struct snmp_context __unused *ctx, struct snmp_value *val,
u_int sub, u_int __unused vindex, enum snmp_op op)
 {
asn_subid_t which = val->var.subs[sub - 1];

Modified: head/usr.sbin/bsnmpd/modules/snmp_pf/pf_tree.def
==
--- head/usr.sbin/bsnmpd/modules/snmp_pf/pf_tree.defFri Jun 21 04:57:23 
2019(r349263)
+++ head/usr.sbin/bsnmpd/modules/snmp_pf/pf_tree.defFri Jun 21 07:29:02 
2019(r349264)
@@ -174,7 +174,7 @@
)
  )
  (10 pfAltq
-   (1 pfAltqQueueNumber INTEGER32 pf_altq GET)
+   (1 pfAltqQueueNumber INTEGER32 pf_altq_num GET)
(2 pfAltqQueueTable
  (1 pfAltqQueueEntry : INTEGER32 pf_altqq
(1 pfAltqQueueIndex INTEGER32)
___
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"