svn commit: r310352 - head/usr.sbin/syslogd

2016-12-20 Thread Hiroki Sato
Author: hrs
Date: Wed Dec 21 07:05:34 2016
New Revision: 310352
URL: https://svnweb.freebsd.org/changeset/base/310352

Log:
  Simplify type casting of struct sockaddr_in.

Modified:
  head/usr.sbin/syslogd/syslogd.c

Modified: head/usr.sbin/syslogd/syslogd.c
==
--- head/usr.sbin/syslogd/syslogd.c Wed Dec 21 06:49:21 2016
(r310351)
+++ head/usr.sbin/syslogd/syslogd.c Wed Dec 21 07:05:34 2016
(r310352)
@@ -128,6 +128,7 @@ static const char include_ext[] = ".conf
 
 #definesstosa(ss)  ((struct sockaddr *)(ss))
 #definesatosin6(sa)((struct sockaddr_in6 *)(void *)(sa))
+#definesstosin(ss) ((struct sockaddr_in *)(ss))
 #definesatosin(sa) ((struct sockaddr_in *)(void *)(sa))
 #defines6_addr32   __u6_addr.__u6_addr32
 #defineIN6_ARE_MASKED_ADDR_EQUAL(d, a, m)  (   \
@@ -2368,7 +2369,7 @@ allowaddr(char *s)
struct servent *se;
int masklen = -1;
struct addrinfo hints, *res;
-   struct in_addr *addrp, *maskp;
+   in_addr_t *addrp, *maskp;
 #ifdef INET6
int i;
u_int32_t *addr6p, *mask6p;
@@ -2434,28 +2435,27 @@ allowaddr(char *s)
ap->a_mask.ss_family = res->ai_family;
if (res->ai_family == AF_INET) {
ap->a_mask.ss_len = sizeof(struct sockaddr_in);
-   maskp = &((struct sockaddr_in *)>a_mask)->sin_addr;
-   addrp = &((struct sockaddr_in *)>a_addr)->sin_addr;
+   maskp = (>a_mask)->sin_addr.s_addr;
+   addrp = (>a_addr)->sin_addr.s_addr;
if (masklen < 0) {
/* use default netmask */
-   if (IN_CLASSA(ntohl(addrp->s_addr)))
-   maskp->s_addr = htonl(IN_CLASSA_NET);
-   else if (IN_CLASSB(ntohl(addrp->s_addr)))
-   maskp->s_addr = htonl(IN_CLASSB_NET);
+   if (IN_CLASSA(ntohl(*addrp)))
+   *maskp = htonl(IN_CLASSA_NET);
+   else if (IN_CLASSB(ntohl(*addrp)))
+   *maskp = htonl(IN_CLASSB_NET);
else
-   maskp->s_addr = htonl(IN_CLASSC_NET);
+   *maskp = htonl(IN_CLASSC_NET);
+   } else if (masklen == 0) {
+   *maskp = 0;
} else if (masklen <= 32) {
/* convert masklen to netmask */
-   if (masklen == 0)
-   maskp->s_addr = 0;
-   else
-   maskp->s_addr = htonl(~((1 << (32 - 
masklen)) - 1));
+   *maskp = htonl(~((1 << (32 - masklen)) - 1));
} else {
freeaddrinfo(res);
return (-1);
}
/* Lose any host bits in the network number. */
-   addrp->s_addr &= maskp->s_addr;
+   *addrp &= *maskp;
}
 #ifdef INET6
else if (res->ai_family == AF_INET6 && masklen <= 128) {
___
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: r310351 - head/usr.sbin/syslogd

2016-12-20 Thread Hiroki Sato
Author: hrs
Date: Wed Dec 21 06:49:21 2016
New Revision: 310351
URL: https://svnweb.freebsd.org/changeset/base/310351

Log:
  - Initialize deadq_head statically.
  - Fix indent.
  - Add missing -S flag into usage().
  - Use nitems() for an iov array instead of a macro.

Modified:
  head/usr.sbin/syslogd/syslogd.c

Modified: head/usr.sbin/syslogd/syslogd.c
==
--- head/usr.sbin/syslogd/syslogd.c Wed Dec 21 06:42:30 2016
(r310350)
+++ head/usr.sbin/syslogd/syslogd.c Wed Dec 21 06:49:21 2016
(r310351)
@@ -223,7 +223,8 @@ struct deadq_entry {
int dq_timeout;
TAILQ_ENTRY(deadq_entry)dq_entries;
 };
-static TAILQ_HEAD(, deadq_entry) deadq_head;
+static TAILQ_HEAD(, deadq_entry) deadq_head =
+TAILQ_HEAD_INITIALIZER(deadq_head);
 
 /*
  * The timeout to apply to processes waiting on the dead queue.  Unit
@@ -264,11 +265,12 @@ static STAILQ_HEAD(, allowedpeer) aphead
  * we move to the next interval until we reach the largest.
  */
 static int repeatinterval[] = { 30, 120, 600 };/* # of secs before 
flush */
-#defineMAXREPEAT ((sizeof(repeatinterval) / sizeof(repeatinterval[0])) 
- 1)
+#defineMAXREPEAT   (nitems(repeatinterval) - 1)
 #defineREPEATTIME(f)   ((f)->f_time + 
repeatinterval[(f)->f_repeatcount])
-#defineBACKOFF(f)  { if (++(f)->f_repeatcount > MAXREPEAT) \
-(f)->f_repeatcount = MAXREPEAT; \
-   }
+#defineBACKOFF(f)  do {
\
+   if (++(f)->f_repeatcount > MAXREPEAT)   \
+   (f)->f_repeatcount = MAXREPEAT; \
+   } while (0)
 
 /* values for f_type */
 #define F_UNUSED   0   /* unused entry */
@@ -637,8 +639,6 @@ main(int argc, char *argv[])
(void)signal(SIGPIPE, SIG_IGN); /* We'll catch EPIPE instead. */
(void)alarm(TIMERINTVL);
 
-   TAILQ_INIT(_head);
-
/* tuck my process id away */
pidfile_write(pfh);
 
@@ -772,11 +772,12 @@ static void
 usage(void)
 {
 
-   fprintf(stderr, "%s\n%s\n%s\n%s\n",
+   fprintf(stderr, "%s\n%s\n%s\n%s\n%s\n",
"usage: syslogd [-468ACcdFknosTuv] [-a allowed_peer]",
"   [-b bind_address] [-f config_file]",
"   [-l [mode:]path] [-m mark_interval]",
-   "   [-P pid_file] [-p log_socket]");
+   "   [-P pid_file] [-p log_socket]",
+   "   [-S logpriv_socket]");
exit(1);
 }
 
@@ -1325,7 +1326,7 @@ fprintlog(struct filed *f, int flags, co
dprintf(" %s\n", f->fu_fname);
v->iov_base = lf;
v->iov_len = 1;
-   if (writev(f->f_file, iov, IOV_SIZE) < 0) {
+   if (writev(f->f_file, iov, nitems(iov)) < 0) {
/*
 * If writev(2) fails for potentially transient errors
 * like the filesystem being full, ignore it.
@@ -1355,7 +1356,7 @@ fprintlog(struct filed *f, int flags, co
break;
}
}
-   if (writev(f->f_file, iov, IOV_SIZE) < 0) {
+   if (writev(f->f_file, iov, nitems(iov)) < 0) {
int e = errno;
close_filed(f);
if (f->fu_pipe_pid > 0)
@@ -1380,7 +1381,7 @@ fprintlog(struct filed *f, int flags, co
v->iov_len = 2;
 
errno = 0;  /* ttymsg() only sometimes returns an errno */
-   if ((msgret = ttymsg(iov, IOV_SIZE, f->fu_fname, 10))) {
+   if ((msgret = ttymsg(iov, nitems(iov), f->fu_fname, 10))) {
f->f_type = F_UNUSED;
logerror(msgret);
}
@@ -1391,7 +1392,7 @@ fprintlog(struct filed *f, int flags, co
dprintf("\n");
v->iov_base = crlf;
v->iov_len = 2;
-   wallmsg(f, iov, IOV_SIZE);
+   wallmsg(f, iov, nitems(iov));
break;
}
f->f_prevcount = 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: r310350 - head/usr.sbin/syslogd

2016-12-20 Thread Hiroki Sato
Author: hrs
Date: Wed Dec 21 06:42:30 2016
New Revision: 310350
URL: https://svnweb.freebsd.org/changeset/base/310350

Log:
  - Add fklog into struct socklist.  Files and local/remote sockets are
now processed in struct socklist in a consistent manner.
  - Add helper functions to add a new entry of struct socklist, filed, or peer.
  - Use the same routine for -l, -p, and -S.
  - Close /dev/klog when read(2) failed.

Modified:
  head/usr.sbin/syslogd/syslogd.c

Modified: head/usr.sbin/syslogd/syslogd.c
==
--- head/usr.sbin/syslogd/syslogd.c Wed Dec 21 05:45:59 2016
(r310349)
+++ head/usr.sbin/syslogd/syslogd.c Wed Dec 21 06:42:30 2016
(r310350)
@@ -144,29 +144,17 @@ struct peer {
mode_t  pe_mode;
STAILQ_ENTRY(peer)  next;
 };
+static STAILQ_HEAD(, peer) pqueue = STAILQ_HEAD_INITIALIZER(pqueue);
+
 struct socklist {
struct sockaddr_storage sl_ss;
int sl_socket;
struct peer *sl_peer;
+   int (*sl_recv)(struct socklist *);
STAILQ_ENTRY(socklist)  next;
 };
 static STAILQ_HEAD(, socklist) shead = STAILQ_HEAD_INITIALIZER(shead);
 
-static struct peer funix_secure = {
-   .pe_name = _PATH_LOG_PRIV,
-   .pe_mode = S_IRUSR | S_IWUSR,
-   .next = {NULL},
-};
-static struct peer funix_default = {
-   .pe_name = _PATH_LOG,
-   .pe_mode = DEFFILEMODE,
-   .next = {_secure},
-};
-static STAILQ_HEAD(, peer) pqueue = {
-   _default,
-   _secure.next.stqe_next,
-};
-
 /*
  * Flags to logmsg().
  */
@@ -306,7 +294,6 @@ static int  Foreground = 0; /* Run in for
 static int resolve = 1;/* resolve hostname */
 static charLocalHostName[MAXHOSTNAMELEN];  /* our hostname */
 static const char *LocalDomain;/* our local domain name */
-static int fklog = -1; /* /dev/klog */
 static int Initialized;/* set when we have initialized ourselves */
 static int MarkInterval = 20 * 60; /* interval between marks in seconds */
 static int MarkSeq;/* mark sequence number */
@@ -337,8 +324,10 @@ static struct pidfh *pfh;
 static volatile sig_atomic_t MarkSet, WantDie;
 
 static int allowaddr(char *);
-static voidcfline(const char *, struct filed *,
-   const char *, const char *);
+static int addfile(struct filed *);
+static int addpeer(struct peer *);
+static int addsock(struct sockaddr *, socklen_t, struct socklist *);
+static struct filed *cfline(const char *, const char *, const char *);
 static const char *cvthname(struct sockaddr *);
 static voiddeadq_enter(pid_t, const char *);
 static int deadq_remove(pid_t);
@@ -354,11 +343,12 @@ static void   logmsg(int, const char *, co
 static voidlog_deadchild(pid_t, int, const char *);
 static voidmarkit(void);
 static int socksetup(struct peer *);
+static int socklist_recv_file(struct socklist *);
+static int socklist_recv_sock(struct socklist *);
 static int skip_message(const char *, const char *, int);
 static voidprintline(const char *, char *, int);
 static voidprintsys(char *);
 static int p_open(const char *, pid_t *);
-static voidreadklog(void);
 static voidreapchild(int);
 static const char *ttymsg_check(struct iovec *, int, char *, int);
 static voidusage(void);
@@ -381,21 +371,61 @@ close_filed(struct filed *f)
f->f_type = F_UNUSED;
 }
 
+static int
+addfile(struct filed *f0)
+{
+   struct filed *f;
+
+   f = calloc(1, sizeof(*f));
+   if (f == NULL)
+   err(1, "malloc failed");
+   *f = *f0;
+   STAILQ_INSERT_TAIL(, f, next);
+
+   return (0);
+}
+
+static int
+addpeer(struct peer *pe0)
+{
+   struct peer *pe;
+
+   pe = calloc(1, sizeof(*pe));
+   if (pe == NULL)
+   err(1, "malloc failed");
+   *pe = *pe0;
+   STAILQ_INSERT_TAIL(, pe, next);
+
+   return (0);
+}
+
+static int
+addsock(struct sockaddr *sa, socklen_t sa_len, struct socklist *sl0)
+{
+   struct socklist *sl;
+
+   sl = calloc(1, sizeof(*sl));
+   if (sl == NULL)
+   err(1, "malloc failed");
+   *sl = *sl0;
+   if (sa != NULL && sa_len > 0)
+   memcpy(>sl_ss, sa, sa_len);
+   STAILQ_INSERT_TAIL(, sl, next);
+
+   return (0);
+}
+
 int
 main(int argc, char *argv[])
 {
-   int ch, i, fdsrmax = 0, bflag = 0;
-   struct sockaddr_storage ss;
+   int ch, i, s, fdsrmax = 0, bflag = 0, pflag = 0, Sflag = 0;
fd_set *fdsr = NULL;
-   char line[MAXLINE + 1];
-   const char *hname;
struct timeval tv, *tvp;
struct sigaction sact;
struct peer *pe;
struct socklist *sl;
sigset_t mask;
pid_t ppid = 1, spid;
-   socklen_t sslen;
char *p;
 
if (madvise(NULL, 0, MADV_PROTECT) != 0)
@@ -425,21 +455,22 @@ main(int argc, char 

Re: svn commit: r310336 - head/sys/kern

2016-12-20 Thread Julian Elischer

On 21/12/2016 3:44 AM, John Baldwin wrote:

Author: jhb
Date: Tue Dec 20 19:44:44 2016
New Revision: 310336
URL: https://svnweb.freebsd.org/changeset/base/310336

Log:
   Don't spin in pause() during early boot for kthreads other than thread0.
   
   pause() uses a spin loop to simulate a sleep during early boot.  However,

   we only need this for thread0 to get far enough in the boot process to
   enable timers (at which point pause() can sleep).  For other kthreads,
   sleeping in pause() is ok as the callout will be scheduled and will
   eventually fire once thread0 initializes timers.


maybe we just need to depend on a variable "have_timers"
that is independent of the cold/hot/whatever  settings.
first code to enable a timer sets it.

   
   Tested by: 	Steven Kargl

   Sleuthing by:markj
   MFC after:   1 week
   Sponsored by:Netflix

Modified:
   head/sys/kern/kern_synch.c

Modified: head/sys/kern/kern_synch.c
==
--- head/sys/kern/kern_synch.c  Tue Dec 20 19:30:21 2016(r310335)
+++ head/sys/kern/kern_synch.c  Tue Dec 20 19:44:44 2016(r310336)
@@ -321,7 +321,8 @@ pause_sbt(const char *wmesg, sbintime_t
if (sbt == 0)
sbt = tick_sbt;
  
-	if (cold || kdb_active || SCHEDULER_STOPPED()) {

+   if ((cold && curthread == ) || kdb_active ||
+   SCHEDULER_STOPPED()) {
/*
 * We delay one second at a time to avoid overflowing the
 * system specific DELAY() function(s):




___
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: r310349 - head/usr.sbin/syslogd

2016-12-20 Thread Hiroki Sato
Author: hrs
Date: Wed Dec 21 05:45:59 2016
New Revision: 310349
URL: https://svnweb.freebsd.org/changeset/base/310349

Log:
  - Use fnmatch(3) for domanname matching of -a options.
  - Document the patten matching.
  - Document -S flag in SYNOPSIS.

Modified:
  head/usr.sbin/syslogd/syslogd.8
  head/usr.sbin/syslogd/syslogd.c

Modified: head/usr.sbin/syslogd/syslogd.8
==
--- head/usr.sbin/syslogd/syslogd.8 Wed Dec 21 03:23:35 2016
(r310348)
+++ head/usr.sbin/syslogd/syslogd.8 Wed Dec 21 05:45:59 2016
(r310349)
@@ -28,7 +28,7 @@
 .\" @(#)syslogd.8  8.1 (Berkeley) 6/6/93
 .\" $FreeBSD$
 .\"
-.Dd June 16, 2015
+.Dd December 21, 2016
 .Dt SYSLOGD 8
 .Os
 .Sh NAME
@@ -44,6 +44,7 @@
 .Op Fl m Ar mark_interval
 .Op Fl P Ar pid_file
 .Op Fl p Ar log_socket
+.Op Fl S Ar logpriv_socket
 .Sh DESCRIPTION
 The
 .Nm
@@ -154,16 +155,9 @@ for the sender address.
 The meaning of
 .Ar service
 is as explained above.
-.It Xo
-.Sm off
-.No * Ar domainname Op \&: Ar service
-.Sm on
-.Xc
-Same as before, except that any source host whose name
-.Em ends
-in
 .Ar domainname
-will get permission.
+can contain special characters of a shell-style pattern such as
+.Ql Li \&* .
 .El
 .Pp
 The

Modified: head/usr.sbin/syslogd/syslogd.c
==
--- head/usr.sbin/syslogd/syslogd.c Wed Dec 21 03:23:35 2016
(r310348)
+++ head/usr.sbin/syslogd/syslogd.c Wed Dec 21 05:45:59 2016
(r310349)
@@ -98,6 +98,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -2476,8 +2477,7 @@ static int
 validate(struct sockaddr *sa, const char *hname)
 {
int i;
-   size_t l1, l2;
-   char *cp, name[NI_MAXHOST], ip[NI_MAXHOST], port[NI_MAXSERV];
+   char name[NI_MAXHOST], ip[NI_MAXHOST], port[NI_MAXSERV];
struct allowedpeer *ap;
struct sockaddr_in *sin4, *a4p = NULL, *m4p = NULL;
 #ifdef INET6
@@ -2558,23 +2558,11 @@ validate(struct sockaddr *sa, const char
else
continue;
} else {
-   cp = ap->a_name;
-   l1 = strlen(name);
-   if (*cp == '*') {
-   /* allow wildmatch */
-   cp++;
-   l2 = strlen(cp);
-   if (l2 > l1 || memcmp(cp, [l1 - l2], l2) 
!= 0) {
-   dprintf("rejected in rule %d due to 
name mismatch.\n", i);
-   continue;
-   }
-   } else {
-   /* exact match */
-   l2 = strlen(cp);
-   if (l2 != l1 || memcmp(cp, name, l1) != 0) {
-   dprintf("rejected in rule %d due to 
name mismatch.\n", i);
-   continue;
-   }
+   if (fnmatch(ap->a_name, name, FNM_NOESCAPE) ==
+   FNM_NOMATCH) {
+   dprintf("rejected in rule %d due to name "
+   "mismatch.\n", i);
+   continue;
}
}
dprintf("accepted in rule %d.\n", i);
___
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: r310348 - head/sys/dev/hyperv/vmbus

2016-12-20 Thread Sepherosa Ziehau
Author: sephe
Date: Wed Dec 21 03:23:35 2016
New Revision: 310348
URL: https://svnweb.freebsd.org/changeset/base/310348

Log:
  hyperv: Unbreak EARLY_AP_STARUP Hyper-V bootstrap by using intrhook
  
  Properly working pause and friends are required.
  
  MFC after:3 days
  Sponsored by: Microsoft

Modified:
  head/sys/dev/hyperv/vmbus/vmbus.c
  head/sys/dev/hyperv/vmbus/vmbus_var.h

Modified: head/sys/dev/hyperv/vmbus/vmbus.c
==
--- head/sys/dev/hyperv/vmbus/vmbus.c   Wed Dec 21 03:09:07 2016
(r310347)
+++ head/sys/dev/hyperv/vmbus/vmbus.c   Wed Dec 21 03:23:35 2016
(r310348)
@@ -99,6 +99,9 @@ static uint32_t   vmbus_get_vcpu_id_meth
device_t dev, int cpu);
 static struct taskqueue*vmbus_get_eventtq_method(device_t, 
device_t,
int);
+#ifdef EARLY_AP_STARTUP
+static voidvmbus_intrhook(void *);
+#endif
 
 static int vmbus_init(struct vmbus_softc *);
 static int vmbus_connect(struct vmbus_softc *, uint32_t);
@@ -1402,6 +1405,21 @@ vmbus_event_proc_dummy(struct vmbus_soft
 {
 }
 
+#ifdef EARLY_AP_STARTUP
+
+static void
+vmbus_intrhook(void *xsc)
+{
+   struct vmbus_softc *sc = xsc;
+
+   if (bootverbose)
+   device_printf(sc->vmbus_dev, "intrhook\n");
+   vmbus_doattach(sc);
+   config_intrhook_disestablish(>vmbus_intrhook);
+}
+
+#endif /* EARLY_AP_STARTUP */
+
 static int
 vmbus_attach(device_t dev)
 {
@@ -1416,7 +1434,14 @@ vmbus_attach(device_t dev)
 */
vmbus_sc->vmbus_event_proc = vmbus_event_proc_dummy;
 
-#ifndef EARLY_AP_STARTUP
+#ifdef EARLY_AP_STARTUP
+   /*
+* Defer the real attach until the pause(9) works as expected.
+*/
+   vmbus_sc->vmbus_intrhook.ich_func = vmbus_intrhook;
+   vmbus_sc->vmbus_intrhook.ich_arg = vmbus_sc;
+   config_intrhook_establish(_sc->vmbus_intrhook);
+#else  /* !EARLY_AP_STARTUP */
/* 
 * If the system has already booted and thread
 * scheduling is possible indicated by the global
@@ -1424,8 +1449,8 @@ vmbus_attach(device_t dev)
 * initialization directly.
 */
if (!cold)
-#endif
vmbus_doattach(vmbus_sc);
+#endif /* EARLY_AP_STARTUP */
 
return (0);
 }

Modified: head/sys/dev/hyperv/vmbus/vmbus_var.h
==
--- head/sys/dev/hyperv/vmbus/vmbus_var.h   Wed Dec 21 03:09:07 2016
(r310347)
+++ head/sys/dev/hyperv/vmbus/vmbus_var.h   Wed Dec 21 03:23:35 2016
(r310348)
@@ -30,6 +30,7 @@
 #define _VMBUS_VAR_H_
 
 #include 
+#include 
 #include 
 #include 
 
@@ -128,6 +129,8 @@ struct vmbus_softc {
struct mtx  vmbus_chan_lock;
TAILQ_HEAD(, vmbus_channel) vmbus_chans;
 
+   struct intr_config_hook vmbus_intrhook;
+
 #ifdef NEW_PCIB
/* The list of usable MMIO ranges for PCIe pass-through */
struct pcib_host_resources vmbus_mmio_res;
___
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: r310347 - head/sys/dev/hyperv/storvsc

2016-12-20 Thread Sepherosa Ziehau
Author: sephe
Date: Wed Dec 21 03:09:07 2016
New Revision: 310347
URL: https://svnweb.freebsd.org/changeset/base/310347

Log:
  hyperv/storvsc: The max channel in PDU actually means the max sub-chans.
  
  Use proper name for local variables. PDU fields' name was not changed yet.
  While I'm here, make # of usable channels tunable. This eases further
  testing.
  
  MFC after:1 week
  Sponsored by: Microsoft
  Differential Revision:https://reviews.freebsd.org/D8851

Modified:
  head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c

Modified: head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c
==
--- head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.cWed Dec 21 
01:48:54 2016(r310346)
+++ head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.cWed Dec 21 
03:09:07 2016(r310347)
@@ -147,6 +147,10 @@ static u_int hv_storvsc_max_io = 512;
 SYSCTL_UINT(_hw_storvsc, OID_AUTO, max_io, CTLFLAG_RDTUN,
_storvsc_max_io, 0, "Hyper-V storage max io limit");
 
+static int hv_storvsc_chan_cnt = 0;
+SYSCTL_INT(_hw_storvsc, OID_AUTO, chan_cnt, CTLFLAG_RDTUN,
+   _storvsc_chan_cnt, 0, "# of channels to use");
+
 #define STORVSC_MAX_IO \
vmbus_chan_prplist_nelem(hv_storvsc_ringbuffer_size,\
   STORVSC_DATA_SEGCNT_MAX, VSTOR_PKT_SIZE)
@@ -385,16 +389,16 @@ storvsc_subchan_attach(struct storvsc_so
  * @param max_chans  the max channels supported by vmbus
  */
 static void
-storvsc_send_multichannel_request(struct storvsc_softc *sc, int max_chans)
+storvsc_send_multichannel_request(struct storvsc_softc *sc, int max_subch)
 {
struct vmbus_channel **subchan;
struct hv_storvsc_request *request;
struct vstor_packet *vstor_packet;  
-   int request_channels_cnt = 0;
+   int request_subch;
int ret, i;
 
-   /* get multichannels count that need to create */
-   request_channels_cnt = MIN(max_chans, mp_ncpus);
+   /* get sub-channel count that need to create */
+   request_subch = MIN(max_subch, mp_ncpus - 1);
 
request = >hs_init_req;
 
@@ -407,7 +411,7 @@ storvsc_send_multichannel_request(struct

vstor_packet->operation = VSTOR_OPERATION_CREATE_MULTI_CHANNELS;
vstor_packet->flags = REQUEST_COMPLETION_FLAG;
-   vstor_packet->u.multi_channels_cnt = request_channels_cnt;
+   vstor_packet->u.multi_channels_cnt = request_subch;
 
ret = vmbus_chan_send(sc->hs_chan,
VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC,
@@ -424,17 +428,17 @@ storvsc_send_multichannel_request(struct
}
 
/* Update channel count */
-   sc->hs_nchan = request_channels_cnt + 1;
+   sc->hs_nchan = request_subch + 1;
 
/* Wait for sub-channels setup to complete. */
-   subchan = vmbus_subchan_get(sc->hs_chan, request_channels_cnt);
+   subchan = vmbus_subchan_get(sc->hs_chan, request_subch);
 
/* Attach the sub-channels. */
-   for (i = 0; i < request_channels_cnt; ++i)
+   for (i = 0; i < request_subch; ++i)
storvsc_subchan_attach(sc, subchan[i]);
 
/* Release the sub-channels. */
-   vmbus_subchan_rel(subchan, request_channels_cnt);
+   vmbus_subchan_rel(subchan, request_subch);
 
if (bootverbose)
printf("Storvsc create multi-channel success!\n");
@@ -452,11 +456,11 @@ hv_storvsc_channel_init(struct storvsc_s
int ret = 0, i;
struct hv_storvsc_request *request;
struct vstor_packet *vstor_packet;
-   uint16_t max_chans = 0;
-   boolean_t support_multichannel = FALSE;
+   uint16_t max_subch;
+   boolean_t support_multichannel;
uint32_t version;
 
-   max_chans = 0;
+   max_subch = 0;
support_multichannel = FALSE;
 
request = >hs_init_req;
@@ -550,14 +554,21 @@ hv_storvsc_channel_init(struct storvsc_s
goto cleanup;
}
 
+   max_subch = vstor_packet->u.chan_props.max_channel_cnt;
+   if (hv_storvsc_chan_cnt > 0 && hv_storvsc_chan_cnt < (max_subch + 1))
+   max_subch = hv_storvsc_chan_cnt - 1;
+
/* multi-channels feature is supported by WIN8 and above version */
-   max_chans = vstor_packet->u.chan_props.max_channel_cnt;
version = VMBUS_GET_VERSION(device_get_parent(sc->hs_dev), sc->hs_dev);
if (version != VMBUS_VERSION_WIN7 && version != VMBUS_VERSION_WS2008 &&
(vstor_packet->u.chan_props.flags &
 HV_STORAGE_SUPPORTS_MULTI_CHANNEL)) {
support_multichannel = TRUE;
}
+   if (bootverbose) {
+   device_printf(sc->hs_dev, "max chans %d%s\n", max_subch + 1,
+   support_multichannel ? ", multi-chan capable" : "");
+   }
 
memset(vstor_packet, 0, sizeof(struct vstor_packet));
vstor_packet->operation = 

Re: svn commit: r310138 - head/lib/libc/stdio

2016-12-20 Thread Pedro Giffuni


On 20/12/2016 18:50, Conrad Meyer wrote:

I didn't get the same conclusion from the thread — I haven't seen a
persuasive argument for removal.

Best,
Conrad


It's not standard or even a GNU extension  (which we sometimes carry for 
compatibility). We don't want to encourage it's use either so it doesn't 
really belong in libc.


+1 for removal.

Pedro.
___
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: r310138 - head/lib/libc/stdio

2016-12-20 Thread Juli Mallett
On Tue, Dec 20, 2016 at 6:04 PM, Conrad Meyer  wrote:
> Hi Adrian,
>
> On Tue, Dec 20, 2016 at 5:56 PM, Adrian Chadd  wrote:
>> Here's my reason for removal.
>>
>> Plenty of us are looking to be able to build bits of the BSD source
>> tree as part of other non FreeBSD systems, especially if they're
>> involved in bootstrapping.
>
> Understood, however:
>
>> That means that it needs to be compilable
>> by a non-FreeBSD-modified compiler. Ideally this means we'd stick to
>> mostly POSIX options source code that we can compile with unmodified
>> compilers, and we push non-standard stuff into otherly-named
>> functions.
>
> Yeah, this isn't actually a problem.  printf("%b", foo) compiles fine
> with non-modified compilers.

I want FreeBSD tools to avoid non-standard extensions to standard APIs
where possible.  Non-standard APIs are fine, because they're easy to
provide one's own implementations along with portable software, but
building in quirky behaviour to core POSIX/C/whatever interfaces
invites pain.  In this case, the cost-benefit ratio is all out of
whack.  Now, %b is unusual enough that I don't have to worry that,
say, a bootstrap tool will use it, but it's also unusual enough that
the benefit here is elusive.

I would love to see this reverted and snprintb instead.
___
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: r310138 - head/lib/libc/stdio

2016-12-20 Thread Conrad Meyer
Hi Adrian,

On Tue, Dec 20, 2016 at 5:56 PM, Adrian Chadd  wrote:
> Here's my reason for removal.
>
> Plenty of us are looking to be able to build bits of the BSD source
> tree as part of other non FreeBSD systems, especially if they're
> involved in bootstrapping.

Understood, however:

> That means that it needs to be compilable
> by a non-FreeBSD-modified compiler. Ideally this means we'd stick to
> mostly POSIX options source code that we can compile with unmodified
> compilers, and we push non-standard stuff into otherly-named
> functions.

Yeah, this isn't actually a problem.  printf("%b", foo) compiles fine
with non-modified compilers.

Best,
Conrad
___
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: r310138 - head/lib/libc/stdio

2016-12-20 Thread Adrian Chadd
Hi,

Here's my reason for removal.

Plenty of us are looking to be able to build bits of the BSD source
tree as part of other non FreeBSD systems, especially if they're
involved in bootstrapping. That means that it needs to be compilable
by a non-FreeBSD-modified compiler. Ideally this means we'd stick to
mostly POSIX options source code that we can compile with unmodified
compilers, and we push non-standard stuff into otherly-named
functions.

If things are harder then we end up with even more reasons people
resist migrating to FreeBSD and instead just continue to use Linux as
their platform of choice. It already cross-builds and does most of
what people want without getting in their way.

This change is one of those which encourage making that effort harder,
and I'd like to make sure we don't do that. Building bits of the
FreeBSD tree on non-FreeBSD systems (even
non-same-version-FreeBSD-system trees) is increasingly painful.

THanks,



-adrian
___
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: r310346 - head/share/misc

2016-12-20 Thread Mark Felder
Author: feld (ports committer)
Date: Wed Dec 21 01:48:54 2016
New Revision: 310346
URL: https://svnweb.freebsd.org/changeset/base/310346

Log:
  Add amdmi3 to ports-secteam
  
  Approved by:  swills

Modified:
  head/share/misc/organization.dot

Modified: head/share/misc/organization.dot
==
--- head/share/misc/organization.dotWed Dec 21 01:39:11 2016
(r310345)
+++ head/share/misc/organization.dotWed Dec 21 01:48:54 2016
(r310346)
@@ -34,7 +34,7 @@ portmgr [label="Port Management Team\npo
 portmgrsecretary [label="Port Management Team 
Secretary\nportmgr-secret...@freebsd.org\nrene"]
 re [label="Primary Release Engineering Team\n...@freebsd.org\nkib, blackend, 
jpaetzel, hrs, kensmith"]
 secteam [label="Security Team\nsect...@freebsd.org\ndelphij,\ndes, gavin, 
gjb,\nglebius, remko"]
-portssecteam [label="Ports Security Team\nports-sect...@freebsd.org\ndelphij, 
eadler, feld, jgh, junovitch, rea, sbz, simon, swills, zi"]
+portssecteam [label="Ports Security Team\nports-sect...@freebsd.org\ndelphij, 
amdmi3, eadler, feld, jgh, junovitch, rea, sbz, simon, swills, zi"]
 secteamsecretary [label="Security Team 
Secretary\nsecteam-secret...@freebsd.org\nremko"]
 securityofficer [label="Security Officer 
Team\nsecurity-offi...@freebsd.org\ncperciva, simon, nectar"]
 srccommitters [label="Src Committers\nsrc-committ...@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: r310345 - head/sys/geom

2016-12-20 Thread Sepherosa Ziehau
Author: sephe
Date: Wed Dec 21 01:39:11 2016
New Revision: 310345
URL: https://svnweb.freebsd.org/changeset/base/310345

Log:
  build: Unbreak LINT
  
  Sponsored by: Microsoft

Modified:
  head/sys/geom/geom_map.c

Modified: head/sys/geom/geom_map.c
==
--- head/sys/geom/geom_map.cWed Dec 21 01:38:44 2016(r310344)
+++ head/sys/geom/geom_map.cWed Dec 21 01:39:11 2016(r310345)
@@ -147,8 +147,13 @@ find_marker(struct g_consumer *cp, const
bzero(search_key, MAP_MAX_MARKER_LEN);
sectorsize = cp->provider->sectorsize;
 
+#ifdef __LP64__
+   ret = sscanf(line, "search:%li:%li:%63c",
+   _start, _step, search_key);
+#else
ret = sscanf(line, "search:%qi:%qi:%63c",
_start, _step, search_key);
+#endif
if (ret < 3)
return (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: r310344 - head/sys/arm/freescale/imx

2016-12-20 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Wed Dec 21 01:38:44 2016
New Revision: 310344
URL: https://svnweb.freebsd.org/changeset/base/310344

Log:
  [iMX6] Fix SDMA driver build
  
  - Place const modifiers where required
  - Make sure sdma device is attahched before consumers like SSI
  
  Reviewed by:  br
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D8874

Modified:
  head/sys/arm/freescale/imx/imx6_sdma.c
  head/sys/arm/freescale/imx/imx6_sdma.h

Modified: head/sys/arm/freescale/imx/imx6_sdma.c
==
--- head/sys/arm/freescale/imx/imx6_sdma.c  Wed Dec 21 01:32:19 2016
(r310343)
+++ head/sys/arm/freescale/imx/imx6_sdma.c  Wed Dec 21 01:38:44 2016
(r310344)
@@ -351,7 +351,7 @@ sdma_configure(int chn, struct sdma_conf
 static int
 load_firmware(struct sdma_softc *sc)
 {
-   struct sdma_firmware_header *header;
+   const struct sdma_firmware_header *header;
const struct firmware *fp;
 
fp = firmware_get("sdma_fw");
@@ -360,14 +360,14 @@ load_firmware(struct sdma_softc *sc)
return (-1);
}
 
-   header = (struct sdma_firmware_header *)fp->data;
+   header = fp->data;
if (header->magic != FW_HEADER_MAGIC) {
device_printf(sc->dev, "Can't use firmware.\n");
return (-1);
}
 
sc->fw_header = header;
-   sc->fw_scripts = (void *)((char *)header +
+   sc->fw_scripts = (const void *)((const char *)header +
header->script_addrs_start);
 
return (0);
@@ -377,14 +377,14 @@ static int
 boot_firmware(struct sdma_softc *sc)
 {
struct sdma_buffer_descriptor *bd0;
-   uint32_t *ram_code;
+   const uint32_t *ram_code;
int timeout;
int ret;
int chn;
int sz;
int i;
 
-   ram_code = (void *)((char *)sc->fw_header +
+   ram_code = (const void *)((const char *)sc->fw_header +
sc->fw_header->ram_code_start);
 
/* Make sure SDMA has not started yet */
@@ -514,4 +514,5 @@ static driver_t sdma_driver = {
 
 static devclass_t sdma_devclass;
 
-DRIVER_MODULE(sdma, simplebus, sdma_driver, sdma_devclass, 0, 0);
+EARLY_DRIVER_MODULE(sdma, simplebus, sdma_driver, sdma_devclass, 0, 0,
+BUS_PASS_RESOURCE);

Modified: head/sys/arm/freescale/imx/imx6_sdma.h
==
--- head/sys/arm/freescale/imx/imx6_sdma.h  Wed Dec 21 01:32:19 2016
(r310343)
+++ head/sys/arm/freescale/imx/imx6_sdma.h  Wed Dec 21 01:38:44 2016
(r310344)
@@ -221,8 +221,8 @@ struct sdma_softc {
uint32_tnum_bd;
uint32_tccb_phys;
uint32_tcontext_phys;
-   struct sdma_firmware_header *fw_header;
-   struct sdma_script_start_addrs  *fw_scripts;
+   const struct sdma_firmware_header   *fw_header;
+   const struct sdma_script_start_addrs*fw_scripts;
 };
 
 struct sdma_conf {
___
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: r310343 - head/sys/arm/freescale/imx

2016-12-20 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Wed Dec 21 01:32:19 2016
New Revision: 310343
URL: https://svnweb.freebsd.org/changeset/base/310343

Log:
  [iMX6] Fix build for SSI driver and add dependency for SDMA driver
  
  - Pass correct pointer to OF_getencprop
  - Check the size of "dmas" property
  - Add dependency on sdma driver
  
  Reviewed by:  br
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D8873

Modified:
  head/sys/arm/freescale/imx/imx6_ssi.c

Modified: head/sys/arm/freescale/imx/imx6_ssi.c
==
--- head/sys/arm/freescale/imx/imx6_ssi.c   Wed Dec 21 00:50:21 2016
(r310342)
+++ head/sys/arm/freescale/imx/imx6_ssi.c   Wed Dec 21 01:32:19 2016
(r310343)
@@ -66,6 +66,7 @@ __FBSDID("$FreeBSD$");
bus_space_write_4(_sc->bst, _sc->bsh, _reg, _val)
 
 #defineSSI_NCHANNELS   1
+#defineDMAS_TOTAL  8
 
 /* i.MX6 SSI registers */
 
@@ -187,8 +188,8 @@ struct sc_info {
struct sdma_conf*conf;
struct ssi_rate *sr;
struct sdma_softc   *sdma_sc;
-   int sdma_ev_rx;
-   int sdma_ev_tx;
+   uint32_tsdma_ev_rx;
+   uint32_tsdma_ev_tx;
int sdma_channel;
 };
 
@@ -437,7 +438,7 @@ find_sdma_controller(struct sc_info *sc)
struct sdma_softc *sdma_sc;
phandle_t node, sdma_node;
device_t sdma_dev;
-   int dts_value[8];
+   pcell_t dts_value[DMAS_TOTAL];
int len;
 
if ((node = ofw_bus_get_node(sc->dev)) == -1)
@@ -446,7 +447,14 @@ find_sdma_controller(struct sc_info *sc)
if ((len = OF_getproplen(node, "dmas")) <= 0)
return (ENXIO);
 
-   OF_getencprop(node, "dmas", _value, len);
+   if (len != sizeof(dts_value)) {
+   device_printf(sc->dev,
+   "\"dmas\" property length is invalid: %d (expected %d)",
+   len, sizeof(dts_value));
+   return (ENXIO);
+   }
+
+   OF_getencprop(node, "dmas", dts_value, sizeof(dts_value));
 
sc->sdma_ev_rx = dts_value[1];
sc->sdma_ev_tx = dts_value[5];
@@ -850,4 +858,5 @@ static driver_t ssi_pcm_driver = {
 
 DRIVER_MODULE(ssi, simplebus, ssi_pcm_driver, pcm_devclass, 0, 0);
 MODULE_DEPEND(ssi, sound, SOUND_MINVER, SOUND_PREFVER, SOUND_MAXVER);
+MODULE_DEPEND(ssi, sdma, 0, 0, 0);
 MODULE_VERSION(ssi, 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: r310138 - head/lib/libc/stdio

2016-12-20 Thread Ian Lepore
On Tue, 2016-12-20 at 15:50 -0800, Conrad Meyer wrote:
> I didn't get the same conclusion from the thread — I haven't seen a
> persuasive argument for removal.
> 
> Best,
> Conrad
> 

You're kidding, right?  Can you cite even a single message that
supports the change?  My memory is that everyone who voiced an opinion
said it was a bad idea, then the thread devolved into discussions of
alternatives and how they were bad ideas too.  That latter bit doesn't
change the basic fact that everyone started by agreeing this was a bad
idea for userland.

-- Ian

> On Mon, Dec 19, 2016 at 2:23 PM, Adrian Chadd  > wrote:
> > 
> > [snip]
> > 
> > tl;dr - can we revert it from stdio for now so we don't end up
> > having
> > people use this?
> > 
> > 
> > 
> > -adrian
> 
___
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: r310342 - head/sys/dev/bhnd/tools

2016-12-20 Thread Landon J. Fuller
Author: landonf
Date: Wed Dec 21 00:50:21 2016
New Revision: 310342
URL: https://svnweb.freebsd.org/changeset/base/310342

Log:
  bhnd(4): Use a stable sort key to produce deterministic nvram_map_gen.awk
  output.
  
  When ordering SROM layout entries, we now use the unique (var_id,
  rev_start, rev_end) tuple as the sort key; this fixes the previously
  non-deterministic output when sorting entries with overlapping var_ids.
  
  PR:   215422
  Reported by:  emaste
  Reviewed by:  emaste
  Approved by:  adrian (mentor)
  Differential Revision:https://reviews.freebsd.org/D8859

Modified:
  head/sys/dev/bhnd/tools/nvram_map_gen.awk

Modified: head/sys/dev/bhnd/tools/nvram_map_gen.awk
==
--- head/sys/dev/bhnd/tools/nvram_map_gen.awk   Tue Dec 20 22:47:09 2016
(r310341)
+++ head/sys/dev/bhnd/tools/nvram_map_gen.awk   Wed Dec 21 00:50:21 2016
(r310342)
@@ -1519,8 +1519,10 @@ function write_srom_bindings(layout, _va
array_append(_entries, _entry)
}
 
-   # Sort entries by variable ID, ascending
-   array_sort(_entries, prop_path_create(p_var, p_vid))
+   # Sort entries by (variable ID, revision range), ascending
+   array_sort(_entries, prop_path_create(p_var, p_vid),
+   prop_path_create(p_revisions, p_start),
+   prop_path_create(p_revisions, p_end))
 
# Emit all entry binding opcodes
emit("static const uint8_t " _varname "[] = {\n")
@@ -2297,17 +2299,24 @@ function array_get(array, idx) {
 #
 # Sort an array, using standard awk comparison operators over its values.
 #
-# If `prop_path` is non-NULL, the corresponding property path (or property ID)
+# If `prop_path*` is non-NULL, the corresponding property path (or property ID)
 # will be fetched from each array element and used as the sorting value.
 #
-function array_sort(array, prop_path, _size) {
+# If multiple property paths are specified, the array is first sorted by
+# the first path, and then any equal values are sorted by the second path,
+# and so on.
+#
+function array_sort(array, prop_path0, prop_path1, prop_path2, _size) {
obj_assert_class(array, Array)
 
+   if (_size != null)
+   errorx("no more than three property paths may be specified")
+
_size = array_size(array)
if (_size <= 1)
return
 
-   _qsort(array, prop_path, 0, _size-1)
+   _qsort(array, prop_path0, prop_path1, prop_path2, 0, _size-1)
 }
 
 function _qsort_get_key(array, idx, prop_path, _v) {
@@ -2319,8 +2328,35 @@ function _qsort_get_key(array, idx, prop
return (prop_get_path(_v, prop_path))
 }
 
-function _qsort(array, prop_path, first, last, _qpivot, _qpivot_val, _qleft,
-_qleft_val, _qright, _qright_val)
+function _qsort_compare(array, lhs_idx, rhs_val, ppath0, ppath1, ppath2,
+_lhs_val, _rhs_prop_val)
+{
+   _lhs_val = _qsort_get_key(array, lhs_idx, ppath0)
+   if (ppath0 == null)
+   _rhs_prop_val = rhs_val
+   else
+   _rhs_prop_val = prop_get_path(rhs_val, ppath0)
+
+   if (_lhs_val == _rhs_prop_val && ppath1 != null) {
+   _lhs_val = _qsort_get_key(array, lhs_idx, ppath1)
+   _rhs_prop_val = prop_get_path(rhs_val, ppath1)
+
+   if (_lhs_val == _rhs_prop_val && ppath2 != null) {
+   _lhs_val = _qsort_get_key(array, lhs_idx, ppath2)
+   _rhs_prop_val = prop_get_path(rhs_val, ppath2)
+   }
+   }
+
+   if (_lhs_val < _rhs_prop_val)
+   return (-1)
+   else if (_lhs_val > _rhs_prop_val)
+   return (1)
+   else
+   return (0)
+}
+
+function _qsort(array, ppath0, ppath1, ppath2, first, last, _qpivot,
+_qleft, _qleft_val, _qright, _qright_val)
 {
if (first >= last)
return
@@ -2330,15 +2366,21 @@ function _qsort(array, prop_path, first,
_qleft = first
_qright = last
 
-   _qpivot_val = _qsort_get_key(array, _qpivot, prop_path)
+   _qpivot_val = array_get(array, _qpivot)
 
# partition
while (_qleft <= _qright) {
-   while (_qsort_get_key(array, _qleft, prop_path) < _qpivot_val)
+   while (_qsort_compare(array, _qleft, _qpivot_val, ppath0, 
ppath1,
+   ppath2) < 0)
+   {
_qleft++
+   }
 
-   while (_qsort_get_key(array, _qright, prop_path) > _qpivot_val)
+   while (_qsort_compare(array, _qright, _qpivot_val, ppath0, 
ppath1,
+   ppath2) > 0)
+   {
_qright--
+   }
 
# swap
if (_qleft <= _qright) {
@@ -2354,8 +2396,8 @@ function _qsort(array, prop_path, first,
}
 
# sort the partitions
-   _qsort(array, prop_path, first, _qright)
-   _qsort(array, prop_path, 

Re: svn commit: r310138 - head/lib/libc/stdio

2016-12-20 Thread Conrad Meyer
I didn't get the same conclusion from the thread — I haven't seen a
persuasive argument for removal.

Best,
Conrad

On Mon, Dec 19, 2016 at 2:23 PM, Adrian Chadd  wrote:
> [snip]
>
> tl;dr - can we revert it from stdio for now so we don't end up having
> people use this?
>
>
>
> -adrian
___
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: r310341 - head/sys/dev/sdhci

2016-12-20 Thread Conrad E. Meyer
Author: cem
Date: Tue Dec 20 22:47:09 2016
New Revision: 310341
URL: https://svnweb.freebsd.org/changeset/base/310341

Log:
  Follow-up to r310340: Add missing "Intel" to description
  
  Reported by:  rpokala@

Modified:
  head/sys/dev/sdhci/sdhci_pci.c

Modified: head/sys/dev/sdhci/sdhci_pci.c
==
--- head/sys/dev/sdhci/sdhci_pci.c  Tue Dec 20 22:08:36 2016
(r310340)
+++ head/sys/dev/sdhci/sdhci_pci.c  Tue Dec 20 22:47:09 2016
(r310341)
@@ -107,7 +107,7 @@ static const struct sdhci_device {
SDHCI_QUIRK_RESET_AFTER_REQUEST },
{ 0x16bc14e4,   0x, "Broadcom BCM577xx SDXC/MMC Card Reader",
SDHCI_QUIRK_BCM577XX_400KHZ_CLKSRC },
-   { 0x22948086,   0x, "Braswell Storage Cluster Control MMC Port",
+   { 0x22948086,   0x, "Intel Braswell Storage Cluster Control MMC 
Port",
0 },
{ 0,0x, NULL,
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: r310340 - in head/sys/dev: ichiic sdhci

2016-12-20 Thread Conrad E. Meyer
Author: cem
Date: Tue Dec 20 22:08:36 2016
New Revision: 310340
URL: https://svnweb.freebsd.org/changeset/base/310340

Log:
  Add Braswell PCI IDs for Intel Cherryview
  
  Submitted by: Johannes Lundberg 
  Reviewed by:  jhb
  Differential Revision:https://reviews.freebsd.org/D8861

Modified:
  head/sys/dev/ichiic/ig4_pci.c
  head/sys/dev/sdhci/sdhci_pci.c

Modified: head/sys/dev/ichiic/ig4_pci.c
==
--- head/sys/dev/ichiic/ig4_pci.c   Tue Dec 20 21:58:43 2016
(r310339)
+++ head/sys/dev/ichiic/ig4_pci.c   Tue Dec 20 22:08:36 2016
(r310340)
@@ -68,6 +68,12 @@ static int ig4iic_pci_detach(device_t de
 
 #define PCI_CHIP_LYNXPT_LP_I2C_1   0x9c618086
 #define PCI_CHIP_LYNXPT_LP_I2C_2   0x9c628086
+#define PCI_CHIP_BRASWELL_I2C_10x22c18086
+#define PCI_CHIP_BRASWELL_I2C_20x22c28086
+#define PCI_CHIP_BRASWELL_I2C_30x22c38086
+#define PCI_CHIP_BRASWELL_I2C_50x22c58086
+#define PCI_CHIP_BRASWELL_I2C_60x22c68086
+#define PCI_CHIP_BRASWELL_I2C_70x22c78086
 
 static int
 ig4iic_pci_probe(device_t dev)
@@ -79,6 +85,24 @@ ig4iic_pci_probe(device_t dev)
case PCI_CHIP_LYNXPT_LP_I2C_2:
device_set_desc(dev, "Intel Lynx Point-LP I2C Controller-2");
break;
+   case PCI_CHIP_BRASWELL_I2C_1:
+   device_set_desc(dev, "Intel Braswell Serial I/O I2C Port 1");
+   break;
+   case PCI_CHIP_BRASWELL_I2C_2:
+   device_set_desc(dev, "Intel Braswell Serial I/O I2C Port 2");
+   break;
+   case PCI_CHIP_BRASWELL_I2C_3:
+   device_set_desc(dev, "Intel Braswell Serial I/O I2C Port 3");
+   break;
+   case PCI_CHIP_BRASWELL_I2C_5:
+   device_set_desc(dev, "Intel Braswell Serial I/O I2C Port 5");
+   break;
+   case PCI_CHIP_BRASWELL_I2C_6:
+   device_set_desc(dev, "Intel Braswell Serial I/O I2C Port 6");
+   break;
+   case PCI_CHIP_BRASWELL_I2C_7:
+   device_set_desc(dev, "Intel Braswell Serial I/O I2C Port 7");
+   break;
default:
return (ENXIO);
}

Modified: head/sys/dev/sdhci/sdhci_pci.c
==
--- head/sys/dev/sdhci/sdhci_pci.c  Tue Dec 20 21:58:43 2016
(r310339)
+++ head/sys/dev/sdhci/sdhci_pci.c  Tue Dec 20 22:08:36 2016
(r310340)
@@ -107,6 +107,8 @@ static const struct sdhci_device {
SDHCI_QUIRK_RESET_AFTER_REQUEST },
{ 0x16bc14e4,   0x, "Broadcom BCM577xx SDXC/MMC Card Reader",
SDHCI_QUIRK_BCM577XX_400KHZ_CLKSRC },
+   { 0x22948086,   0x, "Braswell Storage Cluster Control MMC Port",
+   0 },
{ 0,0x, NULL,
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: r310339 - in head/sys/cam: ctl scsi

2016-12-20 Thread Alexander Motin
Author: mav
Date: Tue Dec 20 21:58:43 2016
New Revision: 310339
URL: https://svnweb.freebsd.org/changeset/base/310339

Log:
  Bump specifications support to SAM-6/SPC-5.

Modified:
  head/sys/cam/ctl/ctl.c
  head/sys/cam/scsi/scsi_all.h

Modified: head/sys/cam/ctl/ctl.c
==
--- head/sys/cam/ctl/ctl.c  Tue Dec 20 21:17:07 2016(r310338)
+++ head/sys/cam/ctl/ctl.c  Tue Dec 20 21:58:43 2016(r310339)
@@ -10174,7 +10174,7 @@ ctl_inquiry_std(struct ctl_scsiio *ctsio
inq_ptr->device = (SID_QUAL_BAD_LU << 5) | T_NODEVICE;
 
/* RMB in byte 2 is 0 */
-   inq_ptr->version = SCSI_REV_SPC4;
+   inq_ptr->version = SCSI_REV_SPC5;
 
/*
 * According to SAM-3, even if a device only supports a single
@@ -10272,10 +10272,10 @@ ctl_inquiry_std(struct ctl_scsiio *ctsio
inq_ptr->spi3data = SID_SPI_CLOCK_DT_ST | SID_SPI_QAS |
SID_SPI_IUS;
 
-   /* SAM-5 (no version claimed) */
-   scsi_ulto2b(0x00A0, inq_ptr->version1);
-   /* SPC-4 (no version claimed) */
-   scsi_ulto2b(0x0460, inq_ptr->version2);
+   /* SAM-6 (no version claimed) */
+   scsi_ulto2b(0x00C0, inq_ptr->version1);
+   /* SPC-5 (no version claimed) */
+   scsi_ulto2b(0x05C0, inq_ptr->version2);
if (port_type == CTL_PORT_FC) {
/* FCP-2 ANSI INCITS.350:2003 */
scsi_ulto2b(0x0917, inq_ptr->version3);

Modified: head/sys/cam/scsi/scsi_all.h
==
--- head/sys/cam/scsi/scsi_all.hTue Dec 20 21:17:07 2016
(r310338)
+++ head/sys/cam/scsi/scsi_all.hTue Dec 20 21:58:43 2016
(r310339)
@@ -2156,6 +2156,7 @@ struct scsi_inquiry_data
 #defineSCSI_REV_SPC2   4
 #defineSCSI_REV_SPC3   5
 #defineSCSI_REV_SPC4   6
+#defineSCSI_REV_SPC5   7
 
 #defineSID_ECMA0x38
 #defineSID_ISO 0xC0
___
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: r310338 - in head: share/man/man4 sys/conf sys/dev/isp

2016-12-20 Thread Kenneth D. Merry
Author: ken
Date: Tue Dec 20 21:17:07 2016
New Revision: 310338
URL: https://svnweb.freebsd.org/changeset/base/310338

Log:
  Turn on FC-Tape by default in the isp(4) driver.
  
  FC-Tape provides additional link level error recovery, and is
  highly recommended for tape devices.  It will only be turned on for
  a given target if the target supports it.
  
  Without this setting, we default to whatever FC-Tape setting is in
  NVRAM on the card.
  
  This can be overridden by setting the following loader tunable, for
  example for isp0:
  
  hint.isp.0.nofctape=1
  
  sys/conf/options:
Add a new kernel config option, ISP_FCTAPE_OFF, that
defaults the FC-Tape configuration to off.
  
  sys/dev/isp/isp_pci.c:
If ISP_FCTAPE_OFF is defined, turn off FC-Tape.  Otherwise,
turn it on if the card supports it.
  
  share/man/man4/isp.4:
Add a description of FC-Tape to the isp(4) man page.
  
Add descriptions of the fctape and nofctape options, as well as the
ISP_FCTAPE_OFF kernel configuration option.
  
Add the ispfw module and kernel drivers to the suggested
configurations at the top of the man page so that users are less
likely to leave it out.  The driver works well with the included
firmware, but may not work at all with whatever firmware the user
has flashed on their card.
  
  MFC after:3 days
  Sponsored by: Spectra Logic

Modified:
  head/share/man/man4/isp.4
  head/sys/conf/options
  head/sys/dev/isp/isp_pci.c

Modified: head/share/man/man4/isp.4
==
--- head/share/man/man4/isp.4   Tue Dec 20 20:11:16 2016(r310337)
+++ head/share/man/man4/isp.4   Tue Dec 20 21:17:07 2016(r310338)
@@ -26,7 +26,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd December 9, 2015
+.Dd December 20, 2016
 .Dt ISP 4
 .Os
 .Sh NAME
@@ -39,13 +39,15 @@ kernel configuration file:
 .Bd -ragged -offset indent
 .Cd "device scbus"
 .Cd "device isp"
+.Cd "device ispfw"
 .Ed
 .Pp
 Alternatively, to load the driver as a
-module at boot time, place the following line in
+module at boot time, place the following lines in
 .Xr loader.conf 5 :
 .Bd -literal -offset indent
 isp_load="YES"
+ispfw_load="YES"
 .Ed
 .Sh DESCRIPTION
 This driver provides access to
@@ -62,6 +64,30 @@ Fibre Channel supports initiator and tar
 utilizing Class 3 and Class 2 (2200 and later) connections.
 Support is available for Public and Private loops, Point-to-Point
 and Fabric connections.
+.Pp
+FC-Tape is supported on 4Gb (2400) and newer controllers.
+FC-Tape is highly recommended for connections to tape drives that support
+it.
+It encompasses four elements from the the T-10 FCP-4 specification:
+.Bl -bullet -offset indent
+.It
+Precise Delivery of Commands
+.It
+Confirmed Completion of FCP I/O Operations
+.It
+Retransmission of Unsuccessfully Transmitted IUs
+.It
+Task Retry Identification
+.El
+.Pp
+Together these features allow for link level error recovery with tape
+devices.
+Without it, an initiator cannot, for instance, tell whether a tape write
+command that has timed out resulted in all, part or none of the data going to
+the tape drive.
+FC-Tape is automatically enabled when connecting controller that supports
+it to a target that supports it.
+It may be disabled using configuration and hint options described below.
 .Sh FIRMWARE
 Firmware loading is supported if the
 .Xr ispfw 4
@@ -120,6 +146,13 @@ Target mode support for Fibre Channel ad
 .Cd options ISP_TARGET_MODE
 .Pp
 option.
+.Pp
+To disable FC-Tape, use the following configuration option:
+.Pp
+.Cd options ISP_FCTAPE_OFF
+.Pp
+Note that even if the ISP_FCTAPE_OFF option is used, it may be overridden
+by the fctape hint described below.
 .Sh BOOT OPTIONS
 The following options are switchable by setting values in
 .Pa /boot/device.hints .
@@ -169,6 +202,11 @@ A hint value for a driver debug level (s
 for the values.
 .It Va hint.isp.0.vports
 A hint to create specified number of additional virtual ports.
+.It Va hint.isp.0.nofctape
+Set this to 1 to disable FC-Tape operation on the given isp instance.
+.It Va hint.isp.0.fctape
+Set this to 1 to enable FC-Tape operation on the given isp instance for
+targets that support it.
 .El
 .Sh SYSCTL OPTIONS
 .Bl -tag -width indent

Modified: head/sys/conf/options
==
--- head/sys/conf/options   Tue Dec 20 20:11:16 2016(r310337)
+++ head/sys/conf/options   Tue Dec 20 21:17:07 2016(r310338)
@@ -384,6 +384,7 @@ ISP_TARGET_MODE opt_isp.h
 ISP_FW_CRASH_DUMP  opt_isp.h
 ISP_DEFAULT_ROLES  opt_isp.h
 ISP_INTERNAL_TARGETopt_isp.h
+ISP_FCTAPE_OFF opt_isp.h
 
 # Options used only in dev/iscsi
 ISCSI_INITIATOR_DEBUG  opt_iscsi_initiator.h

Modified: head/sys/dev/isp/isp_pci.c
==
--- 

Re: svn commit: r310330 - in head: share/man/man4 sys/conf sys/dev/xdma

2016-12-20 Thread John Baldwin
On Tuesday, December 20, 2016 06:02:07 PM Ruslan Bukin wrote:
> Author: br
> Date: Tue Dec 20 18:02:07 2016
> New Revision: 310330
> URL: https://svnweb.freebsd.org/changeset/base/310330
> 
> Log:
>   Add xDMA -- the DMA abstraction layer, initial verison.
>   
>   xDMA is a DMA framework designed to abstract the interaction
>   between device drivers and DMA engines.
>   
>   Project wiki: https://wiki.freebsd.org/xdma
>   
>   Sponsored by:   DARPA, AFRL
>   Differential Revision:  https://reviews.freebsd.org/D8807

It probably would have been a good idea to get some design review of this on
arch@ before committing.  In particular, I believe from earlier discussions
that you want to build a general framework that things like ioat(4) can hook
into.  arch@ would give you a broader audience for working out the
abstractions and interfaces.

-- 
John Baldwin
___
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: r310337 - head/lib/libkvm

2016-12-20 Thread Gleb Smirnoff
Author: glebius
Date: Tue Dec 20 20:11:16 2016
New Revision: 310337
URL: https://svnweb.freebsd.org/changeset/base/310337

Log:
  Fix memory leak.
  
  CID:  1367751
  Reviewed by:  jhb

Modified:
  head/lib/libkvm/kvm_private.c

Modified: head/lib/libkvm/kvm_private.c
==
--- head/lib/libkvm/kvm_private.c   Tue Dec 20 19:44:44 2016
(r310336)
+++ head/lib/libkvm/kvm_private.c   Tue Dec 20 20:11:16 2016
(r310337)
@@ -200,6 +200,7 @@ _kvm_read_core_phdrs(kvm_t *kd, size_t *
 
for (i = 0; i < phnum; i++) {
if (gelf_getphdr(elf, i, [i]) == NULL) {
+   free(phdr);
_kvm_err(kd, kd->program, "%s", elf_errmsg(0));
goto bad;
}
___
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: r310336 - head/sys/kern

2016-12-20 Thread John Baldwin
Author: jhb
Date: Tue Dec 20 19:44:44 2016
New Revision: 310336
URL: https://svnweb.freebsd.org/changeset/base/310336

Log:
  Don't spin in pause() during early boot for kthreads other than thread0.
  
  pause() uses a spin loop to simulate a sleep during early boot.  However,
  we only need this for thread0 to get far enough in the boot process to
  enable timers (at which point pause() can sleep).  For other kthreads,
  sleeping in pause() is ok as the callout will be scheduled and will
  eventually fire once thread0 initializes timers.
  
  Tested by:Steven Kargl
  Sleuthing by: markj
  MFC after:1 week
  Sponsored by: Netflix

Modified:
  head/sys/kern/kern_synch.c

Modified: head/sys/kern/kern_synch.c
==
--- head/sys/kern/kern_synch.c  Tue Dec 20 19:30:21 2016(r310335)
+++ head/sys/kern/kern_synch.c  Tue Dec 20 19:44:44 2016(r310336)
@@ -321,7 +321,8 @@ pause_sbt(const char *wmesg, sbintime_t 
if (sbt == 0)
sbt = tick_sbt;
 
-   if (cold || kdb_active || SCHEDULER_STOPPED()) {
+   if ((cold && curthread == ) || kdb_active ||
+   SCHEDULER_STOPPED()) {
/*
 * We delay one second at a time to avoid overflowing the
 * system specific DELAY() function(s):
___
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: r310335 - stable/11/sys/cddl/contrib/opensolaris/uts/common/dtrace

2016-12-20 Thread George V. Neville-Neil
Author: gnn
Date: Tue Dec 20 19:30:21 2016
New Revision: 310335
URL: https://svnweb.freebsd.org/changeset/base/310335

Log:
  MFC: 309669
  
  Fix a kernel panic in DTrace's rw_iswriter subroutine.
  On FreeBSD the sense of rw_write_held() and rw_iswriter() were reversed,
  probably due to a cut and paste error. Using rw_iswriter() would cause
  the kernel to panic.
  
  Reviewed by:  markj
  Sponsored by: DARPA, AFRL

Modified:
  stable/11/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c
==
--- stable/11/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c   Tue Dec 
20 18:47:02 2016(r310334)
+++ stable/11/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c   Tue Dec 
20 19:30:21 2016(r310335)
@@ -4274,8 +4274,8 @@ dtrace_dif_subr(uint_t subr, uint_t rd, 
break;
}
l.lx = dtrace_loadptr(tupregs[0].dttk_value);
-   LOCK_CLASS(l.li)->lc_owner(l.li, );
-   regs[rd] = (lowner == curthread);
+   regs[rd] = LOCK_CLASS(l.li)->lc_owner(l.li, ) &&
+   lowner != NULL;
break;
 
case DIF_SUBR_RW_ISWRITER:
@@ -4286,8 +4286,8 @@ dtrace_dif_subr(uint_t subr, uint_t rd, 
break;
}
l.lx = dtrace_loadptr(tupregs[0].dttk_value);
-   regs[rd] = LOCK_CLASS(l.li)->lc_owner(l.li, ) &&
-   lowner != NULL;
+   LOCK_CLASS(l.li)->lc_owner(l.li, );
+   regs[rd] = (lowner == curthread);
break;
 #endif /* illumos */
 
___
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: r310334 - head/sys/mips/ingenic

2016-12-20 Thread Ruslan Bukin
Author: br
Date: Tue Dec 20 18:47:02 2016
New Revision: 310334
URL: https://svnweb.freebsd.org/changeset/base/310334

Log:
  o Unmute headphones on Imgtec CI20 board.
  o Add some delay between codec initialization procedures.
  
  Sponsored by: DARPA, AFRL

Modified:
  head/sys/mips/ingenic/jz4780_codec.c

Modified: head/sys/mips/ingenic/jz4780_codec.c
==
--- head/sys/mips/ingenic/jz4780_codec.cTue Dec 20 18:27:53 2016
(r310333)
+++ head/sys/mips/ingenic/jz4780_codec.cTue Dec 20 18:47:02 2016
(r310334)
@@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -50,9 +51,14 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#include 
+
 #include 
 #include 
 
+#defineCI20_HP_PIN 13
+#defineCI20_HP_PORT3
+
 struct codec_softc {
device_tdev;
struct resource *res[1];
@@ -149,6 +155,41 @@ codec_print_registers(struct codec_softc
printf("codec DR_ADC_AGC %x\n", codec_read(sc, DR_ADC_AGC));
 }
 
+/*
+ * CI20 board-specific
+ */
+static int
+ci20_hp_unmute(struct codec_softc *sc)
+{
+   device_t dev;
+   int port;
+   int err;
+   int pin;
+
+   pin = CI20_HP_PIN;
+   port = CI20_HP_PORT;
+
+   dev = devclass_get_device(devclass_find("gpio"), port);
+   if (dev == NULL)
+   return (0);
+
+   err = GPIO_PIN_SETFLAGS(dev, pin, GPIO_PIN_OUTPUT);
+   if (err != 0) {
+   device_printf(dev, "Cannot configure GPIO pin %d on %s\n",
+   pin, device_get_nameunit(dev));
+   return (err);
+   }
+
+   err = GPIO_PIN_SET(dev, pin, 0);
+   if (err != 0) {
+   device_printf(dev, "Cannot configure GPIO pin %d on %s\n",
+   pin, device_get_nameunit(dev));
+   return (err);
+   }
+
+   return (0);
+}
+
 static int
 codec_probe(device_t dev)
 {
@@ -187,10 +228,14 @@ codec_attach(device_t dev)
reg &= ~(VIC_SB_SLEEP | VIC_SB);
codec_write(sc, CR_VIC, reg);
 
+   DELAY(2);
+
reg = codec_read(sc, CR_DAC);
reg &= ~(DAC_SB | DAC_MUTE);
codec_write(sc, CR_DAC, reg);
 
+   DELAY(1);
+
/* I2S, 16-bit, 96 kHz. */
reg = codec_read(sc, AICR_DAC);
reg &= ~(AICR_DAC_SB | DAC_ADWL_M);
@@ -199,13 +244,19 @@ codec_attach(device_t dev)
reg |= AUDIOIF_I2S;
codec_write(sc, AICR_DAC, reg);
 
+   DELAY(1);
+
reg = FCR_DAC_96;
codec_write(sc, FCR_DAC, reg);
 
+   DELAY(1);
+
/* Unmute headphones. */
reg = codec_read(sc, CR_HP);
reg &= ~(HP_SB | HP_MUTE);
-   codec_write(sc, CR_HP, 0);
+   codec_write(sc, CR_HP, reg);
+
+   ci20_hp_unmute(sc);
 
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: r310333 - in head/sys/mips: conf ingenic

2016-12-20 Thread Ruslan Bukin
Author: br
Date: Tue Dec 20 18:27:53 2016
New Revision: 310333
URL: https://svnweb.freebsd.org/changeset/base/310333

Log:
  Add jz4780 AIC (Audio Interface Controller) driver.
  
  Sponsored by: DARPA, AFRL
  Differential Revision:https://reviews.freebsd.org/D8808

Added:
  head/sys/mips/ingenic/jz4780_aic.c   (contents, props changed)
Modified:
  head/sys/mips/conf/CANNA
  head/sys/mips/conf/CI20
  head/sys/mips/ingenic/files.jz4780
  head/sys/mips/ingenic/files.x1000

Modified: head/sys/mips/conf/CANNA
==
--- head/sys/mips/conf/CANNATue Dec 20 18:25:41 2016(r310332)
+++ head/sys/mips/conf/CANNATue Dec 20 18:27:53 2016(r310333)
@@ -26,5 +26,8 @@ options   ROOTDEVNAME=\"ufs:mmcsd0s3\"
 
 makeoptionsTRAMPLOADADDR=0x8800
 
+device sound
+device xdma
+
 #options   VERBOSE_SYSINIT
 optionsPRINTF_BUFR_SIZE=256

Modified: head/sys/mips/conf/CI20
==
--- head/sys/mips/conf/CI20 Tue Dec 20 18:25:41 2016(r310332)
+++ head/sys/mips/conf/CI20 Tue Dec 20 18:27:53 2016(r310333)
@@ -25,6 +25,9 @@ makeoptions   FDT_DTS_FILE=ingenic/ci20.dt
 
 optionsROOTDEVNAME=\"ufs:mmcsd0\"
 
+device sound
+device xdma
+
 makeoptionsTRAMPLOADADDR=0x8800
 
 #options   VERBOSE_SYSINIT

Modified: head/sys/mips/ingenic/files.jz4780
==
--- head/sys/mips/ingenic/files.jz4780  Tue Dec 20 18:25:41 2016
(r310332)
+++ head/sys/mips/ingenic/files.jz4780  Tue Dec 20 18:27:53 2016
(r310333)
@@ -23,6 +23,10 @@ mips/ingenic/jz4780_pdma.c   standard
 mips/ingenic/jz4780_pinctrl.c  standard
 mips/ingenic/jz4780_timer.cstandard
 
+# Sound
+mips/ingenic/jz4780_aic.c  optional sound xdma
+mips/ingenic/jz4780_codec.coptional sound
+
 # SMP
 mips/ingenic/jz4780_mp.c   optional smp
 mips/ingenic/jz4780_mpboot.S   optional smp

Modified: head/sys/mips/ingenic/files.x1000
==
--- head/sys/mips/ingenic/files.x1000   Tue Dec 20 18:25:41 2016
(r310332)
+++ head/sys/mips/ingenic/files.x1000   Tue Dec 20 18:27:53 2016
(r310333)
@@ -14,5 +14,9 @@ mips/ingenic/jz4780_pdma.cstandard
 mips/ingenic/jz4780_pinctrl.c  standard
 mips/ingenic/jz4780_timer.cstandard
 
+# Sound
+mips/ingenic/jz4780_aic.c  optional sound xdma
+mips/ingenic/jz4780_codec.coptional sound
+
 # Custom interface between pinctrl and gpio
 mips/ingenic/jz4780_gpio_if.m  standard

Added: head/sys/mips/ingenic/jz4780_aic.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/mips/ingenic/jz4780_aic.c  Tue Dec 20 18:27:53 2016
(r310333)
@@ -0,0 +1,754 @@
+/*-
+ * Copyright (c) 2016 Ruslan Bukin 
+ * All rights reserved.
+ *
+ * This software was developed by SRI International and the University of
+ * Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237
+ * ("CTSRD"), as part of the DARPA CRASH research programme.
+ *
+ * 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 AND CONTRIBUTORS ``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 OR CONTRIBUTORS 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.
+ */
+
+/* Ingenic JZ4780 Audio Interface Controller (AIC). */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+
+#defineAIC_NCHANNELS 

svn commit: r310332 - head/cddl/contrib/opensolaris/lib/libdtrace/common

2016-12-20 Thread Mark Johnston
Author: markj
Date: Tue Dec 20 18:25:41 2016
New Revision: 310332
URL: https://svnweb.freebsd.org/changeset/base/310332

Log:
  Avoid modifying the object string table when patching USDT probes.
  
  dtrace converts pairs of consecutive underscores in a probe name to dashes.
  When dtrace -G processes relocations corresponding to USDT probe sites, it
  performs this conversion on the corresponding symbol names prior to looking
  up the resulting probe names in the USDT provider definition. However, in
  so doing it would actually modify the input object's string table, which
  breaks the string suffix merging done by recent binutils. Because we don't
  care about the symbol name once the probe site is recorded, just perform the
  probe lookup using a temporary copy.
  
  Reported by:  hrs, swills
  MFC after:3 weeks

Modified:
  head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c

Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c
==
--- head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.cTue Dec 
20 18:09:59 2016(r310331)
+++ head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.cTue Dec 
20 18:25:41 2016(r310332)
@@ -1223,6 +1223,7 @@ process_obj(dtrace_hdl_t *dtp, const cha
static const char dt_enabled[] = "enabled";
static const char dt_symprefix[] = "$dtrace";
static const char dt_symfmt[] = "%s%ld.%s";
+   char probename[DTRACE_NAMELEN];
int fd, i, ndx, eprobe, mod = 0;
Elf *elf = NULL;
GElf_Ehdr ehdr;
@@ -1576,8 +1577,6 @@ process_obj(dtrace_hdl_t *dtp, const cha
bcopy(s, pname, p - s);
pname[p - s] = '\0';
 
-   p = strhyphenate(p + 3); /* strlen("___") */
-
if (dt_symtab_lookup(data_sym, isym, rela.r_offset,
shdr_rel.sh_info, ,
(emachine1 == EM_PPC64), elf) != 0)
@@ -1628,10 +1627,14 @@ process_obj(dtrace_hdl_t *dtp, const cha
"no such provider %s", pname));
}
 
-   if ((prp = dt_probe_lookup(pvp, p)) == NULL) {
+   if (strlcpy(probename, p + 3, sizeof (probename)) >=
+   sizeof (probename))
return (dt_link_error(dtp, elf, fd, bufs,
-   "no such probe %s", p));
-   }
+   "invalid probe name %s", probename));
+   (void) strhyphenate(probename);
+   if ((prp = dt_probe_lookup(pvp, probename)) == NULL)
+   return (dt_link_error(dtp, elf, fd, bufs,
+   "no such probe %s", probename));
 
assert(fsym.st_value <= rela.r_offset);
 
___
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: r310331 - head/sys/mips/ingenic

2016-12-20 Thread Ruslan Bukin
Author: br
Date: Tue Dec 20 18:09:59 2016
New Revision: 310331
URL: https://svnweb.freebsd.org/changeset/base/310331

Log:
  Add jz4780 PDMA controller driver.
  
  Sponsored by: DARPA, AFRL
  Differential Revision:https://reviews.freebsd.org/D8817

Added:
  head/sys/mips/ingenic/jz4780_pdma.c   (contents, props changed)
Modified:
  head/sys/mips/ingenic/files.jz4780
  head/sys/mips/ingenic/files.x1000

Modified: head/sys/mips/ingenic/files.jz4780
==
--- head/sys/mips/ingenic/files.jz4780  Tue Dec 20 18:02:07 2016
(r310330)
+++ head/sys/mips/ingenic/files.jz4780  Tue Dec 20 18:09:59 2016
(r310331)
@@ -19,6 +19,7 @@ mips/ingenic/jz4780_intr.cstandard
 mips/ingenic/jz4780_gpio.c standard
 mips/ingenic/jz4780_machdep.c  standard
 mips/ingenic/jz4780_nemc.c standard
+mips/ingenic/jz4780_pdma.c standard
 mips/ingenic/jz4780_pinctrl.c  standard
 mips/ingenic/jz4780_timer.cstandard
 

Modified: head/sys/mips/ingenic/files.x1000
==
--- head/sys/mips/ingenic/files.x1000   Tue Dec 20 18:02:07 2016
(r310330)
+++ head/sys/mips/ingenic/files.x1000   Tue Dec 20 18:09:59 2016
(r310331)
@@ -10,6 +10,7 @@ mips/ingenic/jz4780_clk_pll.c standard
 mips/ingenic/jz4780_intr.c standard
 mips/ingenic/jz4780_gpio.c standard
 mips/ingenic/jz4780_machdep.c  standard
+mips/ingenic/jz4780_pdma.c standard
 mips/ingenic/jz4780_pinctrl.c  standard
 mips/ingenic/jz4780_timer.cstandard
 

Added: head/sys/mips/ingenic/jz4780_pdma.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/mips/ingenic/jz4780_pdma.c Tue Dec 20 18:09:59 2016
(r310331)
@@ -0,0 +1,544 @@
+/*-
+ * Copyright (c) 2016 Ruslan Bukin 
+ * All rights reserved.
+ *
+ * This software was developed by SRI International and the University of
+ * Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237
+ * ("CTSRD"), as part of the DARPA CRASH research programme.
+ *
+ * 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 AND CONTRIBUTORS ``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 OR CONTRIBUTORS 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.
+ */
+
+/* Ingenic JZ4780 PDMA Controller. */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include "opt_platform.h"
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#ifdef FDT
+#include 
+#include 
+#include 
+#endif
+
+#include 
+
+#include 
+#include 
+
+#include "xdma_if.h"
+
+struct pdma_softc {
+   device_tdev;
+   struct resource *res[2];
+   bus_space_tag_t bst;
+   bus_space_handle_t  bsh;
+   void*ih;
+};
+
+struct pdma_fdt_data {
+   int tx;
+   int rx;
+   int chan;
+};
+
+struct pdma_channel {
+   xdma_channel_t  *xchan;
+   struct pdma_fdt_datadata;
+   int cur_desc;
+   int used;
+   int index;
+   int flags;
+#defineCHAN_DESCR_RELINK   (1 << 0)
+};
+
+#definePDMA_NCHANNELS  32
+struct pdma_channel pdma_channels[PDMA_NCHANNELS];
+
+static struct resource_spec pdma_spec[] = {
+   { SYS_RES_MEMORY,   0,  RF_ACTIVE },
+   { SYS_RES_IRQ,  0,  RF_ACTIVE },
+   { -1, 0 }
+};
+
+static int pdma_probe(device_t dev);
+static int pdma_attach(device_t dev);
+static int pdma_detach(device_t dev);
+static int chan_start(struct pdma_softc *sc, struct pdma_channel *chan);
+
+static void
+pdma_intr(void *arg)
+{
+   struct 

svn commit: r310330 - in head: share/man/man4 sys/conf sys/dev/xdma

2016-12-20 Thread Ruslan Bukin
Author: br
Date: Tue Dec 20 18:02:07 2016
New Revision: 310330
URL: https://svnweb.freebsd.org/changeset/base/310330

Log:
  Add xDMA -- the DMA abstraction layer, initial verison.
  
  xDMA is a DMA framework designed to abstract the interaction
  between device drivers and DMA engines.
  
  Project wiki: https://wiki.freebsd.org/xdma
  
  Sponsored by: DARPA, AFRL
  Differential Revision:https://reviews.freebsd.org/D8807

Added:
  head/share/man/man4/xdma.4   (contents, props changed)
  head/sys/dev/xdma/
  head/sys/dev/xdma/xdma.c   (contents, props changed)
  head/sys/dev/xdma/xdma.h   (contents, props changed)
  head/sys/dev/xdma/xdma_fdt_test.c   (contents, props changed)
  head/sys/dev/xdma/xdma_if.m   (contents, props changed)
Modified:
  head/sys/conf/files

Added: head/share/man/man4/xdma.4
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/share/man/man4/xdma.4  Tue Dec 20 18:02:07 2016(r310330)
@@ -0,0 +1,77 @@
+.\" Copyright (c) 2016 Ruslan Bukin 
+.\" All rights reserved.
+.\"
+.\" This software was developed by SRI International and the University of
+.\" Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237
+.\" ("CTSRD"), as part of the DARPA CRASH research programme.
+.\"
+.\" 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 AND CONTRIBUTORS ``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 OR CONTRIBUTORS 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.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd December 12, 2016
+.Dt XDMA 4
+.Os
+.Sh NAME
+.Nm xdma
+.Nd DMA abstraction layer
+.Sh SYNOPSIS
+To compile xDMA device support into the kernel, place the following line
+in your kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device xdma"
+.Ed
+.Pp
+To compile xDMA FDT-based test driver, place the following line as well:
+.Bd -literal -offset indent
+.Cd "device xdma_test"
+.Ed
+.Sh DESCRIPTION
+xDMA is a DMA framework designed to abstract the interaction between device
+drivers and DMA engines.
+.Pp
+xDMA defines an interface for efficient interaction between the device driver
+and DMA controller.
+The
+.Nm
+device provides a virtual DMA controller and virtual channels called xchans.
+The controller provides virtual channels management (allocation, deallocation,
+configuration) and interrupt notification esteblishment needed to receive
+events from the hardware DMA controller.
+.Nm
+supports the following transfer types:
+.Bl -hang -offset indent -width 
+.It Nm Cyclic
+A non-stop periodic transfer designed for applications like audio.
+.It Nm Memcpy
+A memory-to-memory transfer.
+.El
+.Sh SEE ALSO
+.Xr bus_dma 9
+.Sh HISTORY
+Support for xDMA first appeared in
+.Fx 12.0 .
+.Sh AUTHORS
+.An -nosplit
+.Fx
+xDMA framework was first added by
+.An Ruslan Bukin Aq Mt b...@freebsd.org .

Modified: head/sys/conf/files
==
--- head/sys/conf/files Tue Dec 20 17:12:17 2016(r310329)
+++ head/sys/conf/files Tue Dec 20 18:02:07 2016(r310330)
@@ -3262,6 +3262,9 @@ wpi.fwoptional wpifw  
\
compile-with"${NORMAL_FW}"  \
no-obj no-implicit-rule \
clean   "wpi.fw"
+dev/xdma/xdma.coptional xdma
+dev/xdma/xdma_if.m optional xdma
+dev/xdma/xdma_fdt_test.c   optional xdma xdma_test fdt
 dev/xe/if_xe.c optional xe
 dev/xe/if_xe_pccard.c  optional xe pccard
 dev/xen/balloon/balloon.c  optional xenhvm

Added: head/sys/dev/xdma/xdma.c
==
--- /dev/null   

svn commit: r310329 - head/usr.sbin/cron/crontab

2016-12-20 Thread Conrad E. Meyer
Author: cem
Date: Tue Dec 20 17:12:17 2016
New Revision: 310329
URL: https://svnweb.freebsd.org/changeset/base/310329

Log:
  Add a 'force' option for non-interactive crontab removal
  
  Add a '-f' option to force crontab '-r' to be non-interactive.
  
  Submitted by: Sam Gwydir 
  Reviewed by:  me, wblock (previous version)
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D8815

Modified:
  head/usr.sbin/cron/crontab/crontab.1
  head/usr.sbin/cron/crontab/crontab.c

Modified: head/usr.sbin/cron/crontab/crontab.1
==
--- head/usr.sbin/cron/crontab/crontab.1Tue Dec 20 16:37:45 2016
(r310328)
+++ head/usr.sbin/cron/crontab/crontab.1Tue Dec 20 17:12:17 2016
(r310329)
@@ -17,7 +17,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd May 13, 2010
+.Dd December 20, 2016
 .Dt CRONTAB 1
 .Os
 .Sh NAME
@@ -31,7 +31,8 @@
 .Op Fl u Ar user
 {
 .Fl l |
-.Fl r |
+.Fl r Op Fl f
+|
 .Fl e
 }
 .Sh DESCRIPTION
@@ -97,6 +98,11 @@ option for safety's sake.
 Display the current crontab on standard output.
 .It Fl r
 Remove the current crontab.
+By default the
+.Fl r
+option prompts for confirmation, adding the
+.Fl f
+option will attempt to remove the current crontab without confirmation.
 .It Fl e
 Edit the current crontab using the editor specified by
 the

Modified: head/usr.sbin/cron/crontab/crontab.c
==
--- head/usr.sbin/cron/crontab/crontab.cTue Dec 20 16:37:45 2016
(r310328)
+++ head/usr.sbin/cron/crontab/crontab.cTue Dec 20 17:12:17 2016
(r310329)
@@ -63,6 +63,7 @@ staticcharFilename[MAX_FNAME];
 static FILE*NewCrontab;
 static int CheckErrorCount;
 static enum opt_t  Option;
+static int fflag;
 static struct passwd   *pw;
 static voidlist_cmd(void),
delete_cmd(void),
@@ -79,7 +80,7 @@ usage(char *msg)
fprintf(stderr, "crontab: usage error: %s\n", msg);
fprintf(stderr, "%s\n%s\n",
"usage: crontab [-u user] file",
-   "   crontab [-u user] { -e | -l | -r }");
+   "   crontab [-u user] { -l | -r [-f] | -e }");
exit(ERROR_EXIT);
 }
 
@@ -142,7 +143,7 @@ parse_args(argc, argv)
strcpy(RealUser, User);
Filename[0] = '\0';
Option = opt_unknown;
-   while ((argch = getopt(argc, argv, "u:lerx:")) != -1) {
+   while ((argch = getopt(argc, argv, "u:lerx:f")) != -1) {
switch (argch) {
case 'x':
if (!set_debug_flags(optarg))
@@ -172,6 +173,9 @@ parse_args(argc, argv)
usage("only one operation permitted");
Option = opt_edit;
break;
+   case 'f':
+   fflag = 1;
+   break;
default:
usage("unrecognized option");
}
@@ -282,7 +286,7 @@ delete_cmd() {
charn[MAX_FNAME];
int ch, first;
 
-   if (isatty(STDIN_FILENO)) {
+   if (!fflag && isatty(STDIN_FILENO)) {
(void)fprintf(stderr, "remove crontab for %s? ", User);
first = ch = getchar();
while (ch != '\n' && ch != EOF)
___
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: r310328 - in stable/11/sys/cddl: contrib/opensolaris/uts/common/dtrace dev/dtrace

2016-12-20 Thread George V. Neville-Neil
Author: gnn
Date: Tue Dec 20 16:37:45 2016
New Revision: 310328
URL: https://svnweb.freebsd.org/changeset/base/310328

Log:
  MFC: 309069
  
  Add tunable to disable destructive dtrace
  
  Submitted by: Joerg Pernfuss 
  Reviewed by:  rstone, markj

Modified:
  stable/11/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c
  stable/11/sys/cddl/dev/dtrace/dtrace_load.c
  stable/11/sys/cddl/dev/dtrace/dtrace_sysctl.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c
==
--- stable/11/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c   Tue Dec 
20 15:45:53 2016(r310327)
+++ stable/11/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c   Tue Dec 
20 16:37:45 2016(r310328)
@@ -157,6 +157,10 @@
  * /etc/system.
  */
 intdtrace_destructive_disallow = 0;
+#ifndef illumos
+/* Positive logic version of dtrace_destructive_disallow for loader tunable */
+intdtrace_allow_destructive = 1;
+#endif
 dtrace_optval_tdtrace_nonroot_maxsize = (16 * 1024 * 1024);
 size_t dtrace_difo_maxsize = (256 * 1024);
 dtrace_optval_tdtrace_dof_maxsize = (8 * 1024 * 1024);

Modified: stable/11/sys/cddl/dev/dtrace/dtrace_load.c
==
--- stable/11/sys/cddl/dev/dtrace/dtrace_load.c Tue Dec 20 15:45:53 2016
(r310327)
+++ stable/11/sys/cddl/dev/dtrace/dtrace_load.c Tue Dec 20 16:37:45 2016
(r310328)
@@ -52,6 +52,17 @@ dtrace_load(void *dummy)
int i;
 #endif
 
+#ifndef illumos
+   /*
+* DTrace uses negative logic for the destructive mode switch, so it
+* is required to translate from the sysctl which uses positive logic.
+*/ 
+   if (dtrace_allow_destructive)
+   dtrace_destructive_disallow = 0;
+   else
+   dtrace_destructive_disallow = 1;
+#endif
+
/* Hook into the trap handler. */
dtrace_trap_func = dtrace_trap;
 

Modified: stable/11/sys/cddl/dev/dtrace/dtrace_sysctl.c
==
--- stable/11/sys/cddl/dev/dtrace/dtrace_sysctl.c   Tue Dec 20 15:45:53 
2016(r310327)
+++ stable/11/sys/cddl/dev/dtrace/dtrace_sysctl.c   Tue Dec 20 16:37:45 
2016(r310328)
@@ -92,3 +92,6 @@ SYSCTL_QUAD(_kern_dtrace, OID_AUTO, dof_
 
 SYSCTL_QUAD(_kern_dtrace, OID_AUTO, helper_actions_max, CTLFLAG_RW,
 _helper_actions_max, 0, "maximum number of allowed helper actions");
+
+SYSCTL_INT(_security_bsd, OID_AUTO, allow_destructive_dtrace, CTLFLAG_RDTUN,
+_allow_destructive, 1, "Allow destructive mode DTrace scripts");
___
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: r310180 - head/sys/net

2016-12-20 Thread Alan Somers
On Tue, Dec 20, 2016 at 7:52 AM, Ryan Stone  wrote:
>
>
> On Fri, Dec 16, 2016 at 5:39 PM, Alan Somers  wrote:
>>
>>
>> Modified: head/sys/net/if_lagg.c
>>
>> ==
>> --- head/sys/net/if_lagg.c  Fri Dec 16 22:37:16 2016(r310179)
>> +++ head/sys/net/if_lagg.c  Fri Dec 16 22:39:30 2016(r310180)
>> @@ -252,6 +252,7 @@ SYSCTL_INT(_net_link_lagg, OID_AUTO, def
>>  _NAME(def_flowid_shift), 0,
>>  "Default setting for flowid shift for load sharing");
>>
>> +#pragma clang optimize off
>>  static void
>>  vnet_lagg_init(const void *unused __unused)
>>  {
>
>
> Did you intend to commit this pragma?
>

Uh, no.  Fixed in r310327.
___
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: r310327 - head/sys/net

2016-12-20 Thread Alan Somers
Author: asomers
Date: Tue Dec 20 15:45:53 2016
New Revision: 310327
URL: https://svnweb.freebsd.org/changeset/base/310327

Log:
  Remove stray debugging code from r310180
  
  Reported by:  rstone
  Pointy hat to:asomers
  MFC after:3 weeks
  X-MFC-with:   310180
  Sponsored by: Spectra Logic Corp

Modified:
  head/sys/net/if_lagg.c

Modified: head/sys/net/if_lagg.c
==
--- head/sys/net/if_lagg.c  Tue Dec 20 10:56:08 2016(r310326)
+++ head/sys/net/if_lagg.c  Tue Dec 20 15:45:53 2016(r310327)
@@ -252,7 +252,6 @@ SYSCTL_INT(_net_link_lagg, OID_AUTO, def
 _NAME(def_flowid_shift), 0,
 "Default setting for flowid shift for load sharing");
 
-#pragma clang optimize off
 static void
 vnet_lagg_init(const void *unused __unused)
 {
___
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: r310180 - head/sys/net

2016-12-20 Thread Ryan Stone
On Fri, Dec 16, 2016 at 5:39 PM, Alan Somers  wrote:

>
> Modified: head/sys/net/if_lagg.c
> 
> ==
> --- head/sys/net/if_lagg.c  Fri Dec 16 22:37:16 2016(r310179)
> +++ head/sys/net/if_lagg.c  Fri Dec 16 22:39:30 2016(r310180)
> @@ -252,6 +252,7 @@ SYSCTL_INT(_net_link_lagg, OID_AUTO, def
>  _NAME(def_flowid_shift), 0,
>  "Default setting for flowid shift for load sharing");
>
> +#pragma clang optimize off
>  static void
>  vnet_lagg_init(const void *unused __unused)
>  {
>

Did you intend to commit this pragma?
___
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: r310324 - in head/sys: conf dev/hyperv/utilities modules/hyperv/utilities

2016-12-20 Thread Sepherosa Ziehau
Author: sephe
Date: Tue Dec 20 09:46:14 2016
New Revision: 310324
URL: https://svnweb.freebsd.org/changeset/base/310324

Log:
  hyperv/ic: Rename cleaned up files.
  
  MFC after:1 week
  Sponsored by: Microsoft
  Differential Revision:https://reviews.freebsd.org/D8850

Added:
  head/sys/dev/hyperv/utilities/vmbus_heartbeat.c
 - copied unchanged from r310323, 
head/sys/dev/hyperv/utilities/hv_heartbeat.c
  head/sys/dev/hyperv/utilities/vmbus_shutdown.c
 - copied unchanged from r310323, 
head/sys/dev/hyperv/utilities/hv_shutdown.c
  head/sys/dev/hyperv/utilities/vmbus_timesync.c
 - copied unchanged from r310323, 
head/sys/dev/hyperv/utilities/hv_timesync.c
Deleted:
  head/sys/dev/hyperv/utilities/hv_heartbeat.c
  head/sys/dev/hyperv/utilities/hv_shutdown.c
  head/sys/dev/hyperv/utilities/hv_timesync.c
Modified:
  head/sys/conf/files.amd64
  head/sys/conf/files.i386
  head/sys/modules/hyperv/utilities/Makefile

Modified: head/sys/conf/files.amd64
==
--- head/sys/conf/files.amd64   Tue Dec 20 08:49:13 2016(r310323)
+++ head/sys/conf/files.amd64   Tue Dec 20 09:46:14 2016(r310324)
@@ -298,12 +298,12 @@ dev/hyperv/netvsc/hn_nvs.c
optionalh
 dev/hyperv/netvsc/hn_rndis.c   optionalhyperv
 dev/hyperv/netvsc/if_hn.c  optionalhyperv
 dev/hyperv/storvsc/hv_storvsc_drv_freebsd.coptionalhyperv
-dev/hyperv/utilities/hv_heartbeat.coptionalhyperv
 dev/hyperv/utilities/hv_kvp.c  optionalhyperv
 dev/hyperv/utilities/hv_snapshot.c optionalhyperv
-dev/hyperv/utilities/hv_shutdown.c optionalhyperv
-dev/hyperv/utilities/hv_timesync.c optionalhyperv
+dev/hyperv/utilities/vmbus_heartbeat.c optionalhyperv
 dev/hyperv/utilities/vmbus_ic.coptional
hyperv
+dev/hyperv/utilities/vmbus_shutdown.c  optionalhyperv
+dev/hyperv/utilities/vmbus_timesync.c  optionalhyperv
 dev/hyperv/vmbus/hyperv.c  optionalhyperv
 dev/hyperv/vmbus/hyperv_busdma.c   optionalhyperv
 dev/hyperv/vmbus/vmbus.c   optionalhyperv 
pci

Modified: head/sys/conf/files.i386
==
--- head/sys/conf/files.i386Tue Dec 20 08:49:13 2016(r310323)
+++ head/sys/conf/files.i386Tue Dec 20 09:46:14 2016(r310324)
@@ -254,12 +254,12 @@ dev/hyperv/netvsc/hn_nvs.c
optionalh
 dev/hyperv/netvsc/hn_rndis.c   optionalhyperv
 dev/hyperv/netvsc/if_hn.c  optionalhyperv
 dev/hyperv/storvsc/hv_storvsc_drv_freebsd.coptionalhyperv
-dev/hyperv/utilities/hv_heartbeat.coptionalhyperv
 dev/hyperv/utilities/hv_kvp.c  optionalhyperv
 dev/hyperv/utilities/hv_snapshot.c optionalhyperv
-dev/hyperv/utilities/hv_shutdown.c optionalhyperv
-dev/hyperv/utilities/hv_timesync.c optionalhyperv
+dev/hyperv/utilities/vmbus_heartbeat.c optionalhyperv
 dev/hyperv/utilities/vmbus_ic.coptional
hyperv
+dev/hyperv/utilities/vmbus_shutdown.c  optionalhyperv
+dev/hyperv/utilities/vmbus_timesync.c  optionalhyperv
 dev/hyperv/vmbus/hyperv.c  optionalhyperv
 dev/hyperv/vmbus/hyperv_busdma.c   optionalhyperv
 dev/hyperv/vmbus/vmbus.c   optionalhyperv 
pci

Copied: head/sys/dev/hyperv/utilities/vmbus_heartbeat.c (from r310323, 
head/sys/dev/hyperv/utilities/hv_heartbeat.c)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/dev/hyperv/utilities/vmbus_heartbeat.c Tue Dec 20 09:46:14 
2016(r310324, copy of r310323, 
head/sys/dev/hyperv/utilities/hv_heartbeat.c)
@@ -0,0 +1,152 @@
+/*-
+ * Copyright (c) 2014,2016 Microsoft Corp.
+ * 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 unmodified, this list of conditions, and the following
+ *disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, 

svn commit: r310323 - head/usr.sbin/syslogd

2016-12-20 Thread Hiroki Sato
Author: hrs
Date: Tue Dec 20 08:49:13 2016
New Revision: 310323
URL: https://svnweb.freebsd.org/changeset/base/310323

Log:
  Escape punctuation characters.

Modified:
  head/usr.sbin/syslogd/syslogd.8

Modified: head/usr.sbin/syslogd/syslogd.8
==
--- head/usr.sbin/syslogd/syslogd.8 Tue Dec 20 08:42:47 2016
(r310322)
+++ head/usr.sbin/syslogd/syslogd.8 Tue Dec 20 08:49:13 2016
(r310323)
@@ -40,7 +40,7 @@
 .Op Fl a Ar allowed_peer
 .Op Fl b Ar bind_address
 .Op Fl f Ar config_file
-.Op Fl l Oo Ar mode : Oc Ns Ar path
+.Op Fl l Oo Ar mode \&: Oc Ns Ar path
 .Op Fl m Ar mark_interval
 .Op Fl P Ar pid_file
 .Op Fl p Ar log_socket
@@ -103,7 +103,7 @@ option may be any of the following:
 .Sm off
 .Ar ipaddr
 .No / Ar masklen
-.Op : Ar service
+.Op \&: Ar service
 .Sm on
 .Xc
 Accept datagrams from
@@ -145,7 +145,7 @@ is IPv6 address, a missing
 will be substituted by 128.
 .It Xo
 .Sm off
-.Ar domainname Op : Ar service
+.Ar domainname Op \&: Ar service
 .Sm on
 .Xc
 Accept datagrams where the reverse address lookup yields
@@ -156,7 +156,7 @@ The meaning of
 is as explained above.
 .It Xo
 .Sm off
-.No * Ar domainname Op : Ar service
+.No * Ar domainname Op \&: Ar service
 .Sm on
 .Xc
 Same as before, except that any source host whose name
@@ -174,13 +174,13 @@ option is also specified.
 .It Xo
 .Fl b
 .Sm off
-.Ar bind_address Op : Ar service
+.Ar bind_address Op \&: Ar service
 .Sm on
 .Xc
 .It Xo
 .Fl b
 .Sm off
-.Li : Ar service
+.Li \&: Ar service
 .Sm on
 .Xc
 Bind to a specific address and/or port.
___
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: r310322 - stable/10/sys/fs/nfs

2016-12-20 Thread Colin Percival
Author: cperciva
Date: Tue Dec 20 08:42:47 2016
New Revision: 310322
URL: https://svnweb.freebsd.org/changeset/base/310322

Log:
  MFC r308708: Reduce verbosity of warnings about truncating NFS fileids to
  32-bit inode numbers.

Modified:
  stable/10/sys/fs/nfs/nfs_commonsubs.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/fs/nfs/nfs_commonsubs.c
==
--- stable/10/sys/fs/nfs/nfs_commonsubs.c   Tue Dec 20 08:01:17 2016
(r310321)
+++ stable/10/sys/fs/nfs/nfs_commonsubs.c   Tue Dec 20 08:42:47 2016
(r310322)
@@ -827,6 +827,11 @@ nfsv4_loadattr(struct nfsrv_descript *nd
struct dqblk dqb;
uid_t savuid;
 #endif
+   static struct timeval last64fileid;
+   static size_t count64fileid;
+   static struct timeval last64mountfileid;
+   static size_t count64mountfileid;
+   static struct timeval warninterval = { 60, 0 };
 
if (compare) {
retnotsup = 0;
@@ -1196,8 +1201,14 @@ nfsv4_loadattr(struct nfsrv_descript *nd
*retcmpp = NFSERR_NOTSAME;
}
} else if (nap != NULL) {
-   if (*tl++)
-   printf("NFSv4 fileid > 32bits\n");
+   if (*tl++) {
+   count64fileid++;
+   if (ratecheck(, 
)) {
+   printf("NFSv4 fileid > 32bits 
(%zu occurrences)\n",
+   count64fileid);
+   count64fileid = 0;
+   }
+   }
nap->na_fileid = thyp;
}
attrsum += NFSX_HYPER;
@@ -1734,8 +1745,14 @@ nfsv4_loadattr(struct nfsrv_descript *nd
}
}
} else if (nap != NULL) {
-   if (*tl++)
-   printf("NFSv4 mounted on fileid > 32bits\n");
+   if (*tl++) {
+   count64mountfileid++;
+   if (ratecheck(, 
)) {
+   printf("NFSv4 mounted on fileid > 
32bits (%zu occurrences)\n",
+   count64mountfileid);
+   count64mountfileid = 0;
+   }
+   }
nap->na_mntonfileno = thyp;
}
attrsum += NFSX_HYPER;
___
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: r310321 - stable/9/lib/libc/gen

2016-12-20 Thread Ed Schouten
Author: ed
Date: Tue Dec 20 08:01:17 2016
New Revision: 310321
URL: https://svnweb.freebsd.org/changeset/base/310321

Log:
  MFC r309650:
  
Properly sign extend the result of jrand48() and mrand48().
  
These functions are supposed to return a value between [-2^31, 2^31).
This doesn't seem to work on 64-bit systems, where we return a value
between [0, 3^32). Patch up the function to use proper casts to int32_t.
While there, fix some other style bugs.

Modified:
  stable/9/lib/libc/gen/jrand48.c
  stable/9/lib/libc/gen/mrand48.c
Directory Properties:
  stable/9/lib/libc/   (props changed)

Modified: stable/9/lib/libc/gen/jrand48.c
==
--- stable/9/lib/libc/gen/jrand48.c Tue Dec 20 07:50:49 2016
(r310320)
+++ stable/9/lib/libc/gen/jrand48.c Tue Dec 20 08:01:17 2016
(r310321)
@@ -14,11 +14,14 @@
 #include 
 __FBSDID("$FreeBSD$");
 
+#include 
+
 #include "rand48.h"
 
 long
 jrand48(unsigned short xseed[3])
 {
+
_dorand48(xseed);
-   return ((long) xseed[2] << 16) + (long) xseed[1];
+   return ((int32_t)(((uint32_t)xseed[2] << 16) | (uint32_t)xseed[1]));
 }

Modified: stable/9/lib/libc/gen/mrand48.c
==
--- stable/9/lib/libc/gen/mrand48.c Tue Dec 20 07:50:49 2016
(r310320)
+++ stable/9/lib/libc/gen/mrand48.c Tue Dec 20 08:01:17 2016
(r310321)
@@ -14,6 +14,8 @@
 #include 
 __FBSDID("$FreeBSD$");
 
+#include 
+
 #include "rand48.h"
 
 extern unsigned short _rand48_seed[3];
@@ -21,6 +23,8 @@ extern unsigned short _rand48_seed[3];
 long
 mrand48(void)
 {
+
_dorand48(_rand48_seed);
-   return ((long) _rand48_seed[2] << 16) + (long) _rand48_seed[1];
+   return ((int32_t)(((uint32_t)_rand48_seed[2] << 16) |
+   (uint32_t)_rand48_seed[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"